@@ -506,3 +506,61 @@ asyncTest "update ignores items that look like Task List items but are links", -
506506 , 20
507507
508508 item2Checkbox .click ()
509+
510+ asyncTest " updates items followed by links" , ->
511+ expect 3
512+
513+ $ (' #qunit-fixture' ).empty ()
514+
515+ container = $ ' <div>' , class : ' js-task-list-container'
516+
517+ list = $ ' <ul>' , class : ' task-list'
518+
519+ item1 = $ ' <li>' , class : ' task-list-item'
520+ item1Checkbox = $ ' <input>' ,
521+ type : ' checkbox'
522+ class : ' task-list-item-checkbox'
523+ disabled : true
524+ checked : false
525+
526+ item2 = $ ' <li>' , class : ' task-list-item'
527+ item2Checkbox = $ ' <input>' ,
528+ type : ' checkbox'
529+ class : ' task-list-item-checkbox'
530+ disabled : true
531+ checked : false
532+
533+ field = $ ' <textarea>' , class : ' js-task-list-field' , text : """
534+ - [ ] [link label](link)
535+ - [ ] [reference label][reference]
536+ """
537+
538+ changes = """
539+ - [ ] [link label](link)
540+ - [x] [reference label][reference]
541+ """
542+
543+ item1 .append item1Checkbox
544+ list .append item1
545+ item1 .expectedIndex = 1
546+
547+ item2 .append item2Checkbox
548+ list .append item2
549+ item2 .expectedIndex = 2
550+
551+ container .append list
552+ container .append field
553+
554+ $ (' #qunit-fixture' ).append (container)
555+ container .taskList ()
556+
557+ field .on ' tasklist:changed' , (event , index , checked ) =>
558+ ok checked
559+ equal index, item2 .expectedIndex
560+ equal field .val (), changes
561+
562+ setTimeout ->
563+ start ()
564+ , 20
565+
566+ item2Checkbox .click ()
0 commit comments