-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
53 lines (47 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
46
47
48
49
50
51
52
53
'use strict';
import test from 'tape';
import LazyLoad from './';
import { renderString, tree } from 'deku';
import tsml from 'tsml';
import element from 'magic-virtual-element';
test('LazyLoad initial state', function (t) {
var html = renderString(tree(LazyLoad.render({
props: {
children: <div class='foo'></div>
},
state: {}
})));
t.equal(html, tsml`
<div class="lazy-load" style="width: 1px; height: 1px">
</div>`);
t.end();
});
test('LazyLoad visible=false, height & width property', function (t) {
var html = renderString(tree(LazyLoad.render({
props: {
'width': 100,
'height': 200,
children: <div class='foo'></div>
},
state: {}
})));
t.equal(html, tsml`
<div class="lazy-load" style="width: 100px; height: 200px">
</div>`);
t.end();
});
test('LazyLoad visible=true', function (t) {
var html = renderString(tree(LazyLoad.render({
props: {
children: <div class='foo'></div>
},
state: {
visible: true
}
})));
t.equal(html, tsml`
<div class="lazy-load">
<div class="foo"></div>
</div>`);
t.end();
});