-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
27 lines (24 loc) · 983 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
var tap = require('tap')
var block = require('./lib/index');
var myBlock = block('my-block', 'my-modifier');
tap.equals(myBlock(), 'my-block my-block--my-modifier');
var expected = 'my-block__my-element my-block__my-element--my-modifier1 my-block__my-element--my-modifier2';
tap.equals(myBlock('my-element', 'my-modifier1', 'my-modifier2'), expected);
tap.equals(myBlock('my-element', ['my-modifier1', 'my-modifier2']), expected);
tap.equals(myBlock('my-element', {
'my-modifier1': true,
'my-modifier2': 1,
'my-modifier3': false,
'my-modifier4': 0,
'my-modifier5': null,
}), expected);
expected = 'my-block my-block--my-modifier1 my-block--my-modifier2';
tap.equals(block('my-block', 'my-modifier1', 'my-modifier2')(), expected);
tap.equals(block('my-block', ['my-modifier1', 'my-modifier2'])(), expected);
tap.equals(block('my-block', {
'my-modifier1': true,
'my-modifier2': 1,
'my-modifier3': false,
'my-modifier4': 0,
'my-modifier5': null,
})(), expected);