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
1 changed file
with
46 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
const test = require('ava'); | ||
const BemEntityName = require('@bem/entity-name'); | ||
|
||
const BemCell = require('../index'); | ||
|
||
test('should provide `id` field', t => { | ||
const cell = new BemCell({ | ||
entity: new BemEntityName({ block: 'block' }), | ||
layer: 'desktop', | ||
tech: 'css' | ||
}); | ||
|
||
t.is(cell.id, 'block@desktop.css'); | ||
}); | ||
|
||
test('should provide `id` field for cell with tech', t => { | ||
const cell = new BemCell({ | ||
entity: new BemEntityName({ block: 'block' }), | ||
tech: 'css' | ||
}); | ||
|
||
t.is(cell.id, 'block.css'); | ||
}); | ||
|
||
test('should provide `id` field for cell with layer', t => { | ||
const cell = new BemCell({ | ||
entity: new BemEntityName({ block: 'block' }), | ||
layer: 'desktop', | ||
}); | ||
|
||
t.is(cell.id, 'block@desktop'); | ||
}); | ||
|
||
test('should provide `id` field for cell with layer', t => { | ||
const cell = new BemCell({ | ||
entity: new BemEntityName({ block: 'block' }), | ||
layer: 'desktop', | ||
tech: 'css' | ||
}); | ||
const id = cell.id; | ||
|
||
cell._tech = 'js'; | ||
cell._layer = 'common'; | ||
|
||
t.is(cell.id, id); | ||
}); |