-
-
Notifications
You must be signed in to change notification settings - Fork 2k
/
unit.js
43 lines (30 loc) · 1.24 KB
/
unit.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
var runtime = require('../lib/runtime')
, merge = runtime.merge;
describe('merge(a, b, escaped)', function(){
it('should merge classes into strings', function(){
merge({ foo: 'bar' }, { bar: 'baz' })
.should.eql({ foo: 'bar', bar: 'baz' });
merge({ class: [] }, {})
.should.eql({ class: '' });
merge({ class: [] }, { class: [] })
.should.eql({ class: '' });
merge({ class: [] }, { class: ['foo'] })
.should.eql({ class: 'foo' });
merge({ class: ['foo'] }, {})
.should.eql({ class: 'foo' });
merge({ class: ['foo'] }, { class: ['bar'] })
.should.eql({ class: 'foo bar' });
merge({ class: ['foo', 'raz'] }, { class: ['bar', 'baz'] })
.should.eql({ class: 'foo raz bar baz' });
merge({ class: 'foo' }, { class: 'bar' })
.should.eql({ class: 'foo bar' });
merge({ class: 'foo' }, { class: 'bar' })
.should.eql({ class: 'foo bar' });
merge({ class: 'foo' }, { class: ['bar', 'baz'] })
.should.eql({ class: 'foo bar baz' });
merge({ class: ['foo', 'bar'] }, { class: 'baz' })
.should.eql({ class: 'foo bar baz' });
merge({ class: ['foo', null, 'bar'] }, { class: [undefined, null, 0, 'baz'] })
.should.eql({ class: 'foo bar 0 baz' });
})
})