Skip to content

Commit

Permalink
test(bem-cell): id field
Browse files Browse the repository at this point in the history
  • Loading branch information
qfox authored and blond committed Dec 12, 2016
1 parent 5707da8 commit 287fa7f
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions test/id.test.js
@@ -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);
});

0 comments on commit 287fa7f

Please sign in to comment.