forked from GREENpoint/bem-cn-fast
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
53 lines (46 loc) · 1.73 KB
/
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
'use strict';
const bem = require('./index');
const expect = require('chai').expect;
describe('bem-cn', function () {
it('should return block css-class without arguments', function () {
var b = bem('block-name');
expect(b()).to.be.equal('block-name');
});
it('should return element css-class with `element` argument', function () {
var b = bem('block-name');
expect(b('element-name')).to.be.equal('block-name__element-name');
});
it('should return block with mod css-class with `mods` argument', function () {
var b = bem('block-name');
expect(b({
'some-mod': 'visible'
})).to.be.equal('block-name block-name--some-mod_visible');
});
it('should return block with mod css-class with `mods` argument (Boolean mod)', function () {
var b = bem('block-name');
expect(b({
'some-mod': true
})).to.be.equal('block-name block-name--some-mod');
});
it('should return block without mod css-class with `mods` argument and empty mods values', function () {
var b = bem('block-name');
expect(b({
'some-mod': false,
'some-mode2': undefined,
'some-mode3': null,
'some-mode4': 0
})).to.be.equal('block-name');
});
it('should return element with mods css-classes with `element` and `mods` arguments', function () {
var b = bem('block-name');
expect(b(
'element-name',
{
'some-mod': 'visible',
'some-mod2': true
}
)).to.be.equal(
'block-name__element-name block-name__element-name--some-mod_visible block-name__element-name--some-mod2'
);
});
});