File tree 1 file changed +34
-0
lines changed
1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,22 @@ describe('task-lists element', function () {
57
57
</ul>
58
58
</li>
59
59
</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>
60
76
</task-lists>`
61
77
document . body . append ( container )
62
78
} )
@@ -100,5 +116,23 @@ describe('task-lists element', function () {
100
116
101
117
assert ( called )
102
118
} )
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
+ } )
103
137
} )
104
138
} )
You can’t perform that action at this time.
0 commit comments