@@ -52,23 +52,23 @@ describe("The nickname autocomplete feature", function () {
5252
5353 const first_child = view . querySelector ( '.suggestion-box__results li:first-child' ) ;
5454 const first_child_avatar = first_child . querySelector ( 'converse-avatar' ) ;
55- expect ( first_child_avatar . textContent ) . toBe ( 'D' ) ;
56- expect ( first_child . textContent ) . toBe ( 'D dick' ) ;
55+ expect ( first_child_avatar . textContent . trim ( ) ) . toBe ( 'D' ) ;
56+ expect ( first_child . textContent . trim ( ) ) . toBe ( 'D dick' ) ;
5757
5858 const second_child = view . querySelector ( '.suggestion-box__results li:nth-child(2)' ) ;
5959 const second_child_avatar = second_child . querySelector ( 'converse-avatar' ) ;
60- expect ( second_child_avatar . textContent ) . toBe ( 'H' ) ;
61- expect ( second_child . textContent ) . toBe ( 'H harry' ) ;
60+ expect ( second_child_avatar . textContent . trim ( ) ) . toBe ( 'H' ) ;
61+ expect ( second_child . textContent . trim ( ) ) . toBe ( 'H harry' ) ;
6262
6363 const third_child = view . querySelector ( '.suggestion-box__results li:nth-child(3)' ) ;
6464 const third_child_avatar = third_child . querySelector ( 'converse-avatar' ) ;
65- expect ( third_child_avatar . textContent ) . toBe ( 'J' ) ;
66- expect ( third_child . textContent ) . toBe ( 'J jane' ) ;
65+ expect ( third_child_avatar . textContent . trim ( ) ) . toBe ( 'J' ) ;
66+ expect ( third_child . textContent . trim ( ) ) . toBe ( 'J jane' ) ;
6767
6868 const fourth_child = view . querySelector ( '.suggestion-box__results li:nth-child(4)' ) ;
6969 const fourth_child_avatar = fourth_child . querySelector ( 'converse-avatar' ) ;
70- expect ( fourth_child_avatar . textContent ) . toBe ( 'T' ) ;
71- expect ( fourth_child . textContent ) . toBe ( 'T tom' ) ;
70+ expect ( fourth_child_avatar . textContent . trim ( ) ) . toBe ( 'T' ) ;
71+ expect ( fourth_child . textContent . trim ( ) ) . toBe ( 'T tom' ) ;
7272 } ) ) ;
7373
7474 it ( "shows all autocompletion options when the user presses @ right after a new line" ,
@@ -120,23 +120,23 @@ describe("The nickname autocomplete feature", function () {
120120 await u . waitUntil ( ( ) => view . querySelectorAll ( '.suggestion-box__results li' ) . length === 4 ) ;
121121 const first_child = view . querySelector ( '.suggestion-box__results li:first-child' ) ;
122122 const first_child_avatar = first_child . querySelector ( 'converse-avatar' ) ;
123- expect ( first_child_avatar . textContent ) . toBe ( 'D' ) ;
124- expect ( first_child . textContent ) . toBe ( 'D dick' ) ;
123+ expect ( first_child_avatar . textContent . trim ( ) ) . toBe ( 'D' ) ;
124+ expect ( first_child . textContent . trim ( ) ) . toBe ( 'D dick' ) ;
125125
126126 const second_child = view . querySelector ( '.suggestion-box__results li:nth-child(2)' ) ;
127127 const second_child_avatar = second_child . querySelector ( 'converse-avatar' ) ;
128- expect ( second_child_avatar . textContent ) . toBe ( 'H' ) ;
129- expect ( second_child . textContent ) . toBe ( 'H harry' ) ;
128+ expect ( second_child_avatar . textContent . trim ( ) ) . toBe ( 'H' ) ;
129+ expect ( second_child . textContent . trim ( ) ) . toBe ( 'H harry' ) ;
130130
131131 const third_child = view . querySelector ( '.suggestion-box__results li:nth-child(3)' ) ;
132132 const third_child_avatar = third_child . querySelector ( 'converse-avatar' ) ;
133- expect ( third_child_avatar . textContent ) . toBe ( 'J' ) ;
134- expect ( third_child . textContent ) . toBe ( 'J jane' ) ;
133+ expect ( third_child_avatar . textContent . trim ( ) ) . toBe ( 'J' ) ;
134+ expect ( third_child . textContent . trim ( ) ) . toBe ( 'J jane' ) ;
135135
136136 const fourth_child = view . querySelector ( '.suggestion-box__results li:nth-child(4)' ) ;
137137 const fourth_child_avatar = fourth_child . querySelector ( 'converse-avatar' ) ;
138- expect ( fourth_child_avatar . textContent ) . toBe ( 'T' ) ;
139- expect ( fourth_child . textContent ) . toBe ( 'T tom' ) ;
138+ expect ( fourth_child_avatar . textContent . trim ( ) ) . toBe ( 'T' ) ;
139+ expect ( fourth_child . textContent . trim ( ) ) . toBe ( 'T tom' ) ;
140140 } ) ) ;
141141
142142 it ( "shows all autocompletion options when the user presses @ right after an allowed character" ,
@@ -190,23 +190,23 @@ describe("The nickname autocomplete feature", function () {
190190 await u . waitUntil ( ( ) => view . querySelectorAll ( '.suggestion-box__results li' ) . length === 4 ) ;
191191 const first_child = view . querySelector ( '.suggestion-box__results li:first-child' ) ;
192192 const first_child_avatar = first_child . querySelector ( 'converse-avatar' ) ;
193- expect ( first_child_avatar . textContent ) . toBe ( 'D' ) ;
194- expect ( first_child . textContent ) . toBe ( 'D dick' ) ;
193+ expect ( first_child_avatar . textContent . trim ( ) ) . toBe ( 'D' ) ;
194+ expect ( first_child . textContent . trim ( ) ) . toBe ( 'D dick' ) ;
195195
196196 const second_child = view . querySelector ( '.suggestion-box__results li:nth-child(2)' ) ;
197197 const second_child_avatar = second_child . querySelector ( 'converse-avatar' ) ;
198- expect ( second_child_avatar . textContent ) . toBe ( 'H' ) ;
199- expect ( second_child . textContent ) . toBe ( 'H harry' ) ;
198+ expect ( second_child_avatar . textContent . trim ( ) ) . toBe ( 'H' ) ;
199+ expect ( second_child . textContent . trim ( ) ) . toBe ( 'H harry' ) ;
200200
201201 const third_child = view . querySelector ( '.suggestion-box__results li:nth-child(3)' ) ;
202202 const third_child_avatar = third_child . querySelector ( 'converse-avatar' ) ;
203- expect ( third_child_avatar . textContent ) . toBe ( 'J' ) ;
204- expect ( third_child . textContent ) . toBe ( 'J jane' ) ;
203+ expect ( third_child_avatar . textContent . trim ( ) ) . toBe ( 'J' ) ;
204+ expect ( third_child . textContent . trim ( ) ) . toBe ( 'J jane' ) ;
205205
206206 const fourth_child = view . querySelector ( '.suggestion-box__results li:nth-child(4)' ) ;
207207 const fourth_child_avatar = fourth_child . querySelector ( 'converse-avatar' ) ;
208- expect ( fourth_child_avatar . textContent ) . toBe ( 'T' ) ;
209- expect ( fourth_child . textContent ) . toBe ( 'T tom' ) ;
208+ expect ( fourth_child_avatar . textContent . trim ( ) ) . toBe ( 'T' ) ;
209+ expect ( fourth_child . textContent . trim ( ) ) . toBe ( 'T tom' ) ;
210210 } ) ) ;
211211
212212 it ( "should order by query index position and length" , mock . initConverse (
0 commit comments