File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,15 @@ describe('task-lists element', function() {
34
34
<input id="wall-e" type="checkbox" class="task-list-item-checkbox"> WALL-E
35
35
</li>
36
36
</ul>
37
+ <ul>
38
+ <li>
39
+ <ul class="contains-task-list">
40
+ <li class="task-list-item">
41
+ <input id="baymax" type="checkbox" class="task-list-item-checkbox"> Baymax
42
+ </li>
43
+ </ul>
44
+ </li>
45
+ </ul>
37
46
</task-lists>`
38
47
document . body . append ( container )
39
48
} )
@@ -59,5 +68,23 @@ describe('task-lists element', function() {
59
68
60
69
assert ( called )
61
70
} )
71
+
72
+ it ( 'emits check event with the right position for nested task list item' , function ( ) {
73
+ let called = false
74
+
75
+ const list = document . querySelector ( 'task-lists' )
76
+ list . addEventListener ( 'task-lists:check' , function ( event ) {
77
+ called = true
78
+ const { position, checked} = event . detail
79
+ assert . deepEqual ( position , [ 3 , 0 ] )
80
+ assert ( checked )
81
+ } )
82
+
83
+ const checkbox = document . querySelector ( '#baymax' )
84
+ checkbox . checked = true
85
+ checkbox . dispatchEvent ( new CustomEvent ( 'change' , { bubbles : true } ) )
86
+
87
+ assert ( called )
88
+ } )
62
89
} )
63
90
} )
You can’t perform that action at this time.
0 commit comments