hebasta | 5e4d754 | 2018-06-19 16:57:36 +0200 | [diff] [blame] | 1 | /** |
| 2 | * Test suite for corpus statistic |
| 3 | * |
| 4 | * @author Helge Stallkamp |
Akron | 18a99c0 | 2018-08-20 12:55:14 +0200 | [diff] [blame] | 5 | * @author Nils Diewald |
hebasta | 5e4d754 | 2018-06-19 16:57:36 +0200 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | |
hebasta | 6c8f09d | 2018-07-24 13:21:36 +0200 | [diff] [blame] | 9 | define(['vc', 'vc/statistic', 'view/corpstatv'], function(vcClass, statClass, corpStatVClass){ |
hebasta | a0282be | 2018-12-05 16:58:00 +0100 | [diff] [blame] | 10 | |
hebasta | 47d03a4 | 2018-06-25 10:31:58 +0200 | [diff] [blame] | 11 | var json = { |
Akron | 18a99c0 | 2018-08-20 12:55:14 +0200 | [diff] [blame] | 12 | "@type":"koral:docGroup", |
| 13 | "operation":"operation:or", |
| 14 | "operands":[ |
| 15 | { |
| 16 | "@type":"koral:docGroup", |
| 17 | "operation":"operation:and", |
| 18 | "operands":[ |
| 19 | { |
| 20 | "@type":"koral:doc", |
| 21 | "key":"title", |
| 22 | "value":"Der Birnbaum", |
| 23 | "match":"match:eq" |
| 24 | }, |
| 25 | { |
| 26 | "@type":"koral:doc", |
| 27 | "key":"pubPlace", |
| 28 | "value":"Mannheim", |
| 29 | "type" : "type:regex", |
| 30 | "match":"match:contains" |
| 31 | }, |
| 32 | { |
| 33 | "@type":"koral:docGroup", |
| 34 | "operation":"operation:or", |
| 35 | "operands":[ |
| 36 | { |
| 37 | "@type":"koral:doc", |
| 38 | "key":"subTitle", |
| 39 | "value":"Aufzucht und Pflege", |
| 40 | "match":"match:eq" |
| 41 | }, |
| 42 | { |
| 43 | "@type":"koral:doc", |
| 44 | "key":"subTitle", |
| 45 | "value":"Gedichte", |
| 46 | "match":"match:eq", |
| 47 | "rewrites" : [ |
| 48 | { |
| 49 | "@type": "koral:rewrite", |
| 50 | "src" : "policy", |
| 51 | "operation" : "operation:injection", |
| 52 | } |
| 53 | ] |
| 54 | } |
| 55 | ] |
| 56 | } |
| 57 | ] |
| 58 | }, |
| 59 | { |
| 60 | "@type":"koral:doc", |
| 61 | "key":"pubDate", |
| 62 | "type":"type:date", |
| 63 | "value":"2015-03-05", |
| 64 | "match":"match:geq" |
| 65 | } |
| 66 | ] |
| 67 | }; |
hebasta | 5e4d754 | 2018-06-19 16:57:36 +0200 | [diff] [blame] | 68 | |
hebasta | 47d03a4 | 2018-06-25 10:31:58 +0200 | [diff] [blame] | 69 | var preDefinedStat={ |
Akron | 18a99c0 | 2018-08-20 12:55:14 +0200 | [diff] [blame] | 70 | "documents":12, |
| 71 | "tokens":2323, |
| 72 | "sentences":343434, |
| 73 | "paragraphs":45454545 |
hebasta | 47d03a4 | 2018-06-25 10:31:58 +0200 | [diff] [blame] | 74 | }; |
| 75 | |
| 76 | KorAP.API.getCorpStat = function(collQu, cb){ |
| 77 | return cb(preDefinedStat); |
Akron | 18a99c0 | 2018-08-20 12:55:14 +0200 | [diff] [blame] | 78 | }; |
| 79 | |
hebasta | a0282be | 2018-12-05 16:58:00 +0100 | [diff] [blame] | 80 | |
| 81 | generateCorpusDocGr = function(){ |
| 82 | let vc = vcClass.create().fromJson({ |
| 83 | "@type" : 'koral:docGroup', |
| 84 | 'operation' : 'operation:or', |
| 85 | 'operands' : [ |
| 86 | { |
| 87 | '@type' : 'koral:doc', |
| 88 | 'key' : 'title', |
| 89 | 'match': 'match:eq', |
| 90 | 'value' : 'Hello World!' |
| 91 | }, |
| 92 | { |
| 93 | '@type' : 'koral:doc', |
| 94 | 'match': 'match:eq', |
| 95 | 'key' : 'foo', |
| 96 | 'value' : 'bar' |
| 97 | } |
| 98 | ] |
| 99 | }); |
| 100 | return vc; |
| 101 | } |
| 102 | |
| 103 | generateCorpusDoc = function(){ |
| 104 | let vc= vcClass.create().fromJson({ |
| 105 | '@type' : 'koral:doc', |
| 106 | 'key' : 'title', |
| 107 | 'match': 'match:eq', |
| 108 | 'value' : 'Hello World!', |
| 109 | 'type' : 'type:string' |
| 110 | }); |
| 111 | return vc; |
| 112 | }; |
| 113 | |
| 114 | |
| 115 | /** |
| 116 | * Generate vc with docgroupref |
| 117 | */ |
| 118 | generateCorpusRef = function(){ |
| 119 | let vc = vcClass.create().fromJson({ |
| 120 | "@type" : "koral:docGroupRef", |
| 121 | "ref" : "@max/myCorpus" |
| 122 | }); |
| 123 | return vc; |
| 124 | }; |
| 125 | |
| 126 | |
| 127 | /** |
| 128 | * Checks is corpus statistic is active |
| 129 | */ |
| 130 | checkStatActive = function(view, div){ |
| 131 | // corpus statistic exists, it is active and reloadStatButton is shown |
| 132 | if ((view.firstChild.classList.contains("stattable") === true) |
| 133 | && (view.firstChild.classList.contains("greyOut") === false) |
| 134 | && (div.getElementsByClassName("reloadStatB").length == 0) ) { |
| 135 | return true; |
| 136 | } |
| 137 | return false; |
| 138 | }; |
| 139 | |
| 140 | |
| 141 | /** |
| 142 | * Checks if corpus statistic is disabled |
| 143 | */ |
| 144 | checkStatDisabled = function(view, div){ |
| 145 | if ((view.firstChild.classList.contains("stattable") === true) |
| 146 | && (view.firstChild.classList.contains("greyOut") === true) |
| 147 | && (div.getElementsByClassName("reloadStatB").length === 1) ) { |
| 148 | return true; |
| 149 | } |
| 150 | return false; |
| 151 | }; |
| 152 | |
| 153 | |
| 154 | describe('KorAP.CorpusStat', function(){ |
hebasta | 47d03a4 | 2018-06-25 10:31:58 +0200 | [diff] [blame] | 155 | |
hebasta | 5e4d754 | 2018-06-19 16:57:36 +0200 | [diff] [blame] | 156 | it('should be initiable', function(){ |
Akron | 18a99c0 | 2018-08-20 12:55:14 +0200 | [diff] [blame] | 157 | var stat = statClass.create(preDefinedStat); |
hebasta | 5e4d754 | 2018-06-19 16:57:36 +0200 | [diff] [blame] | 158 | expect( function() { statClass.create() }).toThrow(new Error("Missing parameter")); |
| 159 | }); |
| 160 | |
| 161 | |
Akron | 18a99c0 | 2018-08-20 12:55:14 +0200 | [diff] [blame] | 162 | it('should be parsed in a statistic view and displayed as HTML Description List', function(){ |
| 163 | var stat = statClass.create(preDefinedStat); |
hebasta | a0282be | 2018-12-05 16:58:00 +0100 | [diff] [blame] | 164 | var descL = stat.element(); |
hebasta | 5e4d754 | 2018-06-19 16:57:36 +0200 | [diff] [blame] | 165 | expect(descL.tagName).toEqual('DL'); |
| 166 | expect(descL.children[0].tagName).toEqual('DIV'); |
| 167 | expect(descL.children[0].children[0].tagName).toEqual('DT'); |
| 168 | expect(descL.children[0].children[0].attributes[0].name).toEqual('title'); |
| 169 | expect(descL.children[0].children[1].tagName).toEqual('DD'); |
Akron | 18a99c0 | 2018-08-20 12:55:14 +0200 | [diff] [blame] | 170 | |
hebasta | 5e4d754 | 2018-06-19 16:57:36 +0200 | [diff] [blame] | 171 | expect(descL.children[0].children[0].firstChild.nodeValue).toEqual('documents'); |
| 172 | expect(descL.children[0].children[1].firstChild.nodeValue).toEqual('12'); |
| 173 | expect(descL.children[0].children[0].attributes[0].value).toEqual('documents'); |
Akron | 2f97912 | 2018-07-25 17:00:23 +0200 | [diff] [blame] | 174 | |
| 175 | expect(descL.children[1].children[0].firstChild.nodeValue).toEqual('tokens'); |
| 176 | expect(descL.children[1].children[1].firstChild.nodeValue).toEqual(new Number(2323).toLocaleString()); |
| 177 | expect(descL.children[1].children[0].attributes[0].value).toEqual('tokens'); |
| 178 | }); |
hebasta | 5e4d754 | 2018-06-19 16:57:36 +0200 | [diff] [blame] | 179 | |
hebasta | 47d03a4 | 2018-06-25 10:31:58 +0200 | [diff] [blame] | 180 | |
hebasta | 6c8f09d | 2018-07-24 13:21:36 +0200 | [diff] [blame] | 181 | it('should display corpus statistic after creating a corpus statistic view', function(){ |
Akron | 18a99c0 | 2018-08-20 12:55:14 +0200 | [diff] [blame] | 182 | var vc = vcClass.create([ |
| 183 | ['title', 'string'], |
| 184 | ['subTitle', 'string'], |
| 185 | ['pubDate', 'date'], |
| 186 | ['author', 'text'] |
| 187 | ]).fromJson(json); |
| 188 | |
hebasta | a0282be | 2018-12-05 16:58:00 +0100 | [diff] [blame] | 189 | KorAP.vc = vc; |
| 190 | |
Akron | 18a99c0 | 2018-08-20 12:55:14 +0200 | [diff] [blame] | 191 | statView = corpStatVClass.create(vc); |
hebasta | a0282be | 2018-12-05 16:58:00 +0100 | [diff] [blame] | 192 | // corpStatVClass.show(vc); |
Akron | 18a99c0 | 2018-08-20 12:55:14 +0200 | [diff] [blame] | 193 | |
hebasta | 47d03a4 | 2018-06-25 10:31:58 +0200 | [diff] [blame] | 194 | var testDiv = document.createElement('div'); |
hebasta | 6c8f09d | 2018-07-24 13:21:36 +0200 | [diff] [blame] | 195 | testDiv.appendChild(statView.show()); |
hebasta | a0282be | 2018-12-05 16:58:00 +0100 | [diff] [blame] | 196 | // statClass.showCorpStat(testDiv, vc); |
hebasta | 47d03a4 | 2018-06-25 10:31:58 +0200 | [diff] [blame] | 197 | |
| 198 | expect(testDiv.children[0].tagName).toEqual('DIV'); |
| 199 | expect(testDiv.children[0].getAttribute("class")).toEqual('stattable'); |
| 200 | expect(testDiv.children[0].children[0].tagName).toEqual('DL'); |
| 201 | expect(testDiv.children[0].children[0].children[0].children[0].firstChild.nodeValue).toEqual('documents'); |
| 202 | expect(testDiv.children[0].children[0].children[0].children[1].firstChild.nodeValue).toEqual('12'); |
hebasta | 47d03a4 | 2018-06-25 10:31:58 +0200 | [diff] [blame] | 203 | }); |
Akron | 18a99c0 | 2018-08-20 12:55:14 +0200 | [diff] [blame] | 204 | |
| 205 | it('should display the statistics button in a panel', function () { |
| 206 | var vc = vcClass.create([ |
| 207 | ['title', 'string'], |
| 208 | ['subTitle', 'string'], |
| 209 | ['pubDate', 'date'], |
| 210 | ['author', 'text'] |
| 211 | ]).fromJson(json); |
| 212 | |
| 213 | var show = document.createElement('div'); |
| 214 | |
| 215 | show.appendChild(vc.element()); |
| 216 | |
| 217 | var panel = show.firstChild.lastChild.firstChild; |
| 218 | expect(panel.classList.contains('panel')).toBeTruthy(); |
| 219 | expect(panel.classList.contains('vcinfo')).toBeTruthy(); |
| 220 | expect(panel.lastChild.classList.contains('button-group')).toBeTruthy(); |
| 221 | expect(panel.lastChild.classList.contains('vcinfo')).toBeTruthy(); |
| 222 | expect(panel.lastChild.children[0].tagName).toEqual('SPAN'); |
| 223 | expect(panel.lastChild.children[0].textContent).toEqual('Statistics'); |
| 224 | }); |
| 225 | |
| 226 | |
| 227 | it('should display the statistics button in a panel after VC modification', function () { |
| 228 | |
| 229 | var vc = vcClass.create([ |
| 230 | ['title', 'string'], |
| 231 | ['subTitle', 'string'], |
| 232 | ['pubDate', 'date'], |
| 233 | ['author', 'text'] |
| 234 | ]).fromJson(json); |
| 235 | |
| 236 | var show = document.createElement('div'); |
| 237 | |
| 238 | show.appendChild(vc.element()); |
| 239 | |
| 240 | expect(show.querySelector(".statistic").tagName).toEqual("SPAN"); |
| 241 | |
Akron | adab5e5 | 2018-08-20 13:50:53 +0200 | [diff] [blame] | 242 | var and = vc.builder().lastChild.firstChild; |
Akron | 18a99c0 | 2018-08-20 12:55:14 +0200 | [diff] [blame] | 243 | |
| 244 | // Click on and() in VC |
| 245 | and.click(); |
| 246 | |
| 247 | // Check that statistics is there |
| 248 | expect(show.querySelector(".statistic").tagName).toEqual("SPAN"); |
| 249 | }); |
| 250 | |
| 251 | |
| 252 | it('should display and hide corpus statistics view in the panel', function () { |
| 253 | |
| 254 | var vc = vcClass.create([ |
| 255 | ['title', 'string'], |
| 256 | ['subTitle', 'string'], |
| 257 | ['pubDate', 'date'], |
| 258 | ['author', 'text'] |
| 259 | ]).fromJson(json); |
| 260 | |
| 261 | var show = document.createElement('div'); |
| 262 | |
| 263 | show.appendChild(vc.element()); |
| 264 | |
| 265 | var panel = show.firstChild.lastChild.firstChild; |
| 266 | |
| 267 | // Show statistics |
| 268 | panel.lastChild.children[0].click(); |
| 269 | |
| 270 | // Statistics view |
| 271 | var viewE = panel.firstChild.firstChild; |
| 272 | |
| 273 | expect(viewE.tagName).toEqual("DIV"); |
| 274 | expect(viewE.classList.contains("view")).toBeTruthy(); |
| 275 | expect(viewE.classList.contains("vcstatistic")).toBeTruthy(); |
| 276 | |
| 277 | expect(viewE.firstChild.classList.contains("stattable")).toBeTruthy(); |
| 278 | expect(viewE.firstChild.firstChild.tagName).toEqual("DL"); |
| 279 | |
| 280 | // List of statistic values |
| 281 | var dl = viewE.firstChild.firstChild.firstChild; |
| 282 | expect(dl.firstChild.tagName).toEqual("DT"); |
| 283 | expect(dl.firstChild.textContent).toEqual("documents"); |
| 284 | expect(dl.lastChild.tagName).toEqual("DD"); |
| 285 | expect(dl.lastChild.textContent).toEqual("12"); |
| 286 | |
| 287 | expect(viewE.children.length).toEqual(2); |
| 288 | |
| 289 | expect(viewE.lastChild.classList.contains("button-group")).toBeTruthy(); |
| 290 | expect(viewE.lastChild.children.length).toEqual(1); |
| 291 | expect(viewE.lastChild.firstChild.tagName).toEqual("SPAN"); |
| 292 | expect(viewE.lastChild.firstChild.textContent).toEqual("Close"); |
| 293 | |
| 294 | // Close view |
| 295 | viewE.lastChild.firstChild.firstChild.click(); |
| 296 | |
| 297 | // Is gone |
| 298 | expect(panel.firstChild.children.length).toEqual(0); |
| 299 | |
| 300 | // Show statistics |
| 301 | panel.lastChild.children[0].click(); |
| 302 | |
| 303 | // Is there |
| 304 | expect(panel.firstChild.children.length).toEqual(1); |
| 305 | |
| 306 | // Only show once |
| 307 | panel.lastChild.children[0].click(); |
| 308 | expect(panel.firstChild.children.length).toEqual(1); |
| 309 | }); |
hebasta | a0282be | 2018-12-05 16:58:00 +0100 | [diff] [blame] | 310 | |
| 311 | |
| 312 | }); |
| 313 | |
| 314 | |
| 315 | |
| 316 | /** |
| 317 | * Test disabling and reload of corpus statistic if vc is changed |
| 318 | * in vc builder through user-interaction |
| 319 | */ |
| 320 | describe ('KorAP.CorpusStat.Disable', function(){ |
| 321 | |
| 322 | /** |
| 323 | * If the user defines a new vc, the statistic should be disabled, |
| 324 | * because it is out-of-date. |
| 325 | * |
| 326 | * The user can choose to display an up-to-date corpus statistic. Here it is tested |
| 327 | * if corpus statistic is disabled after a valid change of corpus statistic and if the corpus statistic is updatable. |
| 328 | */ |
| 329 | it ('should disable the corpus statistic if corpus definition is changed and display a functional reload button', function(){ |
| 330 | |
| 331 | KorAP.vc = generateCorpusDocGr(); |
| 332 | |
| 333 | //Show corpus statistic |
| 334 | let show = document.createElement('div'); |
| 335 | show.appendChild(KorAP.vc.element()); |
| 336 | let panel = show.firstChild.lastChild.firstChild; |
| 337 | panel.lastChild.children[0].click(); |
| 338 | let view = panel.firstChild.firstChild; |
| 339 | |
| 340 | //corpus statistic is active |
| 341 | expect(checkStatActive(view, show)).toBe(true); |
| 342 | |
| 343 | //change vc, a line in vc builder is deleted |
| 344 | KorAP._delete.apply(KorAP.vc.root().getOperand(0)); |
| 345 | expect(checkStatDisabled(view,show)).toBe(true); |
| 346 | |
| 347 | //click at reload button |
| 348 | let rlbutton = show.getElementsByClassName("refresh").item(0); |
| 349 | rlbutton.click(); |
| 350 | |
| 351 | expect(checkStatActive(view,show)).toBe(true); |
| 352 | }); |
| 353 | |
| 354 | |
| 355 | it('should disable corpus statistic if entries in vc builder are deleted', function(){ |
| 356 | KorAP.vc = generateCorpusDocGr(); |
| 357 | |
| 358 | // create corpus builder and corpus statistic; |
| 359 | let show = document.createElement('div'); |
| 360 | show.appendChild(KorAP.vc.element()); |
| 361 | let panel = show.firstChild.lastChild.firstChild; |
| 362 | panel.lastChild.children[0].click(); |
| 363 | let view = panel.firstChild.firstChild; |
| 364 | |
| 365 | expect(checkStatActive(view, show)).toBe(true); |
| 366 | |
| 367 | //delete foo=bar |
| 368 | KorAP._delete.apply(KorAP.vc.root().getOperand(1)); |
| 369 | expect(checkStatDisabled(view, show)).toBe(true); |
| 370 | |
| 371 | //refresh corpus statistic |
| 372 | let rlbutton = show.getElementsByClassName("refresh").item(0); |
| 373 | rlbutton.click(); |
| 374 | expect(checkStatActive(view,show)).toBe(true); |
| 375 | |
| 376 | KorAP._delete.apply(KorAP.vc.root()); |
| 377 | // fails momentarily, does not fail after next commit with Change-Id: Id44736f134c00e1a1be002bf14e00e6efa26ad02 |
| 378 | //expect(checkStatDisabled(view, show)).toBe(true); |
| 379 | }); |
| 380 | |
| 381 | |
| 382 | it('should disable corpus statistic if key, matchoperator or value is changed', function(){ |
| 383 | /* |
| 384 | * Doc change of key, match operator and value |
| 385 | */ |
| 386 | KorAP.vc= generateCorpusDoc(); |
| 387 | // show vc builder and open corpus statistic |
| 388 | let show = document.createElement('div'); |
| 389 | show.appendChild(KorAP.vc.element()); |
| 390 | let panel = show.firstChild.lastChild.firstChild; |
| 391 | panel.lastChild.children[0].click(); |
| 392 | let view = panel.firstChild.firstChild; |
| 393 | expect(checkStatActive(view, show)).toBe(true); |
| 394 | |
| 395 | KorAP.vc.root().matchop("ne").update(); |
| 396 | expect(checkStatDisabled(view, show)).toBe(true); |
| 397 | |
| 398 | let rlbutton = show.getElementsByClassName("refresh").item(0); |
| 399 | rlbutton.click(); |
| 400 | |
| 401 | view = panel.firstChild.firstChild; |
| 402 | expect(checkStatActive(view, show)).toBe(true); |
| 403 | KorAP.vc.root().value("Hello tester").update(); |
| 404 | expect(checkStatDisabled(view, show)).toBe(true); |
| 405 | |
| 406 | //refresh corpus statistic |
| 407 | rlbutton = show.getElementsByClassName("refresh").item(0); |
| 408 | rlbutton.click(); |
| 409 | view = panel.firstChild.firstChild; |
| 410 | expect(checkStatActive(view, show)).toBe(true); |
| 411 | |
| 412 | KorAP.vc.root().key("author").update(); |
| 413 | expect(checkStatDisabled(view, show)).toBe(true); |
| 414 | |
| 415 | |
| 416 | /* |
| 417 | * DocGroupRef change of value... |
| 418 | */ |
| 419 | KorAP.vc = generateCorpusRef(); |
| 420 | show = document.createElement('div'); |
| 421 | show.appendChild(KorAP.vc.element()); |
| 422 | panel = show.firstChild.lastChild.firstChild; |
| 423 | panel.lastChild.children[0].click(); |
| 424 | view = panel.firstChild.firstChild; |
| 425 | expect(checkStatActive(view, show)).toBe(true); |
| 426 | |
| 427 | KorAP.vc.root().ref("@anton/secondCorpus").update(); |
| 428 | expect(checkStatDisabled(view, show)).toBe(true); |
| 429 | }); |
| 430 | |
| 431 | |
| 432 | it('should not disable corpus statistic if docgroup definition is incomplete', function(){ |
| 433 | |
| 434 | KorAP.vc = generateCorpusDocGr(); |
| 435 | |
| 436 | //Show corpus statistic |
| 437 | let show = document.createElement('div'); |
| 438 | show.appendChild(KorAP.vc.element()); |
| 439 | let panel = show.firstChild.lastChild.firstChild; |
| 440 | panel.lastChild.children[0].click(); |
| 441 | let view = panel.firstChild.firstChild; |
| 442 | |
| 443 | expect(checkStatActive(view, show)).toBe(true); |
| 444 | |
| 445 | KorAP._and.apply(KorAP.vc.root()); |
| 446 | |
| 447 | let andbuild = show.getElementsByClassName("builder"); |
| 448 | expect(andbuild[0].firstChild.classList.contains('docGroup')).toBeTruthy(); |
| 449 | expect(andbuild[0].firstChild.getAttribute("data-operation")).toEqual("and"); |
| 450 | expect(checkStatActive(view, show)).toBe(true); |
| 451 | }); |
| 452 | |
| 453 | |
| 454 | it('should not disable corpus statistic if doc/docref definition is incomplete', function(){ |
| 455 | |
| 456 | /* |
| 457 | * DOC incomplete |
| 458 | */ |
| 459 | KorAP.vc = vcClass.create().fromJson(); |
| 460 | expect(KorAP.vc.builder().firstChild.classList.contains('unspecified')).toBeTruthy(); |
| 461 | |
| 462 | // show vc builder and open corpus statistic |
| 463 | let show = document.createElement('div'); |
| 464 | show.appendChild(KorAP.vc.element()); |
| 465 | let panel = show.firstChild.lastChild.firstChild; |
| 466 | panel.lastChild.children[0].click(); |
| 467 | let view = panel.firstChild.firstChild; |
| 468 | |
| 469 | // corpus statistic should be shown and be up-to-date, reload button is not shown |
| 470 | expect(checkStatActive(view, show)).toBe(true); |
| 471 | |
| 472 | // open the menu |
| 473 | KorAP.vc.builder().firstChild.firstChild.click(); |
| 474 | KorAP._vcKeyMenu._prefix.add("author"); |
| 475 | let prefElement = KorAP.vc.builder().querySelector('span.pref'); |
| 476 | // add key 'author' to VC |
| 477 | prefElement.click(); |
| 478 | |
| 479 | expect(checkStatActive(view, show)).toBe(true); |
| 480 | |
| 481 | |
| 482 | /* |
| 483 | * DOCREF incomplete |
| 484 | */ |
| 485 | KorAP.vc = vcClass.create().fromJson(); |
| 486 | expect(KorAP.vc.builder().firstChild.classList.contains('unspecified')).toBeTruthy(); |
| 487 | |
| 488 | // show vc builder and open corpus statistic |
| 489 | show = document.createElement('div'); |
| 490 | show.appendChild(KorAP.vc.element()); |
| 491 | panel = show.firstChild.lastChild.firstChild; |
| 492 | panel.lastChild.children[0].click(); |
| 493 | view = panel.firstChild.firstChild; |
| 494 | expect(checkStatActive(view, show)).toBe(true); |
| 495 | |
| 496 | KorAP.vc.builder().firstChild.firstChild.click(); |
| 497 | KorAP._vcKeyMenu._prefix.add("referTo"); |
| 498 | prefElement = KorAP.vc.builder().querySelector('span.pref'); |
| 499 | prefElement.click(); |
| 500 | expect(checkStatActive(view, show)).toBe(true); |
| 501 | }); |
| 502 | }); |
hebasta | 5e4d754 | 2018-06-19 16:57:36 +0200 | [diff] [blame] | 503 | }); |