aberdeen 0.1.1 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/deploy.yml +43 -0
- package/.vscode/launch.json +23 -0
- package/README.md +11 -5
- package/{dist → dist-min}/aberdeen.d.ts +28 -153
- package/dist-min/aberdeen.js +2 -0
- package/dist-min/aberdeen.js.map +1 -0
- package/dist-min/prediction.d.ts +29 -0
- package/dist-min/prediction.js +2 -0
- package/dist-min/prediction.js.map +1 -0
- package/dist-min/route.d.ts +16 -0
- package/dist-min/route.js +2 -0
- package/dist-min/route.js.map +1 -0
- package/dist-min/transitions.d.ts +18 -0
- package/dist-min/transitions.js +2 -0
- package/dist-min/transitions.js.map +1 -0
- package/examples/input/index.html +8 -0
- package/examples/input/input.css +56 -0
- package/examples/input/input.js +66 -0
- package/examples/list/index.html +7 -0
- package/examples/list/list.js +47 -0
- package/examples/router/index.html +8 -0
- package/examples/router/page-home.js +12 -0
- package/examples/router/page-list.js +35 -0
- package/examples/router/page-settings.js +6 -0
- package/examples/router/router.js +76 -0
- package/examples/router/style.css +88 -0
- package/examples/tic-tac-toe/index.html +8 -0
- package/examples/tic-tac-toe/tic-tac-toe.css +50 -0
- package/examples/tic-tac-toe/tic-tac-toe.js +90 -0
- package/package.json +35 -27
- package/src/aberdeen.ts +2037 -0
- package/src/prediction.ts +117 -0
- package/src/route.ts +121 -0
- package/src/transitions.ts +73 -0
- package/tests/_fakedom.js +255 -0
- package/tests/_init.js +81 -0
- package/tests/array.js +109 -0
- package/tests/binding.js +106 -0
- package/tests/browsers.js +22 -0
- package/tests/clean.js +26 -0
- package/tests/count.js +105 -0
- package/tests/create.js +92 -0
- package/tests/destroy.js +270 -0
- package/tests/dom.js +219 -0
- package/tests/errors.js +114 -0
- package/tests/immediate.js +87 -0
- package/tests/map.js +76 -0
- package/tests/objmap.js +40 -0
- package/tests/onEach.js +392 -0
- package/tests/prediction.js +97 -0
- package/tests/props.js +49 -0
- package/tests/schedule.js +44 -0
- package/tests/scope.js +277 -0
- package/tests/sort.js +105 -0
- package/tests/store.js +254 -0
- package/tsconfig.json +67 -0
- package/dist/aberdeen.js +0 -1837
- package/dist/aberdeen.min.js +0 -1
package/tests/array.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
describe('Array', () => {
|
|
2
|
+
it('fires higher-scope isEmpty before getting to content', () => {
|
|
3
|
+
let store = new Store(['a'])
|
|
4
|
+
let cnt1 = 0, cnt2 = 0
|
|
5
|
+
mount(document.body, () => {
|
|
6
|
+
cnt1++
|
|
7
|
+
if (!store.isEmpty()) {
|
|
8
|
+
node('div', () => {
|
|
9
|
+
cnt2++;
|
|
10
|
+
text(store.get(0))
|
|
11
|
+
})
|
|
12
|
+
}
|
|
13
|
+
})
|
|
14
|
+
assertBody(`div{"a"}`)
|
|
15
|
+
|
|
16
|
+
store.set(0, 'b')
|
|
17
|
+
passTime();
|
|
18
|
+
assertBody(`div{"b"}`)
|
|
19
|
+
assertEqual([cnt1,cnt2], [1,2])
|
|
20
|
+
|
|
21
|
+
store.delete(0);
|
|
22
|
+
passTime()
|
|
23
|
+
assertBody(``)
|
|
24
|
+
assertEqual([cnt1,cnt2], [2,2])
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
it('reactively get() full array', () => {
|
|
28
|
+
let store = new Store([3, 4, new Store([5, 6])])
|
|
29
|
+
mount(document.body, () => {
|
|
30
|
+
text(JSON.stringify(store.get()))
|
|
31
|
+
text(JSON.stringify(store.query({depth: 1})[2].get()))
|
|
32
|
+
})
|
|
33
|
+
passTime()
|
|
34
|
+
assertBody(`"[3,4,[5,6]]" "[5,6]"`)
|
|
35
|
+
|
|
36
|
+
store.push(7)
|
|
37
|
+
store.ref(2).push(8)
|
|
38
|
+
passTime()
|
|
39
|
+
assertBody(`"[3,4,[5,6,8],7]" "[5,6,8]"`)
|
|
40
|
+
|
|
41
|
+
assertEqual(store.get(6), undefined)
|
|
42
|
+
assertEqual(store.get(6, 'a'), undefined)
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
it('handles invalid indexes', () => {
|
|
46
|
+
let store = new Store(["a","b","c"])
|
|
47
|
+
for(let index in [-1, 1000000, "1", 0.5]) {
|
|
48
|
+
assertThrow('Invalid array index', () => store.set(index, "test"))
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
assertEqual(store.get("1"), "b")
|
|
52
|
+
assertThrow("Invalid array index", () => store.get('a'))
|
|
53
|
+
assertThrow("Invalid array index", () => store.get(true))
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
it('merges', () => {
|
|
57
|
+
let cnt1 = 0, cnt2 = 0
|
|
58
|
+
let store = new Store([1,undefined,3])
|
|
59
|
+
mount(document.body, () => {
|
|
60
|
+
cnt1++
|
|
61
|
+
store.onEach(item => {
|
|
62
|
+
cnt2++
|
|
63
|
+
node('div', item.get())
|
|
64
|
+
})
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
assertBody(`div{"1"} div{"3"}`)
|
|
68
|
+
assertEqual([cnt1, cnt2], [1,2])
|
|
69
|
+
|
|
70
|
+
store.set(1, 2)
|
|
71
|
+
passTime()
|
|
72
|
+
assertBody(`div{"1"} div{"2"} div{"3"}`)
|
|
73
|
+
assertEqual([cnt1, cnt2], [1,3])
|
|
74
|
+
|
|
75
|
+
// Merging just replace the entire array
|
|
76
|
+
store.merge([1,"two"])
|
|
77
|
+
passTime()
|
|
78
|
+
assertBody(`div{"1"} div{"two"}`)
|
|
79
|
+
assertEqual([cnt1, cnt2], [1,4])
|
|
80
|
+
|
|
81
|
+
store.set(9,'ten')
|
|
82
|
+
passTime()
|
|
83
|
+
assertBody(`div{"1"} div{"two"} div{"ten"}`)
|
|
84
|
+
assertEqual([cnt1, cnt2], [1,5])
|
|
85
|
+
|
|
86
|
+
store.set(4, 'five')
|
|
87
|
+
passTime()
|
|
88
|
+
assertBody(`div{"1"} div{"two"} div{"five"} div{"ten"}`)
|
|
89
|
+
assertEqual([cnt1, cnt2], [1,6])
|
|
90
|
+
|
|
91
|
+
store.delete(1)
|
|
92
|
+
passTime()
|
|
93
|
+
assertBody(`div{"1"} div{"five"} div{"ten"}`)
|
|
94
|
+
assertEqual([cnt1, cnt2], [1,6])
|
|
95
|
+
|
|
96
|
+
store.delete(9)
|
|
97
|
+
store.push("six")
|
|
98
|
+
assertEqual(store.get(5), "six")
|
|
99
|
+
passTime()
|
|
100
|
+
assertBody(`div{"1"} div{"five"} div{"six"}`)
|
|
101
|
+
assertEqual([cnt1, cnt2], [1,7])
|
|
102
|
+
|
|
103
|
+
store.set([1, undefined, 3])
|
|
104
|
+
passTime()
|
|
105
|
+
assertBody(`div{"1"} div{"3"}`)
|
|
106
|
+
assertEqual([cnt1, cnt2], [1,8])
|
|
107
|
+
|
|
108
|
+
})
|
|
109
|
+
})
|
package/tests/binding.js
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
describe('Value binding', function() {
|
|
2
|
+
it('binds input values', () => {
|
|
3
|
+
let store = new Store('test')
|
|
4
|
+
let inputElement;
|
|
5
|
+
mount(document.body, () => {
|
|
6
|
+
node('input', store, () => {
|
|
7
|
+
inputElement = getParentElement()
|
|
8
|
+
prop('class', {correct: store.get().length >= 5})
|
|
9
|
+
})
|
|
10
|
+
})
|
|
11
|
+
assertBody(`input{value="test"}`)
|
|
12
|
+
|
|
13
|
+
inputElement.value = "testx"
|
|
14
|
+
inputElement.event("input")
|
|
15
|
+
passTime()
|
|
16
|
+
|
|
17
|
+
assertBody(`input{@class="correct" value="testx"}`)
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
it('binds checkboxes', () => {
|
|
21
|
+
let store = new Store(true)
|
|
22
|
+
let inputElement;
|
|
23
|
+
mount(document.body, () => {
|
|
24
|
+
node('input', {type: 'checkbox'}, store, () => {
|
|
25
|
+
inputElement = getParentElement()
|
|
26
|
+
})
|
|
27
|
+
})
|
|
28
|
+
assertBody(`input{@type="checkbox" checked=true}`)
|
|
29
|
+
|
|
30
|
+
inputElement.checked = false
|
|
31
|
+
inputElement.event("input")
|
|
32
|
+
passTime()
|
|
33
|
+
|
|
34
|
+
assertBody(`input{@type="checkbox" checked=false}`)
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
it('binds radio buttons', () => {
|
|
38
|
+
let store = new Store('woman')
|
|
39
|
+
let inputElement1, inputElement2;
|
|
40
|
+
mount(document.body, () => {
|
|
41
|
+
node('input', {type: 'radio', name: 'gender', value: 'man'}, store, () => {
|
|
42
|
+
inputElement1 = getParentElement()
|
|
43
|
+
})
|
|
44
|
+
node('input', {type: 'radio', name: 'gender', value: 'woman'}, store, () => {
|
|
45
|
+
inputElement2 = getParentElement()
|
|
46
|
+
})
|
|
47
|
+
})
|
|
48
|
+
assertBody(`input{@name="gender" @type="radio" checked=false value="man"} input{@name="gender" @type="radio" checked=true value="woman"}`)
|
|
49
|
+
|
|
50
|
+
inputElement1.checked = true
|
|
51
|
+
inputElement1.event("input")
|
|
52
|
+
inputElement2.checked = false
|
|
53
|
+
inputElement2.event("input")
|
|
54
|
+
passTime()
|
|
55
|
+
|
|
56
|
+
assertEqual(store.get(), 'man')
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
it('reads initial value when Store is undefined', () => {
|
|
60
|
+
let store = new Store({})
|
|
61
|
+
mount(document.body, () => {
|
|
62
|
+
node('input', {value: 'a'}, store.ref('input'))
|
|
63
|
+
node('input', {type: 'checkbox', checked: true}, store.ref('checkbox'))
|
|
64
|
+
node('input', {type: 'radio', name: 'abc', value: 'x', checked: false}, store.ref('radio'))
|
|
65
|
+
node('input', {type: 'radio', name: 'abc', value: 'y', checked: true}, store.ref('radio'))
|
|
66
|
+
node('input', {type: 'radio', name: 'abc', value: 'z', checked: false}, store.ref('radio'))
|
|
67
|
+
})
|
|
68
|
+
assertEqual(store.get(), {input: 'a', checkbox: true, radio: 'y'})
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
it('changes DOM when Store value is updated', () => {
|
|
72
|
+
let store = new Store("test")
|
|
73
|
+
let toggle = new Store(true)
|
|
74
|
+
mount(document.body, () => {
|
|
75
|
+
node('input', store)
|
|
76
|
+
node('input', {type: 'checkbox'}, toggle)
|
|
77
|
+
})
|
|
78
|
+
assertBody(`input{value="test"} input{@type="checkbox" checked=true}`)
|
|
79
|
+
|
|
80
|
+
store.set("changed")
|
|
81
|
+
toggle.set(false)
|
|
82
|
+
passTime()
|
|
83
|
+
assertBody(`input{value="changed"} input{@type="checkbox" checked=false}`)
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
it('returns numbers for number/range typed inputs', () => {
|
|
87
|
+
let store = new Store("")
|
|
88
|
+
let inputElement;
|
|
89
|
+
mount(document.body, () => {
|
|
90
|
+
node('input', {type: 'number'}, store, () => {
|
|
91
|
+
inputElement = getParentElement()
|
|
92
|
+
})
|
|
93
|
+
})
|
|
94
|
+
assertBody(`input{@type="number" value=""}`)
|
|
95
|
+
|
|
96
|
+
inputElement.value = "123"
|
|
97
|
+
inputElement.event("input")
|
|
98
|
+
passTime()
|
|
99
|
+
assertEqual(store.get(), 123)
|
|
100
|
+
|
|
101
|
+
inputElement.value = ""
|
|
102
|
+
inputElement.event("input")
|
|
103
|
+
passTime()
|
|
104
|
+
assertEqual(store.get(), null)
|
|
105
|
+
})
|
|
106
|
+
})
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
describe('Browsers', () => {
|
|
2
|
+
it('works without Array.from', () => {
|
|
3
|
+
let oldFrom = Array.from
|
|
4
|
+
Array.from = undefined
|
|
5
|
+
|
|
6
|
+
let store = new Store(false)
|
|
7
|
+
let cnt = 0
|
|
8
|
+
mount(document.body, () => {
|
|
9
|
+
cnt++
|
|
10
|
+
if (store.get()) node('a')
|
|
11
|
+
})
|
|
12
|
+
assertBody(``)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
store.set(true)
|
|
16
|
+
passTime()
|
|
17
|
+
assertBody(`a{}`)
|
|
18
|
+
assertEqual(cnt, 2)
|
|
19
|
+
|
|
20
|
+
Array.from = oldFrom
|
|
21
|
+
})
|
|
22
|
+
})
|
package/tests/clean.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
describe('Clean', function() {
|
|
2
|
+
it('triggers once when redrawing', () => {
|
|
3
|
+
|
|
4
|
+
let cnt1 = 0, cnt2 = 0
|
|
5
|
+
let store = new Store(1)
|
|
6
|
+
mount(document.body, () => {
|
|
7
|
+
cnt1++
|
|
8
|
+
text(store.get())
|
|
9
|
+
clean(() => {
|
|
10
|
+
cnt2++
|
|
11
|
+
})
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
passTime()
|
|
15
|
+
assertBody(`"1"`)
|
|
16
|
+
assertEqual([cnt1, cnt2], [1, 0])
|
|
17
|
+
|
|
18
|
+
store.set(2)
|
|
19
|
+
passTime()
|
|
20
|
+
assertBody(`"2"`)
|
|
21
|
+
assertEqual([cnt1, cnt2], [2, 1])
|
|
22
|
+
|
|
23
|
+
unmount()
|
|
24
|
+
assertEqual([cnt1, cnt2], [2, 2])
|
|
25
|
+
})
|
|
26
|
+
})
|
package/tests/count.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
describe('Count', () => {
|
|
2
|
+
it('reactively counts object keys', () => {
|
|
3
|
+
let store = new Store()
|
|
4
|
+
let cnt = 0
|
|
5
|
+
mount(document.body, () => {
|
|
6
|
+
text(store.count())
|
|
7
|
+
cnt++
|
|
8
|
+
})
|
|
9
|
+
passTime()
|
|
10
|
+
assertBody(`"0"`)
|
|
11
|
+
assertEqual(cnt, 1)
|
|
12
|
+
|
|
13
|
+
store.set('a', 1)
|
|
14
|
+
passTime()
|
|
15
|
+
assertBody(`"1"`)
|
|
16
|
+
assertEqual(cnt, 2)
|
|
17
|
+
|
|
18
|
+
store.set('a', 2)
|
|
19
|
+
passTime()
|
|
20
|
+
assertBody(`"1"`)
|
|
21
|
+
assertEqual(cnt, 2)
|
|
22
|
+
|
|
23
|
+
store.set('b', 1)
|
|
24
|
+
passTime()
|
|
25
|
+
assertBody(`"2"`)
|
|
26
|
+
assertEqual(cnt, 3)
|
|
27
|
+
|
|
28
|
+
store.delete('a')
|
|
29
|
+
passTime()
|
|
30
|
+
assertBody(`"1"`)
|
|
31
|
+
assertEqual(cnt, 4)
|
|
32
|
+
|
|
33
|
+
store.delete('b')
|
|
34
|
+
passTime()
|
|
35
|
+
assertBody(`"0"`)
|
|
36
|
+
assertEqual(cnt, 5)
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
it('counts non-reflectively', () => {
|
|
40
|
+
let cases = [
|
|
41
|
+
{data: [], count: 0},
|
|
42
|
+
{data: [1,2], count: 2},
|
|
43
|
+
{data: {}, count: 0},
|
|
44
|
+
{data: {a:1, b:2}, count: 2},
|
|
45
|
+
{data: objToMap({}), count: 0},
|
|
46
|
+
{data: objToMap({a:1, b:2}), count: 2},
|
|
47
|
+
]
|
|
48
|
+
for(let c of cases) {
|
|
49
|
+
let store = new Store(c.data)
|
|
50
|
+
assertEqual(store.count(), c.count)
|
|
51
|
+
assertEqual(store.isEmpty(), c.count==0)
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
it('throws when counting uncountable things', () => {
|
|
56
|
+
let store = new Store({a: 3})
|
|
57
|
+
assertThrow(() => {
|
|
58
|
+
store.count('a')
|
|
59
|
+
})
|
|
60
|
+
assertThrow(() => {
|
|
61
|
+
store.isEmpty('a')
|
|
62
|
+
})
|
|
63
|
+
assertEqual(store.count('b'), 0)
|
|
64
|
+
assertEqual(store.count('b', 'c', 'd'), 0)
|
|
65
|
+
assertEqual(store.isEmpty('b'), true)
|
|
66
|
+
assertEqual(store.isEmpty('b', 'c', 'd'), true)
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
it('reactively handles isEmpty', () => {
|
|
70
|
+
let store = new Store()
|
|
71
|
+
let cnt = 0
|
|
72
|
+
mount(document.body, () => {
|
|
73
|
+
text(store.isEmpty())
|
|
74
|
+
cnt++
|
|
75
|
+
})
|
|
76
|
+
passTime()
|
|
77
|
+
assertBody(`"true"`)
|
|
78
|
+
assertEqual(cnt, 1)
|
|
79
|
+
|
|
80
|
+
store.set('a', 1)
|
|
81
|
+
passTime()
|
|
82
|
+
assertBody(`"false"`)
|
|
83
|
+
assertEqual(cnt, 2)
|
|
84
|
+
|
|
85
|
+
store.set('a', 2)
|
|
86
|
+
passTime()
|
|
87
|
+
assertBody(`"false"`)
|
|
88
|
+
assertEqual(cnt, 2)
|
|
89
|
+
|
|
90
|
+
store.set('b', 1)
|
|
91
|
+
passTime()
|
|
92
|
+
assertBody(`"false"`)
|
|
93
|
+
assertEqual(cnt, 2)
|
|
94
|
+
|
|
95
|
+
store.delete('a')
|
|
96
|
+
passTime()
|
|
97
|
+
assertBody(`"false"`)
|
|
98
|
+
assertEqual(cnt, 2)
|
|
99
|
+
|
|
100
|
+
store.delete('b')
|
|
101
|
+
passTime()
|
|
102
|
+
assertBody(`"true"`)
|
|
103
|
+
assertEqual(cnt, 3)
|
|
104
|
+
})
|
|
105
|
+
})
|
package/tests/create.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
describe('Create event', function() {
|
|
2
|
+
|
|
3
|
+
it('does not apply on initial rendering', () => {
|
|
4
|
+
let store = new Store(true)
|
|
5
|
+
mount(document.body, () => {
|
|
6
|
+
node('b', {create: 'y'})
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
assertBody(`b{}`)
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('works at top-level', () => {
|
|
13
|
+
let store = new Store(false)
|
|
14
|
+
mount(document.body, () => {
|
|
15
|
+
if (store.get()) node('b', {create: 'y'})
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
assertBody(``)
|
|
19
|
+
|
|
20
|
+
store.set(true)
|
|
21
|
+
// We'll do this in a setTimeout 0, so that the assert can be done before the temporary class is removed in a later setTimeout 0.
|
|
22
|
+
setTimeout(() => assertBody(`b{@class="y"}`), 0)
|
|
23
|
+
passTime(0)
|
|
24
|
+
assertBody(`b{}`)
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('does not apply when it is part of a larger whole newly rendered', () => {
|
|
28
|
+
let store = new Store(false)
|
|
29
|
+
mount(document.body, () => {
|
|
30
|
+
if (store.get()) node('b', () => node('c', {create: 'y'}))
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
assertBody(``)
|
|
34
|
+
|
|
35
|
+
store.set(true)
|
|
36
|
+
// We do the assert in a setTimeout 0, so it's performed before the temporary class is removed in a later setTimeout 0.
|
|
37
|
+
setTimeout(() => assertBody(`b{c{}}`), 0)
|
|
38
|
+
passTime(0)
|
|
39
|
+
assertBody(`b{c{}}`)
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('works in an onEach', () => {
|
|
43
|
+
let store = new Store([])
|
|
44
|
+
mount(document.body, () => {
|
|
45
|
+
store.onEach(item => {
|
|
46
|
+
node(item.get(), {create: "y"})
|
|
47
|
+
})
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
store.set(['a', undefined, 'c'])
|
|
51
|
+
// We do the assert in a setTimeout 0, so it's performed before the temporary class is removed in a later setTimeout 0.
|
|
52
|
+
setTimeout(() => assertBody(`a{@class="y"} c{@class="y"}`), 0)
|
|
53
|
+
passTime(0)
|
|
54
|
+
assertBody(`a{} c{}`)
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('performs a grow animation', () => {
|
|
58
|
+
let store = new Store(false)
|
|
59
|
+
mount(document.body, () => {
|
|
60
|
+
node('div', {style: {display: 'flex'}}, () => {
|
|
61
|
+
if (store.get()) node('a', {create: grow})
|
|
62
|
+
})
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
assertBody(`div{:display="flex"}`)
|
|
66
|
+
|
|
67
|
+
store.set(true)
|
|
68
|
+
passTime(0)
|
|
69
|
+
assert(getBody().startsWith('div{:display="flex" a{'))
|
|
70
|
+
assert(getBody().indexOf('transition')>=0)
|
|
71
|
+
|
|
72
|
+
passTime(2000)
|
|
73
|
+
assertBody(`div{:display="flex" a{}}`)
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
it('aborts a grow animation', () => {
|
|
77
|
+
let store = new Store(false)
|
|
78
|
+
mount(document.body, () => {
|
|
79
|
+
if (store.get()) {
|
|
80
|
+
node('a', {create: grow})
|
|
81
|
+
store.set(false)
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
assertBody(``)
|
|
86
|
+
|
|
87
|
+
store.set(true) // Naughty render function will set this back to false
|
|
88
|
+
|
|
89
|
+
passTime()
|
|
90
|
+
assertBody(``)
|
|
91
|
+
})
|
|
92
|
+
})
|