blob: ef8506943942fe2de23b0c6101689e6ecb6a583c [file] [log] [blame]
hebasta75cfca52019-02-19 13:15:27 +01001/**
hebasta87f1b1f2019-07-30 13:03:23 +02002 * Test suite for guided tour
hebasta75cfca52019-02-19 13:15:27 +01003 *
4 * @author Helge Stallkamp
5 */
6
hebastafa118342021-11-02 19:56:01 +01007define(['tour/tours', 'vc', 'vc/unspecified', 'session', 'match', 'hint', 'hint/foundries/cnx', 'selectMenu', 'loc/dereko'], function(tourClass, vcClass, docClassUnspec, sessionClass, matchClass, hintClass, hintArray, selectMenuClass){
hebasta75cfca52019-02-19 13:15:27 +01008 const loc = KorAP.Locale;
hebastaf95226b2019-09-19 11:37:00 +02009
hebasta0c93d8e2019-05-15 12:06:16 +020010 var introKorAP =
11 "<form autocomplete='off' action='/' id='searchform'>" +
12 "<div id='searchbar' class=''>" +
13 "<input autocapitalize='off' autocomplete='off' autocorrect='off' autofocus='autofocus' id='q-field' name='q' placeholder='Finde ...' spellcheck='false' type='search'>" +
hebasta5df796f2019-05-21 15:27:12 +020014 "<button type='submit' id='qsubmit' title='Los!'><span>Los!</span></button>" +
hebasta0c93d8e2019-05-15 12:06:16 +020015 "</div>" +
Akroncd42a142019-07-12 18:55:37 +020016 "<!-- Search in the following virtual corpus -->"+
hebastafa118342021-11-02 19:56:01 +010017 "<div id='vc-view'>" +
18 "<div class='vc'>"+
19 "<div class='builder'>"+
20 "<div class='doc unspecified'><span>⋯</span></div>" +
21 "</div>" +
22 "<div class='action button-view button-group'><span title='Zuklappen' class='button-icon minimize'><span>Zuklappen</span></span></div>" +
23 "<div>" +
24 "<div class='panel vcinfo'>" +
25 "<div></div>" +
26 "<div class='action button-panel vcinfo button-group'><span title='Korpusstatistik' class='statistic'><span>Korpusstatistik</span></span></div>" +
27 "</div>" +
28 "</div>" +
29 "</div>" +
hebasta0c93d8e2019-05-15 12:06:16 +020030 "in" +
31 "<span id='vc-choose' class='select'><span>allen Korpora</span></span>" +
Akroncd42a142019-07-12 18:55:37 +020032 "<input id='cq' name='cq' type='text' style='display: none;'>" +
hebasta0c93d8e2019-05-15 12:06:16 +020033 "mit" +
34 "<span class='select'>" +
35 "<select id='ql-field' name='ql' style='display: none;'>" +
36 "<option value='poliqarp'>Poliqarp</option>" +
37 "<option value='cosmas2'>Cosmas II</option>" +
38 "<option value='annis'>Annis QL</option>" +
39 "<option value='cql'>CQL v1.2</option>" +
40 "<option value='fcsql'>FCSQL</option>" +
41 "</select>" +
42 "<span style='display: inline;'> Poliqarp</span>" +
43 "<ul style='outline: currentcolor none 0px;' tabindex='0' class='menu roll'>" +
44 "<span class='pref'></span>" +
45 "<div class='lengthField'>" +
46 "<span>Poliqarp--</span>" +
47 "<span>Cosmas II--</span>" +
48 "<span>Annis QL--</span>" +
49 "<span>CQL v1.2--</span>" +
50 "<span>FCSQL--</span>" +
51 "</div><div class='ruler' style='display: none;'><span></span><div></div>" +
52 "</div>" +
53 "</ul>" +
54 "</span>" +
55 "<div class='button right'>" +
56 "<input checked='' class='checkbox' id='q-cutoff-field' name='cutoff' type='checkbox' value='1'>" +
57 "<label for='q-cutoff-field' title='Zeige nur die ersten Treffer in beliebiger Reihenfolge'><span id='glimpse'></span>Glimpse</label>" +
58 "<a class='tutorial' id='view-tutorial' tabindex='-1' title='Einführung'><span>Einführung</span></a>"+
59 "</div>" +
60 "<div class='clear'></div>"+
61 "</form>" +
62 "<div class='hint mirror' style='height: 0px; left: 238px; top: 36px; width: 1272px; padding-left: 2px; margin-left: 0px; border-left-width: 2px; border-left-style: solid; font-size: 14.6667px; font-family: Noto Sans;'>" +
63 "<span></span>" +
64 "<div id='hint' class=''>" +
65 "<div style='display: none;' class='alert hint'></div>" +
66 "<ul style='outline: currentcolor none 0px;' tabindex='0' class='menu roll hint'>" +
67 "<span class='pref'></span>" +
68 "<div class='lengthField'>" +
69 "<span>Base Annotation--</span>" +
70 "<span class='desc'>Structure--</span>" +
71 "<span>DeReKo--</span><span class='desc'>Structure--</span>"+
72 "</div>"
73 "<div class='ruler' style='display: none;'><span></span><div></div></div>"
74 "</ul>" +
75 "</div>" +
76 "</div>";
hebastad090a512019-07-10 16:36:01 +020077
78
hebasta94e47cb2019-07-24 22:24:27 +020079 var preDefinedStat={
80 "documents":12,
81 "tokens":2323,
82 "sentences":343434,
83 "paragraphs":45454545
84 };
85
86
87 KorAP.API.getCorpStat = function(collQu, cb){
88 return cb(preDefinedStat);
89 };
90
hebasta75cfca52019-02-19 13:15:27 +010091
hebasta87f1b1f2019-07-30 13:03:23 +020092 var resultkorap =
93 "<div id='search'>" +
94 "<ol class='align-left' tabindex='-8'>" +
95 "<li data-corpus-id='WPD' " +
96 "data-doc-id='WWW'" +
97 "data-text-id='03313'" +
98 "data-match-id='p102-103'" +
99 "data-available-info='base/s=spans corenlp/c=spans corenlp/ne=tokens corenlp/p=tokens corenlp/s=spans glemm/l=tokens mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans malt/d=rels'"+
100 "id='WPD-WWW.03313-p102-103'" +
101 "tabindex='6'>" +
102 "<div class='meta'>WPD/WWW/03313</div>" +
103 "<div class='match-main'>" +
104 "<div class='match-wrap'>" +
105 "<div class='snippet startMore endMore'>" +
106 "<div class='flag'></div>" +
107 "<span class='context-left'>In diesem Beispiel ist zu sehen, dass die beiden Variablen a und b lediglich ihre Werte an" +
108 " die Funktion </span><mark><mark class='class-2 level-1'>Dies </mark><mark class='class-1 level-0'><mark class='class-2 level-1'><mark class='class-3 level-2'>ist</mark>" +
109 " ein</mark> Test</mark></mark><span class='context-right'> übergeben, aber im Gegensatz zu einem Referenzparamter dabei unverändert bleiben.</span></div>" +
110 "</div>"+
111 "<!-- only inject via javascript! -->" +
112 "</div>" +
113 "<p class='ref'><strong>Wertparameter</strong> by Hubi,Zwobot,4; published on 2005-03-28 as WWW.03313 (WPD)</p>" +
114 "<!-- only inject via javascript! -->" +
115 "</li>" +
116 "</div>";
117
118
119
120 var snippet = "<span title=\"cnx/l:meist\">" +
121 " <span title=\"cnx/p:ADV\">" +
122 " <span title=\"cnx/syn:@PREMOD\">" +
123 " <span title=\"mate/l:meist\">" +
124 " <span title=\"mate/l:meist\">" +
125 " <span title=\"mate/p:ADV\">" +
126 " <span title=\"opennlp/p:ADV\">meist</span>" +
127 " </span>" +
128 " </span>" +
129 " </span>" +
130 " </span>" +
131 " </span>" +
132 "</span>" +
133 "<mark>" +
134 "<span title=\"cnx/l:deutlich\">" +
135 " <span title=\"cnx/p:A\">" +
136 " <span title=\"cnx/syn:@PREMOD\">" +
137 " <span title=\"mate/l:deutlich\">" +
138 " <span title=\"mate/m:degree:pos\">" +
139 " <span title=\"mate/p:ADJD\">" +
140 " <span title=\"opennlp/p:ADJD\">deutlich</span>" +
141 " </span>" +
142 " </span>" +
143 " </span>" +
144 " </span>" +
145 " </span>" +
146 "</span>" +
147 "</mark>" +
148 "<span title=\"cnx/l:fähig\">" +
149 " <span title=\"cnx/l:leistung\">" +
150 " <span title=\"cnx/p:A\">" +
151 " <span title=\"cnx/p:ADJA\">" +
152 " <span title=\"cnx/syn:@NH\">" +
153 " <span title=\"mate/l:leistungsfähig\">" +
154 " <span title=\"mate/m:degree:comp\">" +
155 " <span title=\"mate/p:ADJD\">" +
156 " <span title=\"opennlp/p:ADJD\">leistungsfähiger</span>" +
157 " </span>" +
158 " </span>" +
159 " </span>" +
160 " </span>" +
161 " </span>" +
162 " </span>" +
163 " </span>" +
164 "</span>";
165
166 var treeSnippet =
167 "<span class=\"context-left\"></span>" +
168 "<span class=\"match\">" +
169 " <span title=\"xip/c:MC\">" +
170 " <span title=\"xip/c:TOP\">" +
171 " <span title=\"xip/c:PP\">" +
172 " <span title=\"xip/c:PREP\">Mit</span>" +
173 " <span title=\"xip/c:NP\">" +
174 " <span title=\"xip/c:DET\">dieser</span>" +
175 " <span title=\"xip/c:NPA\">" +
176 " <span title=\"xip/c:NOUN\">Methode</span>" +
177 " </span>" +
178 " </span>" +
179 " </span>" +
180 " <span title=\"xip/c:VERB\">ist</span>" +
181 " <mark>" +
182 " <span title=\"xip/c:NP\">" +
183 " <span title=\"xip/c:PRON\">es</span>" +
184 " </span>" +
185 " <span title=\"xip/c:AP\">" +
186 " <span title=\"xip/c:ADV\">nun</span>" +
187 " <span title=\"xip/c:ADJ\">möglich</span>" +
188 " </span>" +
189 " </mark>" +
190 " <span title=\"xip/c:ADV\">z. B.</span>" +
191 " <span title=\"xip/c:NPA\">" +
192 " <span title=\"xip/c:NP\">" +
193 " <span title=\"xip/c:NOUN\">Voice</span>" +
194 " </span>" +
195 " </span>" + "(" +
196 " <span title=\"xip/c:INS\">" +
197 " <span title=\"xip/c:NPA\">" +
198 " <span title=\"xip/c:NP\">" +
199 " <span title=\"xip/c:NOUN\">Sprache</span>" +
200 " </span>" +
201 " </span>" +
202 " </span>" + ")" +
203 " <span title=\"xip/c:VERB\">bevorzugt</span>" +
204 " <span title=\"xip/c:PP\">" +
205 " <span title=\"xip/c:PREP\">in</span>" +
206 " <span title=\"xip/c:NP\">" +
207 " <span title=\"xip/c:PRON\">der</span>" +
208 " </span>" +
209 " <span title=\"xip/c:NPA\">" +
210 " <span title=\"xip/c:NP\">" +
211 " <span title=\"xip/c:NOUN\">Bridge</span>" +
212 " </span>" +
213 " </span>" +
214 " </span>" +
215 " <span title=\"xip/c:INFC\">" +
216 " <span title=\"xip/c:INS\">" +
217 " <span title=\"xip/c:VERB\">weiterzugeben</span>" +
218 " </span>" +
219 " </span>" +
220 " </span>" +
221 " </span>" +
222 "</span>" +
223 "<span class=\"context-right\"></span>";
224
225 KorAP.API.getTextInfo = function (doc, param, cb) {
226 cb(textInfo);
227 };
228
229 // Override getMatchInfo API call
230 KorAP.API.getMatchInfo = function (x, param, cb) {
231 if (param['spans'] === undefined || param['spans'] === false)
232 cb({ "snippet": snippet });
233 else
234 cb({ "snippet": treeSnippet });
235 };
236
237 var textInfo = {
238 "@context":"http:\/\/korap.ids-mannheim.de\/ns\/KoralQuery\/v0.3\/context.jsonld",
239 "document":{
240 "@type":"koral:document",
241 "fields":[
242 {
243 "@type":"koral:field",
244 "key":"editor",
245 "type":"type:store",
246 "value":"wikipedia.org"
247 },
248 {
249 "@type":"koral:field",
250 "key":"textSigle",
251 "type":"type:string",
252 "value":"WPD15\/264\/58336"
253 },
254 {
255 "@type":"koral:field",
256 "key":"author",
257 "type":"type:text",
258 "value":"Sprachpfleger, u.a."
259 },
260 {
261 "@type":"koral:field",
262 "key":"docSigle",
263 "type":"type:string",
264 "value":"WPD15\/264"
265 },
266 {
267 "@type":"koral:field",
268 "key":"textTypeArt",
269 "type":"type:string",
270 "value":"Enzyklopädie-Artikel"
271 },
272 {
273 "@type":"koral:field",
274 "key":"language",
275 "type":"type:string",
276 "value":"de"
277 },
278 {
279 "@type":"koral:field",
280 "key":"docTitle",
281 "type":"type:text",
282 "value":"Wikipedia, Artikel mit Anfangszahl 2, Teil 64"
283 },
284 {
285 "@type":"koral:field",
286 "key":"textType",
287 "type":"type:string",
288 "value":"Enzyklopädie"
289 },
290 {
291 "@type":"koral:field",
292 "key":"availability",
293 "type":"type:string",
294 "value":"CC-BY-SA"
295 },
296 {
297 "@type":"koral:field",
298 "key":"foundries",
299 "type":"type:keywords",
300 "value":[
301 "corenlp",
302 "corenlp\/constituency",
303 "corenlp\/morpho",
304 "corenlp\/sentences",
305 "dereko",
306 "dereko\/structure",
307 "dereko\/structure\/base-sentences-paragraphs-pagebreaks",
308 "opennlp",
309 "opennlp\/morpho",
310 "opennlp\/sentences"
311 ]
312 },
313 {
314 "@type":"koral:field",
315 "key":"creationDate",
316 "type":"type:date",
317 "value":"2015-04-17"
318 },
319 {
320 "@type":"koral:field",
321 "key":"title",
322 "type":"type:text",
323 "value":"22:43 – Das Schicksal hat einen Plan"
324 },
325 {
326 "@type":"koral:field",
327 "key":"pubDate",
328 "type":"type:date",
329 "value":"2015-05-01"
330 },
331 {
332 "@type":"koral:field",
333 "key":"reference",
334 "type":"type:store",
335 "value":"22:43 – Das Schicksal hat einen Plan, In: Wikipedia - URL:http:\/\/de.wikipedia.org\/wiki\/22:43_–_Das_Schicksal_hat_einen_Plan: Wikipedia, 2015"
336 },
337 {
338 "@type":"koral:field",
339 "key":"textClass",
340 "type":"type:keywords",
341 "value":["kultur","film"]
342 },
343 {
344 "@type":"koral:field",
345 "key":"tokenSource",
346 "type":"type:store",
347 "value":"base#tokens"
348 },
349 {
350 "@type":"koral:field",
351 "key":"publisher",
352 "type":"type:store",
353 "value":"Wikipedia"
354 },
355 {
356 "@type":"koral:field",
357 "key":"layerInfos",
358 "type":"type:store",
359 "value":"corenlp\/c=spans corenlp\/p=tokens corenlp\/s=spans dereko\/s=spans opennlp\/p=tokens opennlp\/s=spans"
360 },
361 {
362 "@type":"koral:field",
363 "key":"pubPlace",
364 "type":"type:string",
365 "value":"URL:http:\/\/de.wikipedia.org"
366 },
367 {
368 "@type":"koral:field",
369 "key":"corpusTitle",
370 "type":"type:text",
371 "value":"Wikipedia"
372 },
373 {
374 "@type":"koral:field",
375 "key":"corpusEditor",
376 "type":"type:store",
377 "value":"wikipedia.org"
378 },
379 {
380 "@type":"koral:field",
381 "key":"corpusSigle",
382 "type":"type:string",
383 "value":"WPD15"
384 }
385 ]
386 }
387 };
hebasta75cfca52019-02-19 13:15:27 +0100388 let template = document.createElement('template');
hebasta94e47cb2019-07-24 22:24:27 +0200389 let html = introKorAP.trim(); // Do not return a text node of whitespace as the result
hebasta75cfca52019-02-19 13:15:27 +0100390 template.innerHTML = html;
hebasta94e47cb2019-07-24 22:24:27 +0200391 let intrkorap = template.content;
hebasta75cfca52019-02-19 13:15:27 +0100392
hebasta87f1b1f2019-07-30 13:03:23 +0200393 let resulttemplate = document.createElement('template');
394 let htmlZwei = resultkorap.trim();
395 resulttemplate.innerHTML = resultkorap;
396 var resultkor = resulttemplate.content;
397
398 resultkor.querySelector('#search > ol > li:not(.active)').addEventListener('click', function (e) {
399 if (this._match !== undefined)
400 this._match.open();
401 else {
402 matchClass.create(this).open();
403 }
404 });
405
hebasta94e47cb2019-07-24 22:24:27 +0200406 let vc= vcClass.create().fromJson({
407 '@type' : 'koral:doc',
408 'key' : 'title',
409 'match': 'match:eq',
410 'value' : 'TestTour!',
411 'type' : 'type:string'
412 });
413
414 KorAP.vc = vc;
hebastaf95226b2019-09-19 11:37:00 +0200415
hebasta75cfca52019-02-19 13:15:27 +0100416 describe('KorAP.GuidedTour', function(){
hebasta87f1b1f2019-07-30 13:03:23 +0200417
418 afterAll(function () {
419 KorAP.API.getMatchInfo = undefined;
420 var body = document.body;
421 var i = body.children.length - 1;
422 while (i >= 0) {
423 if (body.children[i].nodeType && body.children[i].nodeType === 1) {
424 if (!body.children[i].classList.contains("jasmine_html-reporter")) {
425 body.removeChild(body.children[i]);
426 };
427 };
428 i--;
429 };
430 })
hebastaf95226b2019-09-19 11:37:00 +0200431
432 KorAP.Hint = hintClass.create({inputField: intrkorap.getElementById("q-field")});
433
hebastafa118342021-11-02 19:56:01 +0100434
hebasta75cfca52019-02-19 13:15:27 +0100435 it('IDs and classes, that are needed for the guided tour should be in existence', function(){
hebasta87f1b1f2019-07-30 13:03:23 +0200436 //gTstartSearch
hebasta75cfca52019-02-19 13:15:27 +0100437 expect(intrkorap.querySelector('#searchbar')).not.toBeNull();
438 expect(intrkorap.querySelector('#q-field')).not.toBeNull();
hebasta0c93d8e2019-05-15 12:06:16 +0200439 expect(intrkorap.querySelector('#hint')).not.toBeNull();
440 expect(intrkorap.querySelector('#vc-choose')).not.toBeNull();
hebasta75cfca52019-02-19 13:15:27 +0100441 expect(intrkorap.querySelector('#vc-view')).not.toBeNull();
hebastafa118342021-11-02 19:56:01 +0100442 expect(intrkorap.querySelector('#vc-view * .doc')).not.toBeNull();
hebasta75cfca52019-02-19 13:15:27 +0100443 expect(intrkorap.querySelector('#ql-field').parentNode).not.toBeNull();
hebastabd53f822021-10-26 21:50:06 +0200444 expect(intrkorap.querySelector('#glimpse').parentNode).not.toBeNull();
hebasta75cfca52019-02-19 13:15:27 +0100445 expect(intrkorap.querySelector('#view-tutorial')).not.toBeNull();
hebasta5df796f2019-05-21 15:27:12 +0200446 expect(intrkorap.querySelector('#qsubmit')).not.toBeNull();
hebasta94e47cb2019-07-24 22:24:27 +0200447 let show = document.createElement('div');
hebastad090a512019-07-10 16:36:01 +0200448 show.appendChild(vc.element());
hebasta94e47cb2019-07-24 22:24:27 +0200449 let statbut = show.querySelector('.statistic');
450 expect(statbut).not.toBeNull();
451 statbut.click();
452 expect(show.querySelector('.stattable')).not.toBeNull();
hebastafa118342021-11-02 19:56:01 +0100453 let docUnspec = document.createElement('div');
454 let doc = docClassUnspec.create();
455 docUnspec.append(doc.element());
456 let vcbut = docUnspec.querySelector('.doc > span');
457 vcbut.click();
458 expect(docUnspec.querySelector('.menu.roll')).not.toBeNull();
459
hebasta87f1b1f2019-07-30 13:03:23 +0200460 //IDs and classes, that are needed for the second guided tour(gTshowResults()) should be in existence, too
461 expect(resultkor.querySelector('#search')).not.toBeNull();
462 expect(resultkor.querySelector('#search > ol > li')).not.toBeNull();
463 resultkor.querySelector("#search > ol > li").click();
464 expect(resultkor.querySelector('.action > .metatable')).not.toBeNull();
465 resultkor.querySelector(".metatable").click();
466 expect(resultkor.querySelector('.view.metatable')).not.toBeNull();
467 expect(resultkor.querySelector('.action > .info')).not.toBeNull();
468 resultkor.querySelector(".info").click();
469 expect(resultkor.querySelector('.view.tokentable')).not.toBeNull();
470 expect(resultkor.querySelector('.tree')).not.toBeNull();
hebastafa118342021-11-02 19:56:01 +0100471
hebasta75cfca52019-02-19 13:15:27 +0100472 });
hebasta87f1b1f2019-07-30 13:03:23 +0200473
hebasta75cfca52019-02-19 13:15:27 +0100474 it('Guided Tour should be started and display steps and labels in the right order', function(){
hebastaf95226b2019-09-19 11:37:00 +0200475
hebasta94e47cb2019-07-24 22:24:27 +0200476 let vcpanel = intrkorap.getElementById("vc-view");
477 vcpanel.appendChild(vc.element());
hebasta5df796f2019-05-21 15:27:12 +0200478 let searchTour = tourClass.gTstartSearch(intrkorap);
479 searchTour.start();
480 let totalSteps = searchTour.stepCount;
hebasta1e2d98e2019-10-30 15:58:17 +0100481 let welc = document.createElement("DIV");
482 welc.innerHTML = loc.TOUR_welc;
483 expect(document.querySelector(".introjs-tooltiptext").textContent).toEqual(welc.textContent);
hebasta75cfca52019-02-19 13:15:27 +0100484 expect(document.querySelector(".introjs-prevbutton").textContent).toEqual(loc.TOUR_lprev);
485 expect(document.querySelector(".introjs-nextbutton").textContent).toEqual(loc.TOUR_lnext);
hebastaa84c7a92021-10-26 21:12:40 +0200486 expect(document.querySelector(".introjs-skipbutton")).toBeDefined();
hebasta5df796f2019-05-21 15:27:12 +0200487 searchTour.exit();
hebasta75cfca52019-02-19 13:15:27 +0100488
hebastafa118342021-11-02 19:56:01 +0100489 let show = document.createElement('div');
490 show.appendChild(vc.element());
491 let statbut = show.querySelector('.statistic');
492 statbut.click();
493 let corpstat = show.querySelector('.stattable');
494 intrkorap.appendChild(corpstat);
495
hebasta75cfca52019-02-19 13:15:27 +0100496 for(let i = 2; i <= totalSteps; i++){
hebasta5df796f2019-05-21 15:27:12 +0200497 searchTour.goToStepNumber(i);
hebastaf898d7b2021-12-06 14:32:06 +0100498 if(i ==3){
499 //Test for equality. Ignore HTML-Tags, replace down arrow.
500 expect(document.querySelector(".introjs-tooltiptext").textContent).toEqual((searchTour.testIntros[i-1]).replace(/(<([^>]+)>)/ig,"").replace("&darr;","↓"));
501 }
502 else{
503 //Test for equality. Ignore HTML-Tags.
504 expect(document.querySelector(".introjs-tooltiptext").textContent).toEqual((searchTour.testIntros[i-1]).replace(/(<([^>]+)>)/ig,""));
505 }
hebastaf95226b2019-09-19 11:37:00 +0200506 switch(i){
hebastaee7b8a82020-01-20 12:45:04 +0100507 case 4:
hebastafa118342021-11-02 19:56:01 +0100508 expect(intrkorap.querySelector('#hint')).not.toBeNull();
509 expect(KorAP.Hint).not.toBeNull();
510 expect(KorAP.Hint.active().dontHide).toBe(true);
511 expect(KorAP.Hint._active).not.toBeNull();
512 break;
hebastaee7b8a82020-01-20 12:45:04 +0100513 case 5:
hebastafa118342021-11-02 19:56:01 +0100514 expect(KorAP.Hint._active).toBeNull();
515 break;
516 case 6:
517 expect(KorAP._vcKeyMenu.dontHide).toBe(false);
518 break;
519 case 7:
520 expect(KorAP._vcKeyMenu.dontHide).toBe(true);
521 break;
522 case 8:
523 expect(KorAP._vcKeyMenu.dontHide).toBe(false);
524 break;
hebastaf95226b2019-09-19 11:37:00 +0200525 case totalSteps:
hebastafa118342021-11-02 19:56:01 +0100526 expect(document.querySelector(".introjs-donebutton").textContent).toEqual(loc.TOUR_ldoneSearch);
527 expect(document.querySelector(".introjs-prevbutton").textContent).toEqual(loc.TOUR_lprev);
528 expect(document.querySelector(".introjs-skipbutton")).toBeDefined();
529 break;
hebastaf95226b2019-09-19 11:37:00 +0200530 }
hebasta5df796f2019-05-21 15:27:12 +0200531 searchTour.exit();
hebastafa118342021-11-02 19:56:01 +0100532 }
hebasta5df796f2019-05-21 15:27:12 +0200533
hebasta87f1b1f2019-07-30 13:03:23 +0200534 let resultTour = tourClass.gTshowResults(resultkor);
hebasta5df796f2019-05-21 15:27:12 +0200535 KorAP.session = sessionClass.create('KalamarJSDem');
hebastaf95226b2019-09-19 11:37:00 +0200536
hebasta87f1b1f2019-07-30 13:03:23 +0200537 resultTour.start(resultkor);
538 let totalStepsR = resultTour.stepCount;
539 expect(document.querySelector(".introjs-tooltiptext").textContent).toEqual(loc.TOUR_kwic);
hebasta87f1b1f2019-07-30 13:03:23 +0200540 expect(document.querySelector(".introjs-prevbutton").textContent).toEqual(loc.TOUR_lprev);
541 expect(document.querySelector(".introjs-nextbutton").textContent).toEqual(loc.TOUR_lnext);
hebastaa84c7a92021-10-26 21:12:40 +0200542 expect(document.querySelector(".introjs-skipbutton")).toBeDefined();
hebasta5df796f2019-05-21 15:27:12 +0200543 resultTour.exit();
hebastaf95226b2019-09-19 11:37:00 +0200544 for(let i = 2; i <= totalStepsR; i++){
hebasta87f1b1f2019-07-30 13:03:23 +0200545 resultTour.goToStepNumber(i);
546 expect(document.querySelector(".introjs-tooltiptext").textContent).toEqual(resultTour.testIntros[i-1]);
547 if(i == totalStepsR){
548 expect(document.querySelector(".introjs-donebutton").textContent).toEqual(loc.TOUR_ldone);
549 }
550 resultTour.exit();
551 }
552 });
hebastaf95226b2019-09-19 11:37:00 +0200553
hebastafa118342021-11-02 19:56:01 +0100554 it('Guided Tour should hide Hint if aborted', function(){
hebastaf95226b2019-09-19 11:37:00 +0200555 let tourAbort = tourClass.gTstartSearch(intrkorap);
556 tourAbort.start();
557 expect(KorAP.Hint._active).toBeNull();
558 expect(document.querySelector(".introjs-skipbutton")).not.toBeNull();
hebastaee7b8a82020-01-20 12:45:04 +0100559 tourAbort.goToStepNumber(4);
hebastaf95226b2019-09-19 11:37:00 +0200560 expect(KorAP.Hint._active).not.toBeNull()
561 expect(KorAP.Hint.active().dontHide).toBe(true);
562 tourAbort.exit();
563 expect(KorAP.Hint._active).toBeNull();
564 });
hebastafa118342021-11-02 19:56:01 +0100565
566 it('Guided Tour should hide vcKeyMenu if aborted', function(){
567 let tourAbort = tourClass.gTstartSearch(intrkorap);
568 tourAbort.start();
569 expect(KorAP._vcKeyMenu.dontHide).toBe(false);
570 tourAbort.goToStepNumber(6);
571 expect(KorAP._vcKeyMenu.dontHide).toBe(false);
572 tourAbort.goToStepNumber(7);
573 expect(KorAP._vcKeyMenu.dontHide).toBe(true);
574 tourAbort.exit();
575 expect(KorAP._vcKeyMenu.dontHide).toBe(false);
576 });
577
578 it('Guided Tour should hide vcKeyMenu in the next step ', function(){
579 let tourNext = tourClass.gTstartSearch(intrkorap);
580 tourNext.start();
581 expect(KorAP._vcKeyMenu.dontHide).toBe(false);
582 tourNext.goToStepNumber(7);
583 expect(KorAP._vcKeyMenu.dontHide).toBe(true);
584 tourNext.goToStepNumber(8);
585 expect(KorAP._vcKeyMenu.dontHide).toBe(false);
586 });
587
588
hebastaf95226b2019-09-19 11:37:00 +0200589
hebasta75cfca52019-02-19 13:15:27 +0100590 });
hebasta87f1b1f2019-07-30 13:03:23 +0200591});