-
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
79 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
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' }); | ||
|
||
t.true(cell.isEqual(cell)) | ||
}); | ||
|
||
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' }); | ||
|
||
t.false(cell1.isEqual(cell2)); | ||
}); | ||
|
||
test('should detect equal cell without tech and layer', t => { | ||
const cell = new BemCell({ entity: new BemEntityName({ block: 'button' }) }); | ||
|
||
t.true(cell.isEqual(cell)); | ||
}); | ||
|
||
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' }); | ||
|
||
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' }); | ||
|
||
t.false(cell1.isEqual(cell2)); | ||
}); |