Skip to content

Commit 0011301

Browse files
committed
Add test for mixed task list position
1 parent e5610e4 commit 0011301

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

test/test.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,22 @@ describe('task-lists element', function () {
5757
</ul>
5858
</li>
5959
</ol>
60+
61+
<ul class="contains-task-list">
62+
<li class="task-list-item">
63+
<label>
64+
<input type="checkbox" class="task-list-item-checkbox">
65+
R2-D2
66+
</label>
67+
</li>
68+
<li>bam</li>
69+
<li class="task-list-item">
70+
<label>
71+
<input id="c3po" type="checkbox" class="task-list-item-checkbox">
72+
C-3PO
73+
</label>
74+
</li>
75+
</ul>
6076
</task-lists>`
6177
document.body.append(container)
6278
})
@@ -100,5 +116,23 @@ describe('task-lists element', function () {
100116

101117
assert(called)
102118
})
119+
120+
it('emits check event with the right position for mixed task list', function () {
121+
let called = false
122+
123+
const list = document.querySelector('task-lists')
124+
list.addEventListener('task-lists-check', function (event) {
125+
called = true
126+
const {position, checked} = event.detail
127+
assert.deepEqual(position, [5, 2])
128+
assert(checked)
129+
})
130+
131+
const checkbox = document.querySelector('#c3po')
132+
checkbox.checked = true
133+
checkbox.dispatchEvent(new CustomEvent('change', {bubbles: true}))
134+
135+
assert(called)
136+
})
103137
})
104138
})

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy