2 QUnit
.module( 'jquery.highlightText', QUnit
.newMwEnvironment() );
4 QUnit
.test( 'Check', function ( assert
) {
9 text
: 'Blue Öyster Cult',
11 expected
: '<span class="highlight">Blue</span> Öyster Cult'
15 text
: 'Blue Öyster Cult',
17 expected
: '<span class="highlight">Blue</span> Öyster Cult'
21 text
: 'Blue Öyster Cult',
23 expected
: '<span class="highlight">Blue</span> <span class="highlight">Ö</span>yster Cult'
27 text
: 'Blue Öyster Cult',
29 expected
: '<span class="highlight">Blue</span> <span class="highlight">Öy</span>ster Cult'
33 text
: 'Blue Öyster Cult',
35 expected
: '<span class="highlight">Blue</span> Öyster Cult'
39 text
: 'Blue Öyster Cult',
41 expected
: '<span class="highlight">Blue</span> Öyster Cult'
45 text
: 'Blue Öyster Cult',
47 expected
: '<span class="highlight">Blue</span> <span class="highlight">Ö</span>yster Cult'
51 text
: 'Blue Öyster Cult',
52 highlight
: ' Blue Öy',
53 expected
: '<span class="highlight">Blue</span> <span class="highlight">Öy</span>ster Cult'
56 desc
: 'Test 009: Highlighter broken on starting Umlaut?',
58 highlight
: 'Österreich',
59 expected
: '<span class="highlight">Österreich</span>'
62 desc
: 'Test 010: Highlighter broken on starting Umlaut?',
65 expected
: '<span class="highlight">Ö</span>sterreich'
68 desc
: 'Test 011: Highlighter broken on starting Umlaut?',
71 expected
: '<span class="highlight">Öst</span>erreich'
74 desc
: 'Test 012: Highlighter broken on starting Umlaut?',
77 expected
: 'Österreich'
80 desc
: 'Test 013: Highlighter broken on punctuation mark?',
81 text
: 'So good. To be there',
83 expected
: 'So <span class="highlight">good</span>. To be there'
86 desc
: 'Test 014: Highlighter broken on space?',
87 text
: 'So good. To be there',
89 expected
: 'So good. To <span class="highlight">be</span> there'
92 desc
: 'Test 015: Highlighter broken on space?',
93 text
: 'So good. To be there',
95 expected
: 'So good. To <span class="highlight">be</span> there'
98 desc
: 'Test 016: Highlighter broken on space?',
99 text
: 'So good. To be there',
101 expected
: 'So good. To <span class="highlight">be</span> there'
104 desc
: 'Test 017: Highlighter broken on space?',
105 text
: 'So good. To be there',
107 expected
: 'So good. To <span class="highlight">be</span> there'
110 desc
: 'Test 018: en de Highlighter broken on special character at the end?',
111 text
: 'So good. xbß',
113 expected
: 'So good. <span class="highlight">xbß</span>'
116 desc
: 'Test 019: en de Highlighter broken on special character at the end?',
117 text
: 'So good. xbß.',
119 expected
: 'So good. <span class="highlight">xbß.</span>'
122 desc
: 'Test 020: RTL he Hebrew',
123 text
: 'חסיד אומות העולם',
124 highlight
: 'חסיד אומות העולם',
125 expected
: '<span class="highlight">חסיד</span> <span class="highlight">אומות</span> <span class="highlight">העולם</span>'
128 desc
: 'Test 021: RTL he Hebrew',
129 text
: 'חסיד אומות העולם',
131 expected
: '<span class="highlight">חסי</span>ד אומות העולם'
134 desc
: 'Test 022: ja Japanese',
136 highlight
: '諸国民の中の正義の人',
137 expected
: '<span class="highlight">諸国民の中の正義の人</span>'
140 desc
: 'Test 023: ja Japanese',
143 expected
: '<span class="highlight">諸国</span>民の中の正義の人'
146 desc
: 'Test 024: fr French text and « french quotes » (guillemets)',
147 text
: '« L\'oiseau est sur l’île »',
148 highlight
: '« L\'oiseau est sur l’île »',
149 expected
: '<span class="highlight">«</span> <span class="highlight">L\'oiseau</span> <span class="highlight">est</span> <span class="highlight">sur</span> <span class="highlight">l’île</span> <span class="highlight">»</span>'
152 desc
: 'Test 025: fr French text and « french quotes » (guillemets)',
153 text
: '« L\'oiseau est sur l’île »',
154 highlight
: '« L\'oise',
155 expected
: '<span class="highlight">«</span> <span class="highlight">L\'oise</span>au est sur l’île »'
158 desc
: 'Test 025a: fr French text and « french quotes » (guillemets) - does it match the single strings "«" and "L" separately?',
159 text
: '« L\'oiseau est sur l’île »',
161 expected
: '<span class="highlight">«</span> <span class="highlight">L</span>\'oiseau est sur <span class="highlight">l</span>’île »'
164 desc
: 'Test 026: ru Russian',
165 text
: 'Праведники мира',
166 highlight
: 'Праведники мира',
167 expected
: '<span class="highlight">Праведники</span> <span class="highlight">мира</span>'
170 desc
: 'Test 027: ru Russian',
171 text
: 'Праведники мира',
173 expected
: '<span class="highlight">Праве</span>дники мира'
176 desc
: 'Test 028 ka Georgian',
177 text
: 'მთავარი გვერდი',
178 highlight
: 'მთავარი გვერდი',
179 expected
: '<span class="highlight">მთავარი</span> <span class="highlight">გვერდი</span>'
182 desc
: 'Test 029 ka Georgian',
183 text
: 'მთავარი გვერდი',
185 expected
: '<span class="highlight">მთა</span>ვარი გვერდი'
188 desc
: 'Test 030 hy Armenian',
189 text
: 'Նոնա Գափրինդաշվիլի',
190 highlight
: 'Նոնա Գափրինդաշվիլի',
191 expected
: '<span class="highlight">Նոնա</span> <span class="highlight">Գափրինդաշվիլի</span>'
194 desc
: 'Test 031 hy Armenian',
195 text
: 'Նոնա Գափրինդաշվիլի',
197 expected
: '<span class="highlight">Նոն</span>ա Գափրինդաշվիլի'
200 desc
: 'Test 032: th Thai',
202 highlight
: 'พอล แอร์ดิช',
203 expected
: '<span class="highlight">พอล</span> <span class="highlight">แอร์ดิช</span>'
206 desc
: 'Test 033: th Thai',
209 expected
: '<span class="highlight">พอ</span>ล แอร์ดิช'
212 desc
: 'Test 034: RTL ar Arabic',
214 highlight
: 'بول إيردوس',
215 expected
: '<span class="highlight">بول</span> <span class="highlight">إيردوس</span>'
218 desc
: 'Test 035: RTL ar Arabic',
221 expected
: '<span class="highlight">بو</span>ل إيردوس'
225 cases
.forEach( function ( item
) {
226 $fixture
= $( '<p>' ).text( item
.text
).highlightText( item
.highlight
);
229 // Re-parse to normalize
230 $( '<p>' ).html( item
.expected
).html(),
231 item
.desc
|| undefined