Make sure that SQLite uses no prefix
[lhc/web/wiklou.git] / tests / qunit / suites / resources / jquery / jquery.highlightText.test.js
1 QUnit.module( 'jquery.highlightText', QUnit.newMwEnvironment() );
2
3 QUnit.test( 'Check', function ( assert ) {
4 var $fixture, cases = [
5 {
6 desc: 'Test 001',
7 text: 'Blue Öyster Cult',
8 highlight: 'Blue',
9 expected: '<span class="highlight">Blue</span> Öyster Cult'
10 },
11 {
12 desc: 'Test 002',
13 text: 'Blue Öyster Cult',
14 highlight: 'Blue ',
15 expected: '<span class="highlight">Blue</span> Öyster Cult'
16 },
17 {
18 desc: 'Test 003',
19 text: 'Blue Öyster Cult',
20 highlight: 'Blue Ö',
21 expected: '<span class="highlight">Blue</span> <span class="highlight">Ö</span>yster Cult'
22 },
23 {
24 desc: 'Test 004',
25 text: 'Blue Öyster Cult',
26 highlight: 'Blue Öy',
27 expected: '<span class="highlight">Blue</span> <span class="highlight">Öy</span>ster Cult'
28 },
29 {
30 desc: 'Test 005',
31 text: 'Blue Öyster Cult',
32 highlight: ' Blue',
33 expected: '<span class="highlight">Blue</span> Öyster Cult'
34 },
35 {
36 desc: 'Test 006',
37 text: 'Blue Öyster Cult',
38 highlight: ' Blue ',
39 expected: '<span class="highlight">Blue</span> Öyster Cult'
40 },
41 {
42 desc: 'Test 007',
43 text: 'Blue Öyster Cult',
44 highlight: ' Blue Ö',
45 expected: '<span class="highlight">Blue</span> <span class="highlight">Ö</span>yster Cult'
46 },
47 {
48 desc: 'Test 008',
49 text: 'Blue Öyster Cult',
50 highlight: ' Blue Öy',
51 expected: '<span class="highlight">Blue</span> <span class="highlight">Öy</span>ster Cult'
52 },
53 {
54 desc: 'Test 009: Highlighter broken on starting Umlaut?',
55 text: 'Österreich',
56 highlight: 'Österreich',
57 expected: '<span class="highlight">Österreich</span>'
58 },
59 {
60 desc: 'Test 010: Highlighter broken on starting Umlaut?',
61 text: 'Österreich',
62 highlight: 'Ö',
63 expected: '<span class="highlight">Ö</span>sterreich'
64 },
65 {
66 desc: 'Test 011: Highlighter broken on starting Umlaut?',
67 text: 'Österreich',
68 highlight: 'Öst',
69 expected: '<span class="highlight">Öst</span>erreich'
70 },
71 {
72 desc: 'Test 012: Highlighter broken on starting Umlaut?',
73 text: 'Österreich',
74 highlight: 'Oe',
75 expected: 'Österreich'
76 },
77 {
78 desc: 'Test 013: Highlighter broken on punctuation mark?',
79 text: 'So good. To be there',
80 highlight: 'good',
81 expected: 'So <span class="highlight">good</span>. To be there'
82 },
83 {
84 desc: 'Test 014: Highlighter broken on space?',
85 text: 'So good. To be there',
86 highlight: 'be',
87 expected: 'So good. To <span class="highlight">be</span> there'
88 },
89 {
90 desc: 'Test 015: Highlighter broken on space?',
91 text: 'So good. To be there',
92 highlight: ' be',
93 expected: 'So good. To <span class="highlight">be</span> there'
94 },
95 {
96 desc: 'Test 016: Highlighter broken on space?',
97 text: 'So good. To be there',
98 highlight: 'be ',
99 expected: 'So good. To <span class="highlight">be</span> there'
100 },
101 {
102 desc: 'Test 017: Highlighter broken on space?',
103 text: 'So good. To be there',
104 highlight: ' be ',
105 expected: 'So good. To <span class="highlight">be</span> there'
106 },
107 {
108 desc: 'Test 018: en de Highlighter broken on special character at the end?',
109 text: 'So good. xbß',
110 highlight: 'xbß',
111 expected: 'So good. <span class="highlight">xbß</span>'
112 },
113 {
114 desc: 'Test 019: en de Highlighter broken on special character at the end?',
115 text: 'So good. xbß.',
116 highlight: 'xbß.',
117 expected: 'So good. <span class="highlight">xbß.</span>'
118 },
119 {
120 desc: 'Test 020: RTL he Hebrew',
121 text: 'חסיד אומות העולם',
122 highlight: 'חסיד אומות העולם',
123 expected: '<span class="highlight">חסיד</span> <span class="highlight">אומות</span> <span class="highlight">העולם</span>'
124 },
125 {
126 desc: 'Test 021: RTL he Hebrew',
127 text: 'חסיד אומות העולם',
128 highlight: 'חסי',
129 expected: '<span class="highlight">חסי</span>ד אומות העולם'
130 },
131 {
132 desc: 'Test 022: ja Japanese',
133 text: '諸国民の中の正義の人',
134 highlight: '諸国民の中の正義の人',
135 expected: '<span class="highlight">諸国民の中の正義の人</span>'
136 },
137 {
138 desc: 'Test 023: ja Japanese',
139 text: '諸国民の中の正義の人',
140 highlight: '諸国',
141 expected: '<span class="highlight">諸国</span>民の中の正義の人'
142 },
143 {
144 desc: 'Test 024: fr French text and « french quotes » (guillemets)',
145 text: "« L'oiseau est sur l’île »",
146 highlight: "« L'oiseau est sur l’île »",
147 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>'
148 },
149 {
150 desc: 'Test 025: fr French text and « french quotes » (guillemets)',
151 text: "« L'oiseau est sur l’île »",
152 highlight: "« L'oise",
153 expected: '<span class="highlight">«</span> <span class="highlight">L\'oise</span>au est sur l’île »'
154 },
155 {
156 desc: 'Test 025a: fr French text and « french quotes » (guillemets) - does it match the single strings "«" and "L" separately?',
157 text: "« L'oiseau est sur l’île »",
158 highlight: "« L",
159 expected: '<span class="highlight">«</span> <span class="highlight">L</span>\'oiseau est sur <span class="highlight">l</span>’île »'
160 },
161 {
162 desc: 'Test 026: ru Russian',
163 text: 'Праведники мира',
164 highlight: 'Праведники мира',
165 expected: '<span class="highlight">Праведники</span> <span class="highlight">мира</span>'
166 },
167 {
168 desc: 'Test 027: ru Russian',
169 text: 'Праведники мира',
170 highlight: 'Праве',
171 expected: '<span class="highlight">Праве</span>дники мира'
172 },
173 {
174 desc: 'Test 028 ka Georgian',
175 text: 'მთავარი გვერდი',
176 highlight: 'მთავარი გვერდი',
177 expected: '<span class="highlight">მთავარი</span> <span class="highlight">გვერდი</span>'
178 },
179 {
180 desc: 'Test 029 ka Georgian',
181 text: 'მთავარი გვერდი',
182 highlight: 'მთა',
183 expected: '<span class="highlight">მთა</span>ვარი გვერდი'
184 },
185 {
186 desc: 'Test 030 hy Armenian',
187 text: 'Նոնա Գափրինդաշվիլի',
188 highlight: 'Նոնա Գափրինդաշվիլի',
189 expected: '<span class="highlight">Նոնա</span> <span class="highlight">Գափրինդաշվիլի</span>'
190 },
191 {
192 desc: 'Test 031 hy Armenian',
193 text: 'Նոնա Գափրինդաշվիլի',
194 highlight: 'Նոն',
195 expected: '<span class="highlight">Նոն</span>ա Գափրինդաշվիլի'
196 },
197 {
198 desc: 'Test 032: th Thai',
199 text: 'พอล แอร์ดิช',
200 highlight: 'พอล แอร์ดิช',
201 expected: '<span class="highlight">พอล</span> <span class="highlight">แอร์ดิช</span>'
202 },
203 {
204 desc: 'Test 033: th Thai',
205 text: 'พอล แอร์ดิช',
206 highlight: 'พอ',
207 expected: '<span class="highlight">พอ</span>ล แอร์ดิช'
208 },
209 {
210 desc: 'Test 034: RTL ar Arabic',
211 text: 'بول إيردوس',
212 highlight: 'بول إيردوس',
213 expected: '<span class="highlight">بول</span> <span class="highlight">إيردوس</span>'
214 },
215 {
216 desc: 'Test 035: RTL ar Arabic',
217 text: 'بول إيردوس',
218 highlight: 'بو',
219 expected: '<span class="highlight">بو</span>ل إيردوس'
220 }
221 ];
222 QUnit.expect( cases.length );
223
224 $.each( cases, function ( i, item ) {
225 $fixture = $( '<p>' ).text( item.text ).highlightText( item.highlight );
226 assert.equal(
227 $fixture.html(),
228 $( '<p>' ).html( item.expected ).html(), // re-parse to normalize!
229 item.desc || undefined
230 );
231 } );
232 } );