File tree Expand file tree Collapse file tree 2 files changed +31
-2
lines changed
Expand file tree Collapse file tree 2 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ const BemCellSet = hashSet(helpers.stringifyCell);
2323function parse ( importString , ctx ) {
2424 const cell = { } ;
2525
26- ctx && ( importString = helpers . expand ( importString , ctx ) ) ;
26+ ctx && ( importString = expand ( importString , ctx ) ) ;
2727
2828 return Array . from ( importString . split ( ' ' ) . reduce ( ( acc , importToken ) => {
2929 const split = importToken . split ( ':' ) ,
@@ -92,5 +92,6 @@ function stringify(cells) {
9292
9393module . exports = {
9494 parse,
95- stringify
95+ stringify,
96+ expand : helpers . expand
9697} ;
Original file line number Diff line number Diff line change 1+ var expect = require ( 'chai' ) . expect ,
2+ e = require ( '..' ) . expand ;
3+
4+ it ( 'should return notation if no ctx specified' , ( ) => {
5+ expect ( e ( 'b:button' ) ) . to . eql ( 'b:button' ) ;
6+ } ) ;
7+
8+ describe ( 'ctx' , ( ) => {
9+ describe ( 'block' , ( ) => {
10+ it ( 'should copy block if notation has no block' , ( ) => {
11+ expect ( e ( 'e:icon' , { block : 'button' } ) ) . to . eql ( 'b:button e:icon' ) ;
12+ } ) ;
13+
14+ it ( 'should not copy block if notation has block' , ( ) => {
15+ expect ( e ( 'b:button e:icon' , { block : 'input' } ) ) . to . eql ( 'b:button e:icon' ) ;
16+ } ) ;
17+ } ) ;
18+
19+ describe ( 'elem' , ( ) => {
20+ it ( 'should copy elem if notation has no elem' , ( ) => {
21+ expect ( e ( 'm:theme=default' , { block : 'button' , elem : 'icon' } ) ) . to . eql ( 'b:button e:icon m:theme=default' ) ;
22+ } ) ;
23+
24+ it ( 'should not copy elem if notation has elem' , ( ) => {
25+ expect ( e ( 'b:button e:icon' , { block : 'input' , elem : 'clear' } ) ) . to . eql ( 'b:button e:icon' ) ;
26+ } ) ;
27+ } ) ;
28+ } ) ;
You can’t perform that action at this time.
0 commit comments