hebasta | 75cfca5 | 2019-02-19 13:15:27 +0100 | [diff] [blame] | 1 | /** |
hebasta | 87f1b1f | 2019-07-30 13:03:23 +0200 | [diff] [blame] | 2 | * Test suite for guided tour |
hebasta | 75cfca5 | 2019-02-19 13:15:27 +0100 | [diff] [blame] | 3 | * |
| 4 | * @author Helge Stallkamp |
| 5 | */ |
| 6 | |
hebasta | 87f1b1f | 2019-07-30 13:03:23 +0200 | [diff] [blame] | 7 | define(['tour/tours', 'vc', 'session', 'match'], function(tourClass, vcClass, sessionClass, matchClass){ |
hebasta | 75cfca5 | 2019-02-19 13:15:27 +0100 | [diff] [blame] | 8 | const loc = KorAP.Locale; |
hebasta | 0c93d8e | 2019-05-15 12:06:16 +0200 | [diff] [blame] | 9 | var introKorAP = |
| 10 | "<form autocomplete='off' action='/' id='searchform'>" + |
| 11 | "<div id='searchbar' class=''>" + |
| 12 | "<input autocapitalize='off' autocomplete='off' autocorrect='off' autofocus='autofocus' id='q-field' name='q' placeholder='Finde ...' spellcheck='false' type='search'>" + |
hebasta | 5df796f | 2019-05-21 15:27:12 +0200 | [diff] [blame] | 13 | "<button type='submit' id='qsubmit' title='Los!'><span>Los!</span></button>" + |
hebasta | 0c93d8e | 2019-05-15 12:06:16 +0200 | [diff] [blame] | 14 | "</div>" + |
Akron | cd42a14 | 2019-07-12 18:55:37 +0200 | [diff] [blame] | 15 | "<!-- Search in the following virtual corpus -->"+ |
hebasta | 0c93d8e | 2019-05-15 12:06:16 +0200 | [diff] [blame] | 16 | "<div id='vc-view'></div>" + |
| 17 | "in" + |
| 18 | "<span id='vc-choose' class='select'><span>allen Korpora</span></span>" + |
Akron | cd42a14 | 2019-07-12 18:55:37 +0200 | [diff] [blame] | 19 | "<input id='cq' name='cq' type='text' style='display: none;'>" + |
hebasta | 0c93d8e | 2019-05-15 12:06:16 +0200 | [diff] [blame] | 20 | "mit" + |
| 21 | "<span class='select'>" + |
| 22 | "<select id='ql-field' name='ql' style='display: none;'>" + |
| 23 | "<option value='poliqarp'>Poliqarp</option>" + |
| 24 | "<option value='cosmas2'>Cosmas II</option>" + |
| 25 | "<option value='annis'>Annis QL</option>" + |
| 26 | "<option value='cql'>CQL v1.2</option>" + |
| 27 | "<option value='fcsql'>FCSQL</option>" + |
| 28 | "</select>" + |
| 29 | "<span style='display: inline;'> Poliqarp</span>" + |
| 30 | "<ul style='outline: currentcolor none 0px;' tabindex='0' class='menu roll'>" + |
| 31 | "<span class='pref'></span>" + |
| 32 | "<div class='lengthField'>" + |
| 33 | "<span>Poliqarp--</span>" + |
| 34 | "<span>Cosmas II--</span>" + |
| 35 | "<span>Annis QL--</span>" + |
| 36 | "<span>CQL v1.2--</span>" + |
| 37 | "<span>FCSQL--</span>" + |
| 38 | "</div><div class='ruler' style='display: none;'><span></span><div></div>" + |
| 39 | "</div>" + |
| 40 | "</ul>" + |
| 41 | "</span>" + |
| 42 | "<div class='button right'>" + |
| 43 | "<input checked='' class='checkbox' id='q-cutoff-field' name='cutoff' type='checkbox' value='1'>" + |
| 44 | "<label for='q-cutoff-field' title='Zeige nur die ersten Treffer in beliebiger Reihenfolge'><span id='glimpse'></span>Glimpse</label>" + |
| 45 | "<a class='tutorial' id='view-tutorial' tabindex='-1' title='Einführung'><span>Einführung</span></a>"+ |
| 46 | "</div>" + |
| 47 | "<div class='clear'></div>"+ |
| 48 | "</form>" + |
| 49 | "<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;'>" + |
| 50 | "<span></span>" + |
| 51 | "<div id='hint' class=''>" + |
| 52 | "<div style='display: none;' class='alert hint'></div>" + |
| 53 | "<ul style='outline: currentcolor none 0px;' tabindex='0' class='menu roll hint'>" + |
| 54 | "<span class='pref'></span>" + |
| 55 | "<div class='lengthField'>" + |
| 56 | "<span>Base Annotation--</span>" + |
| 57 | "<span class='desc'>Structure--</span>" + |
| 58 | "<span>DeReKo--</span><span class='desc'>Structure--</span>"+ |
| 59 | "</div>" |
| 60 | "<div class='ruler' style='display: none;'><span></span><div></div></div>" |
| 61 | "</ul>" + |
| 62 | "</div>" + |
| 63 | "</div>"; |
hebasta | d090a51 | 2019-07-10 16:36:01 +0200 | [diff] [blame] | 64 | |
| 65 | |
hebasta | 94e47cb | 2019-07-24 22:24:27 +0200 | [diff] [blame] | 66 | var preDefinedStat={ |
| 67 | "documents":12, |
| 68 | "tokens":2323, |
| 69 | "sentences":343434, |
| 70 | "paragraphs":45454545 |
| 71 | }; |
| 72 | |
| 73 | |
| 74 | KorAP.API.getCorpStat = function(collQu, cb){ |
| 75 | return cb(preDefinedStat); |
| 76 | }; |
| 77 | |
hebasta | 75cfca5 | 2019-02-19 13:15:27 +0100 | [diff] [blame] | 78 | |
hebasta | 87f1b1f | 2019-07-30 13:03:23 +0200 | [diff] [blame] | 79 | var resultkorap = |
| 80 | "<div id='search'>" + |
| 81 | "<ol class='align-left' tabindex='-8'>" + |
| 82 | "<li data-corpus-id='WPD' " + |
| 83 | "data-doc-id='WWW'" + |
| 84 | "data-text-id='03313'" + |
| 85 | "data-match-id='p102-103'" + |
| 86 | "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'"+ |
| 87 | "id='WPD-WWW.03313-p102-103'" + |
| 88 | "tabindex='6'>" + |
| 89 | "<div class='meta'>WPD/WWW/03313</div>" + |
| 90 | "<div class='match-main'>" + |
| 91 | "<div class='match-wrap'>" + |
| 92 | "<div class='snippet startMore endMore'>" + |
| 93 | "<div class='flag'></div>" + |
| 94 | "<span class='context-left'>In diesem Beispiel ist zu sehen, dass die beiden Variablen a und b lediglich ihre Werte an" + |
| 95 | " 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>" + |
| 96 | " ein</mark> Test</mark></mark><span class='context-right'> übergeben, aber im Gegensatz zu einem Referenzparamter dabei unverändert bleiben.</span></div>" + |
| 97 | "</div>"+ |
| 98 | "<!-- only inject via javascript! -->" + |
| 99 | "</div>" + |
| 100 | "<p class='ref'><strong>Wertparameter</strong> by Hubi,Zwobot,4; published on 2005-03-28 as WWW.03313 (WPD)</p>" + |
| 101 | "<!-- only inject via javascript! -->" + |
| 102 | "</li>" + |
| 103 | "</div>"; |
| 104 | |
| 105 | |
| 106 | |
| 107 | var snippet = "<span title=\"cnx/l:meist\">" + |
| 108 | " <span title=\"cnx/p:ADV\">" + |
| 109 | " <span title=\"cnx/syn:@PREMOD\">" + |
| 110 | " <span title=\"mate/l:meist\">" + |
| 111 | " <span title=\"mate/l:meist\">" + |
| 112 | " <span title=\"mate/p:ADV\">" + |
| 113 | " <span title=\"opennlp/p:ADV\">meist</span>" + |
| 114 | " </span>" + |
| 115 | " </span>" + |
| 116 | " </span>" + |
| 117 | " </span>" + |
| 118 | " </span>" + |
| 119 | "</span>" + |
| 120 | "<mark>" + |
| 121 | "<span title=\"cnx/l:deutlich\">" + |
| 122 | " <span title=\"cnx/p:A\">" + |
| 123 | " <span title=\"cnx/syn:@PREMOD\">" + |
| 124 | " <span title=\"mate/l:deutlich\">" + |
| 125 | " <span title=\"mate/m:degree:pos\">" + |
| 126 | " <span title=\"mate/p:ADJD\">" + |
| 127 | " <span title=\"opennlp/p:ADJD\">deutlich</span>" + |
| 128 | " </span>" + |
| 129 | " </span>" + |
| 130 | " </span>" + |
| 131 | " </span>" + |
| 132 | " </span>" + |
| 133 | "</span>" + |
| 134 | "</mark>" + |
| 135 | "<span title=\"cnx/l:fähig\">" + |
| 136 | " <span title=\"cnx/l:leistung\">" + |
| 137 | " <span title=\"cnx/p:A\">" + |
| 138 | " <span title=\"cnx/p:ADJA\">" + |
| 139 | " <span title=\"cnx/syn:@NH\">" + |
| 140 | " <span title=\"mate/l:leistungsfähig\">" + |
| 141 | " <span title=\"mate/m:degree:comp\">" + |
| 142 | " <span title=\"mate/p:ADJD\">" + |
| 143 | " <span title=\"opennlp/p:ADJD\">leistungsfähiger</span>" + |
| 144 | " </span>" + |
| 145 | " </span>" + |
| 146 | " </span>" + |
| 147 | " </span>" + |
| 148 | " </span>" + |
| 149 | " </span>" + |
| 150 | " </span>" + |
| 151 | "</span>"; |
| 152 | |
| 153 | var treeSnippet = |
| 154 | "<span class=\"context-left\"></span>" + |
| 155 | "<span class=\"match\">" + |
| 156 | " <span title=\"xip/c:MC\">" + |
| 157 | " <span title=\"xip/c:TOP\">" + |
| 158 | " <span title=\"xip/c:PP\">" + |
| 159 | " <span title=\"xip/c:PREP\">Mit</span>" + |
| 160 | " <span title=\"xip/c:NP\">" + |
| 161 | " <span title=\"xip/c:DET\">dieser</span>" + |
| 162 | " <span title=\"xip/c:NPA\">" + |
| 163 | " <span title=\"xip/c:NOUN\">Methode</span>" + |
| 164 | " </span>" + |
| 165 | " </span>" + |
| 166 | " </span>" + |
| 167 | " <span title=\"xip/c:VERB\">ist</span>" + |
| 168 | " <mark>" + |
| 169 | " <span title=\"xip/c:NP\">" + |
| 170 | " <span title=\"xip/c:PRON\">es</span>" + |
| 171 | " </span>" + |
| 172 | " <span title=\"xip/c:AP\">" + |
| 173 | " <span title=\"xip/c:ADV\">nun</span>" + |
| 174 | " <span title=\"xip/c:ADJ\">möglich</span>" + |
| 175 | " </span>" + |
| 176 | " </mark>" + |
| 177 | " <span title=\"xip/c:ADV\">z. B.</span>" + |
| 178 | " <span title=\"xip/c:NPA\">" + |
| 179 | " <span title=\"xip/c:NP\">" + |
| 180 | " <span title=\"xip/c:NOUN\">Voice</span>" + |
| 181 | " </span>" + |
| 182 | " </span>" + "(" + |
| 183 | " <span title=\"xip/c:INS\">" + |
| 184 | " <span title=\"xip/c:NPA\">" + |
| 185 | " <span title=\"xip/c:NP\">" + |
| 186 | " <span title=\"xip/c:NOUN\">Sprache</span>" + |
| 187 | " </span>" + |
| 188 | " </span>" + |
| 189 | " </span>" + ")" + |
| 190 | " <span title=\"xip/c:VERB\">bevorzugt</span>" + |
| 191 | " <span title=\"xip/c:PP\">" + |
| 192 | " <span title=\"xip/c:PREP\">in</span>" + |
| 193 | " <span title=\"xip/c:NP\">" + |
| 194 | " <span title=\"xip/c:PRON\">der</span>" + |
| 195 | " </span>" + |
| 196 | " <span title=\"xip/c:NPA\">" + |
| 197 | " <span title=\"xip/c:NP\">" + |
| 198 | " <span title=\"xip/c:NOUN\">Bridge</span>" + |
| 199 | " </span>" + |
| 200 | " </span>" + |
| 201 | " </span>" + |
| 202 | " <span title=\"xip/c:INFC\">" + |
| 203 | " <span title=\"xip/c:INS\">" + |
| 204 | " <span title=\"xip/c:VERB\">weiterzugeben</span>" + |
| 205 | " </span>" + |
| 206 | " </span>" + |
| 207 | " </span>" + |
| 208 | " </span>" + |
| 209 | "</span>" + |
| 210 | "<span class=\"context-right\"></span>"; |
| 211 | |
| 212 | KorAP.API.getTextInfo = function (doc, param, cb) { |
| 213 | cb(textInfo); |
| 214 | }; |
| 215 | |
| 216 | // Override getMatchInfo API call |
| 217 | KorAP.API.getMatchInfo = function (x, param, cb) { |
| 218 | if (param['spans'] === undefined || param['spans'] === false) |
| 219 | cb({ "snippet": snippet }); |
| 220 | else |
| 221 | cb({ "snippet": treeSnippet }); |
| 222 | }; |
| 223 | |
| 224 | var textInfo = { |
| 225 | "@context":"http:\/\/korap.ids-mannheim.de\/ns\/KoralQuery\/v0.3\/context.jsonld", |
| 226 | "document":{ |
| 227 | "@type":"koral:document", |
| 228 | "fields":[ |
| 229 | { |
| 230 | "@type":"koral:field", |
| 231 | "key":"editor", |
| 232 | "type":"type:store", |
| 233 | "value":"wikipedia.org" |
| 234 | }, |
| 235 | { |
| 236 | "@type":"koral:field", |
| 237 | "key":"textSigle", |
| 238 | "type":"type:string", |
| 239 | "value":"WPD15\/264\/58336" |
| 240 | }, |
| 241 | { |
| 242 | "@type":"koral:field", |
| 243 | "key":"author", |
| 244 | "type":"type:text", |
| 245 | "value":"Sprachpfleger, u.a." |
| 246 | }, |
| 247 | { |
| 248 | "@type":"koral:field", |
| 249 | "key":"docSigle", |
| 250 | "type":"type:string", |
| 251 | "value":"WPD15\/264" |
| 252 | }, |
| 253 | { |
| 254 | "@type":"koral:field", |
| 255 | "key":"textTypeArt", |
| 256 | "type":"type:string", |
| 257 | "value":"Enzyklopädie-Artikel" |
| 258 | }, |
| 259 | { |
| 260 | "@type":"koral:field", |
| 261 | "key":"language", |
| 262 | "type":"type:string", |
| 263 | "value":"de" |
| 264 | }, |
| 265 | { |
| 266 | "@type":"koral:field", |
| 267 | "key":"docTitle", |
| 268 | "type":"type:text", |
| 269 | "value":"Wikipedia, Artikel mit Anfangszahl 2, Teil 64" |
| 270 | }, |
| 271 | { |
| 272 | "@type":"koral:field", |
| 273 | "key":"textType", |
| 274 | "type":"type:string", |
| 275 | "value":"Enzyklopädie" |
| 276 | }, |
| 277 | { |
| 278 | "@type":"koral:field", |
| 279 | "key":"availability", |
| 280 | "type":"type:string", |
| 281 | "value":"CC-BY-SA" |
| 282 | }, |
| 283 | { |
| 284 | "@type":"koral:field", |
| 285 | "key":"foundries", |
| 286 | "type":"type:keywords", |
| 287 | "value":[ |
| 288 | "corenlp", |
| 289 | "corenlp\/constituency", |
| 290 | "corenlp\/morpho", |
| 291 | "corenlp\/sentences", |
| 292 | "dereko", |
| 293 | "dereko\/structure", |
| 294 | "dereko\/structure\/base-sentences-paragraphs-pagebreaks", |
| 295 | "opennlp", |
| 296 | "opennlp\/morpho", |
| 297 | "opennlp\/sentences" |
| 298 | ] |
| 299 | }, |
| 300 | { |
| 301 | "@type":"koral:field", |
| 302 | "key":"creationDate", |
| 303 | "type":"type:date", |
| 304 | "value":"2015-04-17" |
| 305 | }, |
| 306 | { |
| 307 | "@type":"koral:field", |
| 308 | "key":"title", |
| 309 | "type":"type:text", |
| 310 | "value":"22:43 – Das Schicksal hat einen Plan" |
| 311 | }, |
| 312 | { |
| 313 | "@type":"koral:field", |
| 314 | "key":"pubDate", |
| 315 | "type":"type:date", |
| 316 | "value":"2015-05-01" |
| 317 | }, |
| 318 | { |
| 319 | "@type":"koral:field", |
| 320 | "key":"reference", |
| 321 | "type":"type:store", |
| 322 | "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" |
| 323 | }, |
| 324 | { |
| 325 | "@type":"koral:field", |
| 326 | "key":"textClass", |
| 327 | "type":"type:keywords", |
| 328 | "value":["kultur","film"] |
| 329 | }, |
| 330 | { |
| 331 | "@type":"koral:field", |
| 332 | "key":"tokenSource", |
| 333 | "type":"type:store", |
| 334 | "value":"base#tokens" |
| 335 | }, |
| 336 | { |
| 337 | "@type":"koral:field", |
| 338 | "key":"publisher", |
| 339 | "type":"type:store", |
| 340 | "value":"Wikipedia" |
| 341 | }, |
| 342 | { |
| 343 | "@type":"koral:field", |
| 344 | "key":"layerInfos", |
| 345 | "type":"type:store", |
| 346 | "value":"corenlp\/c=spans corenlp\/p=tokens corenlp\/s=spans dereko\/s=spans opennlp\/p=tokens opennlp\/s=spans" |
| 347 | }, |
| 348 | { |
| 349 | "@type":"koral:field", |
| 350 | "key":"pubPlace", |
| 351 | "type":"type:string", |
| 352 | "value":"URL:http:\/\/de.wikipedia.org" |
| 353 | }, |
| 354 | { |
| 355 | "@type":"koral:field", |
| 356 | "key":"corpusTitle", |
| 357 | "type":"type:text", |
| 358 | "value":"Wikipedia" |
| 359 | }, |
| 360 | { |
| 361 | "@type":"koral:field", |
| 362 | "key":"corpusEditor", |
| 363 | "type":"type:store", |
| 364 | "value":"wikipedia.org" |
| 365 | }, |
| 366 | { |
| 367 | "@type":"koral:field", |
| 368 | "key":"corpusSigle", |
| 369 | "type":"type:string", |
| 370 | "value":"WPD15" |
| 371 | } |
| 372 | ] |
| 373 | } |
| 374 | }; |
hebasta | 75cfca5 | 2019-02-19 13:15:27 +0100 | [diff] [blame] | 375 | let template = document.createElement('template'); |
hebasta | 94e47cb | 2019-07-24 22:24:27 +0200 | [diff] [blame] | 376 | let html = introKorAP.trim(); // Do not return a text node of whitespace as the result |
hebasta | 75cfca5 | 2019-02-19 13:15:27 +0100 | [diff] [blame] | 377 | template.innerHTML = html; |
hebasta | 94e47cb | 2019-07-24 22:24:27 +0200 | [diff] [blame] | 378 | let intrkorap = template.content; |
hebasta | 75cfca5 | 2019-02-19 13:15:27 +0100 | [diff] [blame] | 379 | |
hebasta | 87f1b1f | 2019-07-30 13:03:23 +0200 | [diff] [blame] | 380 | let resulttemplate = document.createElement('template'); |
| 381 | let htmlZwei = resultkorap.trim(); |
| 382 | resulttemplate.innerHTML = resultkorap; |
| 383 | var resultkor = resulttemplate.content; |
| 384 | |
| 385 | resultkor.querySelector('#search > ol > li:not(.active)').addEventListener('click', function (e) { |
| 386 | if (this._match !== undefined) |
| 387 | this._match.open(); |
| 388 | else { |
| 389 | matchClass.create(this).open(); |
| 390 | } |
| 391 | }); |
| 392 | |
hebasta | 94e47cb | 2019-07-24 22:24:27 +0200 | [diff] [blame] | 393 | let vc= vcClass.create().fromJson({ |
| 394 | '@type' : 'koral:doc', |
| 395 | 'key' : 'title', |
| 396 | 'match': 'match:eq', |
| 397 | 'value' : 'TestTour!', |
| 398 | 'type' : 'type:string' |
| 399 | }); |
| 400 | |
| 401 | KorAP.vc = vc; |
hebasta | 87f1b1f | 2019-07-30 13:03:23 +0200 | [diff] [blame] | 402 | |
hebasta | 75cfca5 | 2019-02-19 13:15:27 +0100 | [diff] [blame] | 403 | describe('KorAP.GuidedTour', function(){ |
hebasta | 87f1b1f | 2019-07-30 13:03:23 +0200 | [diff] [blame] | 404 | |
| 405 | afterAll(function () { |
| 406 | KorAP.API.getMatchInfo = undefined; |
| 407 | var body = document.body; |
| 408 | var i = body.children.length - 1; |
| 409 | while (i >= 0) { |
| 410 | if (body.children[i].nodeType && body.children[i].nodeType === 1) { |
| 411 | if (!body.children[i].classList.contains("jasmine_html-reporter")) { |
| 412 | body.removeChild(body.children[i]); |
| 413 | }; |
| 414 | }; |
| 415 | i--; |
| 416 | }; |
| 417 | }) |
| 418 | |
hebasta | 75cfca5 | 2019-02-19 13:15:27 +0100 | [diff] [blame] | 419 | it('IDs and classes, that are needed for the guided tour should be in existence', function(){ |
hebasta | 87f1b1f | 2019-07-30 13:03:23 +0200 | [diff] [blame] | 420 | //gTstartSearch |
hebasta | 75cfca5 | 2019-02-19 13:15:27 +0100 | [diff] [blame] | 421 | expect(intrkorap.querySelector('#searchbar')).not.toBeNull(); |
| 422 | expect(intrkorap.querySelector('#q-field')).not.toBeNull(); |
hebasta | 0c93d8e | 2019-05-15 12:06:16 +0200 | [diff] [blame] | 423 | expect(intrkorap.querySelector('#hint')).not.toBeNull(); |
| 424 | expect(intrkorap.querySelector('#vc-choose')).not.toBeNull(); |
hebasta | 75cfca5 | 2019-02-19 13:15:27 +0100 | [diff] [blame] | 425 | expect(intrkorap.querySelector('#vc-view')).not.toBeNull(); |
| 426 | expect(intrkorap.querySelector('#ql-field').parentNode).not.toBeNull(); |
Akron | e9e5e83 | 2019-04-02 14:56:23 +0200 | [diff] [blame] | 427 | expect(intrkorap.querySelector('#glimpse')).not.toBeNull(); |
hebasta | 75cfca5 | 2019-02-19 13:15:27 +0100 | [diff] [blame] | 428 | expect(intrkorap.querySelector('#view-tutorial')).not.toBeNull(); |
hebasta | 5df796f | 2019-05-21 15:27:12 +0200 | [diff] [blame] | 429 | expect(intrkorap.querySelector('#qsubmit')).not.toBeNull(); |
hebasta | 94e47cb | 2019-07-24 22:24:27 +0200 | [diff] [blame] | 430 | let show = document.createElement('div'); |
hebasta | d090a51 | 2019-07-10 16:36:01 +0200 | [diff] [blame] | 431 | show.appendChild(vc.element()); |
hebasta | 94e47cb | 2019-07-24 22:24:27 +0200 | [diff] [blame] | 432 | let statbut = show.querySelector('.statistic'); |
| 433 | expect(statbut).not.toBeNull(); |
| 434 | statbut.click(); |
| 435 | expect(show.querySelector('.stattable')).not.toBeNull(); |
hebasta | 87f1b1f | 2019-07-30 13:03:23 +0200 | [diff] [blame] | 436 | //IDs and classes, that are needed for the second guided tour(gTshowResults()) should be in existence, too |
| 437 | expect(resultkor.querySelector('#search')).not.toBeNull(); |
| 438 | expect(resultkor.querySelector('#search > ol > li')).not.toBeNull(); |
| 439 | resultkor.querySelector("#search > ol > li").click(); |
| 440 | expect(resultkor.querySelector('.action > .metatable')).not.toBeNull(); |
| 441 | resultkor.querySelector(".metatable").click(); |
| 442 | expect(resultkor.querySelector('.view.metatable')).not.toBeNull(); |
| 443 | expect(resultkor.querySelector('.action > .info')).not.toBeNull(); |
| 444 | resultkor.querySelector(".info").click(); |
| 445 | expect(resultkor.querySelector('.view.tokentable')).not.toBeNull(); |
| 446 | expect(resultkor.querySelector('.tree')).not.toBeNull(); |
hebasta | 75cfca5 | 2019-02-19 13:15:27 +0100 | [diff] [blame] | 447 | }); |
hebasta | 87f1b1f | 2019-07-30 13:03:23 +0200 | [diff] [blame] | 448 | |
hebasta | 75cfca5 | 2019-02-19 13:15:27 +0100 | [diff] [blame] | 449 | it('Guided Tour should be started and display steps and labels in the right order', function(){ |
hebasta | 94e47cb | 2019-07-24 22:24:27 +0200 | [diff] [blame] | 450 | let vcpanel = intrkorap.getElementById("vc-view"); |
| 451 | vcpanel.appendChild(vc.element()); |
hebasta | 5df796f | 2019-05-21 15:27:12 +0200 | [diff] [blame] | 452 | let searchTour = tourClass.gTstartSearch(intrkorap); |
| 453 | searchTour.start(); |
| 454 | let totalSteps = searchTour.stepCount; |
hebasta | 75cfca5 | 2019-02-19 13:15:27 +0100 | [diff] [blame] | 455 | expect(document.querySelector(".introjs-tooltiptext").textContent).toEqual(loc.TOUR_sear1); |
| 456 | expect(document.querySelector(".introjs-skipbutton").textContent).toEqual(loc.TOUR_lskip); |
| 457 | expect(document.querySelector(".introjs-prevbutton").textContent).toEqual(loc.TOUR_lprev); |
| 458 | expect(document.querySelector(".introjs-nextbutton").textContent).toEqual(loc.TOUR_lnext); |
hebasta | 5df796f | 2019-05-21 15:27:12 +0200 | [diff] [blame] | 459 | searchTour.exit(); |
hebasta | 75cfca5 | 2019-02-19 13:15:27 +0100 | [diff] [blame] | 460 | |
| 461 | for(let i = 2; i <= totalSteps; i++){ |
hebasta | 5df796f | 2019-05-21 15:27:12 +0200 | [diff] [blame] | 462 | searchTour.goToStepNumber(i); |
| 463 | expect(document.querySelector(".introjs-tooltiptext").textContent).toEqual(searchTour.testIntros[i-1]); |
hebasta | 94e47cb | 2019-07-24 22:24:27 +0200 | [diff] [blame] | 464 | |
hebasta | 75cfca5 | 2019-02-19 13:15:27 +0100 | [diff] [blame] | 465 | if(i == totalSteps){ |
hebasta | 5df796f | 2019-05-21 15:27:12 +0200 | [diff] [blame] | 466 | expect(document.querySelector(".introjs-donebutton").textContent).toEqual(loc.TOUR_seargo); |
| 467 | expect(document.querySelector(".introjs-prevbutton").textContent).toEqual(loc.TOUR_lprev); |
| 468 | expect(document.querySelector(".introjs-nextbutton").classList.contains("introjs-disabled")).toBe(true); |
hebasta | 0c93d8e | 2019-05-15 12:06:16 +0200 | [diff] [blame] | 469 | } |
hebasta | 5df796f | 2019-05-21 15:27:12 +0200 | [diff] [blame] | 470 | searchTour.exit(); |
| 471 | } |
| 472 | |
hebasta | 87f1b1f | 2019-07-30 13:03:23 +0200 | [diff] [blame] | 473 | let resultTour = tourClass.gTshowResults(resultkor); |
hebasta | 5df796f | 2019-05-21 15:27:12 +0200 | [diff] [blame] | 474 | KorAP.session = sessionClass.create('KalamarJSDem'); |
hebasta | 87f1b1f | 2019-07-30 13:03:23 +0200 | [diff] [blame] | 475 | resultTour.start(resultkor); |
| 476 | let totalStepsR = resultTour.stepCount; |
| 477 | expect(document.querySelector(".introjs-tooltiptext").textContent).toEqual(loc.TOUR_kwic); |
| 478 | expect(document.querySelector(".introjs-skipbutton").textContent).toEqual(loc.TOUR_lskip); |
| 479 | expect(document.querySelector(".introjs-prevbutton").textContent).toEqual(loc.TOUR_lprev); |
| 480 | expect(document.querySelector(".introjs-nextbutton").textContent).toEqual(loc.TOUR_lnext); |
hebasta | 5df796f | 2019-05-21 15:27:12 +0200 | [diff] [blame] | 481 | resultTour.exit(); |
hebasta | 87f1b1f | 2019-07-30 13:03:23 +0200 | [diff] [blame] | 482 | |
| 483 | for(let i = 2; i <= totalStepsR; i++){ |
| 484 | resultTour.goToStepNumber(i); |
| 485 | expect(document.querySelector(".introjs-tooltiptext").textContent).toEqual(resultTour.testIntros[i-1]); |
| 486 | if(i == totalStepsR){ |
| 487 | expect(document.querySelector(".introjs-donebutton").textContent).toEqual(loc.TOUR_ldone); |
| 488 | } |
| 489 | resultTour.exit(); |
| 490 | } |
| 491 | }); |
hebasta | 75cfca5 | 2019-02-19 13:15:27 +0100 | [diff] [blame] | 492 | }); |
hebasta | 87f1b1f | 2019-07-30 13:03:23 +0200 | [diff] [blame] | 493 | }); |