@@ -20,19 +20,36 @@ module "TaskList updates",
2020 disabled : true
2121 checked : false
2222
23+ # non-breaking space. See: https://github.com/github/task-lists/pull/14
24+ @nbsp = String .fromCharCode (160 )
25+ @incompleteNBSPItem = $ ' <li>' , class : ' task-list-item'
26+ @incompleteNBSPCheckbox = $ ' <input>' ,
27+ type : ' checkbox'
28+ class : ' task-list-item-checkbox'
29+ disabled : true
30+ checked : false
31+
2332 @field = $ ' <textarea>' , class : ' js-task-list-field' , text : """
2433 - [x] complete
2534 - [ ] incomplete
35+ - [#{ @nbsp } ] incompleteNBSP
2636 """
2737
2838 @changes =
2939 toComplete : """
3040 - [ ] complete
3141 - [ ] incomplete
42+ - [#{ @nbsp } ] incompleteNBSP
3243 """
3344 toIncomplete : """
3445 - [x] complete
3546 - [x] incomplete
47+ - [#{ @nbsp } ] incompleteNBSP
48+ """
49+ toIncompleteNBSP : """
50+ - [x] complete
51+ - [ ] incomplete
52+ - [x] incompleteNBSP
3653 """
3754
3855 @completeItem .append @completeCheckbox
@@ -43,6 +60,10 @@ module "TaskList updates",
4360 @list .append @incompleteItem
4461 @incompleteItem .expectedIndex = 2
4562
63+ @incompleteNBSPItem .append @incompleteNBSPCheckbox
64+ @list .append @incompleteNBSPItem
65+ @incompleteNBSPItem .expectedIndex = 3
66+
4667 @container .append @list
4768 @container .append @field
4869
@@ -79,3 +100,18 @@ asyncTest "updates the source, marking the complete item as incomplete", ->
79100 , 20
80101
81102 @completeCheckbox .click ()
103+
104+ # See: https://github.com/github/task-lists/pull/14
105+ asyncTest " updates the source for items with non-breaking spaces" , ->
106+ expect 3
107+
108+ @field .on ' tasklist:changed' , (event , index , checked ) =>
109+ ok checked
110+ equal index, @incompleteNBSPItem .expectedIndex
111+ equal @field .val (), @changes .toIncompleteNBSP
112+
113+ setTimeout ->
114+ start ()
115+ , 20
116+
117+ @incompleteNBSPCheckbox .click ()
0 commit comments