Skip to content
This repository has been archived by the owner on Aug 1, 2019. It is now read-only.

Commit

Permalink
Add optional tech to bem-cell
Browse files Browse the repository at this point in the history
  • Loading branch information
Yeti-or committed Jan 24, 2017
1 parent 1a4f7e3 commit 9df0c17
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/schemes/flat.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module.exports = {

var naming = bemNaming(options.naming);

return path.join(layer, naming.stringify(entity) + '.' + _tech);
return path.join(layer,
naming.stringify(entity) + (_tech ? '.' + _tech : ''));
}
};
2 changes: 1 addition & 1 deletion lib/schemes/nested.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ module.exports = {
modName ? (naming.modDelim + modName) : '');

return path.join(folder,
naming.stringify(entity) + '.' + _tech);
naming.stringify(entity) + (_tech ? '.' + _tech : ''));
}
};
28 changes: 28 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,20 @@ describe('default', function() {
).eql('a/%%%e1/###mn/a%%%e1###mn###mv.js', 'bemCell - api');
});

it('should support optional tech for BemCell', function() {
expect(
scheme('nested').path(
new BemCell({
entity: new BemEntityName({
block: 'a',
elem: 'e1',
mod: {name: 'mn', val: 'mv'}
})
})
)
).eql('a/__e1/_mn/a__e1_mn_mv', 'bemCell - api');
});

it('should support layer for BemCell', function() {
expect(
scheme('nested').path(
Expand Down Expand Up @@ -293,6 +307,20 @@ describe('default', function() {
).eql('a%%%e1###mn###mv.js', 'bemCell - api');
});

it('should support optional tech for BemCell', function() {
expect(
scheme('flat').path(
new BemCell({
entity: new BemEntityName({
block: 'a',
elem: 'e1',
mod: {name: 'mn', val: 'mv'}
})
})
)
).eql('a__e1_mn_mv', 'bemCell - api');
});

it('should support layer for BemCell', function() {
expect(
scheme('flat').path(
Expand Down

0 comments on commit 9df0c17

Please sign in to comment.