-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
45 lines (40 loc) · 1.11 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
const o = require('ospec')
const tagl_mithril = require('.')
o.spec('basic usage', () => {
o('without classes', function(done) {
function m(tagname, ...args) {
o(tagname).equals('div')
o(args).deepEquals([1, 2])
done()
}
const { div } = tagl_mithril(m)
div(1, 2)
})
o('with classes', function(done) {
function m(tagname, ...args) {
o(tagname).equals('span.foo')
o(args).deepEquals([{}, 'huhu', 'haha'])
done()
}
const { span } = tagl_mithril(m)
span.foo({}, 'huhu', 'haha')
})
o('with camelcase classes', function(done) {
function m(tagname, ...args) {
o(tagname).equals('span.foo-fighters')
o(args).deepEquals([{}, 'huhu', 'haha'])
done()
}
const { span } = tagl_mithril(m)
span.fooFighters({}, 'huhu', 'haha')
})
o('with camelcase id', function(done) {
function m(tagname, ...args) {
o(tagname).equals('span#foo-fighters')
o(args).deepEquals([{}, 'huhu', 'haha'])
done()
}
const { span } = tagl_mithril(m)
span.$fooFighters({}, 'huhu', 'haha')
})
})