This repository has been archived by the owner on Feb 6, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
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
14 changed files
with
176 additions
and
100 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
'use strict'; | ||
|
||
module.exports = class BemFile { | ||
constructor(cell, path) { | ||
this.cell = cell; | ||
this.path = path; | ||
} | ||
|
||
get entity() { | ||
return this.cell.entity; | ||
} | ||
|
||
get tech() { | ||
return this.cell.tech; | ||
} | ||
|
||
get layer() { | ||
return this.cell.layer; | ||
} | ||
|
||
get level() { | ||
return this.cell.layer; | ||
} | ||
}; |
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
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,25 @@ | ||
'use strict'; | ||
|
||
const test = require('ava'); | ||
|
||
const BemEntityName = require('@bem/entity-name'); | ||
const BemCell = require('@bem/cell'); | ||
|
||
const BemFile = require('../../lib/bem-file'); | ||
|
||
test('should provide classic bem-file fields', t => { | ||
const cell = new BemCell({ | ||
entity: new BemEntityName({ block: 'b', elem: 'e' }), | ||
tech: 'css', | ||
layer: 'bem-components/desktop' | ||
}); | ||
const path = 'bem-components/desktop.blocks/b/__e/b__e.css'; | ||
const file = new BemFile(cell, path); | ||
|
||
t.is(file.cell, cell); | ||
t.is(file.entity, cell.entity); | ||
t.is(file.tech, 'css'); | ||
t.is(file.level, cell.layer); | ||
t.is(file.layer, cell.layer); | ||
t.is(file.path, path); | ||
}); |
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
Oops, something went wrong.