@@ -379,3 +379,64 @@ asyncTest "updates the source of an ordered list item, marking the complete item
379379
380380 @orderedCompleteCheckbox .click ()
381381
382+ asyncTest " update ignores items that look like Task List items but lack list prefix" , ->
383+ expect 3
384+
385+ $ (' #qunit-fixture' ).empty ()
386+
387+ container = $ ' <div>' , class : ' js-task-list-container'
388+
389+ list = $ ' <ul>' , class : ' task-list'
390+
391+ item1 = $ ' <li>' , class : ' task-list-item'
392+ item1Checkbox = $ ' <input>' ,
393+ type : ' checkbox'
394+ class : ' task-list-item-checkbox'
395+ disabled : true
396+ checked : false
397+
398+ item2 = $ ' <li>' , class : ' task-list-item'
399+ item2Checkbox = $ ' <input>' ,
400+ type : ' checkbox'
401+ class : ' task-list-item-checkbox'
402+ disabled : true
403+ checked : false
404+
405+ field = $ ' <textarea>' , class : ' js-task-list-field' , text : """
406+ [ ] one
407+ [ ] two
408+ - [ ] three
409+ - [ ] four
410+ """
411+
412+ changes = """
413+ [ ] one
414+ [ ] two
415+ - [ ] three
416+ - [x] four
417+ """
418+
419+ item1 .append item1Checkbox
420+ list .append item1
421+ item1 .expectedIndex = 1
422+
423+ item2 .append item2Checkbox
424+ list .append item2
425+ item2 .expectedIndex = 2
426+
427+ container .append list
428+ container .append field
429+
430+ $ (' #qunit-fixture' ).append (container)
431+ container .taskList ()
432+
433+ field .on ' tasklist:changed' , (event , index , checked ) =>
434+ ok checked
435+ equal index, item2 .expectedIndex
436+ equal field .val (), changes
437+
438+ setTimeout ->
439+ start ()
440+ , 20
441+
442+ item2Checkbox .click ()
0 commit comments