-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
28 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,38 @@ | ||
const test = require('ava'); | ||
const BemEntityName = require('@bem/entity-name'); | ||
|
||
const BemCell = require('../index'); | ||
|
||
test('should detect equal cell', t => { | ||
const cell = new BemCell({ entity: new BemEntityName({ block: 'button' }), tech: 'css', layer: 'desktop' }); | ||
const cell1 = BemCell.create({ entity: { block: 'button' }, tech: 'css', layer: 'desktop' }); | ||
const cell2 = BemCell.create({ entity: { block: 'button' }, tech: 'css', layer: 'desktop' }); | ||
|
||
t.true(cell.isEqual(cell)) | ||
t.true(cell1.isEqual(cell2)) | ||
}); | ||
|
||
test('should not detect equal cell by entity', t => { | ||
const cell1 = new BemCell({ entity: new BemEntityName({ block: 'button' }), tech: 'css', layer: 'desktop' }); | ||
const cell2 = new BemCell({ entity: new BemEntityName({ block: 'input' }), tech: 'css', layer: 'desktop' }); | ||
test('should detect that cells are not equal by entity', t => { | ||
const cell1 = BemCell.create({ entity: { block: 'button' }, tech: 'css', layer: 'desktop' }); | ||
const cell2 = BemCell.create({ entity: { block: 'input' }, tech: 'css', layer: 'desktop' }); | ||
|
||
t.false(cell1.isEqual(cell2)); | ||
}); | ||
|
||
test('should detect equal cell without tech and layer', t => { | ||
const cell = new BemCell({ entity: new BemEntityName({ block: 'button' }) }); | ||
const cell1 = BemCell.create({ entity: { block: 'button' } }); | ||
const cell2 = BemCell.create({ entity: { block: 'button' } }); | ||
|
||
t.true(cell.isEqual(cell)); | ||
t.true(cell1.isEqual(cell2)); | ||
}); | ||
|
||
test('should not detect equal cell by tech', t => { | ||
const cell1 = new BemCell({ entity: new BemEntityName({ block: 'button' }), tech: 'css', layer: 'desktop' }); | ||
const cell2 = new BemCell({ entity: new BemEntityName({ block: 'button' }), tech: 'js', layer: 'desktop' }); | ||
test('should detect that cells are not equal by tech', t => { | ||
const cell1 = BemCell.create({ entity: { block: 'button' }, tech: 'css', layer: 'desktop' }); | ||
const cell2 = BemCell.create({ entity: { block: 'button' }, tech: 'js', layer: 'desktop' }); | ||
|
||
t.false(cell1.isEqual(cell2)); | ||
}); | ||
|
||
test('should not detect equal cell by layer', t => { | ||
const cell1 = new BemCell({ entity: new BemEntityName({ block: 'button' }), tech: 'css', layer: 'desktop' }); | ||
const cell2 = new BemCell({ entity: new BemEntityName({ block: 'button' }), tech: 'css', layer: 'touch' }); | ||
test('should detect that cells are not equal by layer', t => { | ||
const cell1 = BemCell.create({ entity: { block: 'button' }, tech: 'css', layer: 'desktop' }); | ||
const cell2 = BemCell.create({ entity: { block: 'button' }, tech: 'css', layer: 'touch' }); | ||
|
||
t.false(cell1.isEqual(cell2)); | ||
}); |