Nils Diewald | a297f06 | 2015-04-02 00:23:46 +0000 | [diff] [blame] | 1 | var available = [ |
| 2 | 'base/s=spans', |
| 3 | 'corenlp/c=spans', |
| 4 | 'corenlp/ne=tokens', |
| 5 | 'corenlp/p=tokens', |
| 6 | 'corenlp/s=spans', |
| 7 | 'glemm/l=tokens', |
| 8 | 'mate/l=tokens', |
| 9 | 'mate/m=tokens', |
| 10 | 'mate/p=tokens', |
| 11 | 'opennlp/p=tokens', |
| 12 | 'opennlp/s=spans', |
| 13 | 'tt/l=tokens', |
| 14 | 'tt/p=tokens', |
| 15 | 'tt/s=spans' |
| 16 | ]; |
| 17 | |
| 18 | var match = { |
| 19 | 'corpusID' : 'WPD', |
| 20 | 'docID' : 'UUU', |
| 21 | 'textID' : '01912', |
| 22 | 'matchID' : 'p121-122', |
| 23 | 'available' : available |
| 24 | }; |
| 25 | |
| 26 | var snippet = "<span title=\"cnx/l:meist\">" + |
| 27 | " <span title=\"cnx/p:ADV\">" + |
| 28 | " <span title=\"cnx/syn:@PREMOD\">" + |
| 29 | " <span title=\"mate/l:meist\">" + |
| 30 | " <span title=\"mate/p:ADV\">" + |
| 31 | " <span title=\"opennlp/p:ADV\">meist</span>" + |
| 32 | " </span>" + |
| 33 | " </span>" + |
| 34 | " </span>" + |
| 35 | " </span>" + |
| 36 | "</span>" + |
| 37 | "<span title=\"cnx/l:deutlich\">" + |
| 38 | " <span title=\"cnx/p:A\">" + |
| 39 | " <span title=\"cnx/syn:@PREMOD\">" + |
| 40 | " <span title=\"mate/l:deutlich\">" + |
| 41 | " <span title=\"mate/m:degree:pos\">" + |
| 42 | " <span title=\"mate/p:ADJD\">" + |
| 43 | " <span title=\"opennlp/p:ADJD\">deutlich</span>" + |
| 44 | " </span>" + |
| 45 | " </span>" + |
| 46 | " </span>" + |
| 47 | " </span>" + |
| 48 | " </span>" + |
| 49 | "</span>" + |
| 50 | "<span title=\"cnx/l:fähig\">" + |
| 51 | " <span title=\"cnx/l:leistung\">" + |
| 52 | " <span title=\"cnx/p:A\">" + |
| 53 | " <span title=\"cnx/syn:@NH\">" + |
| 54 | " <span title=\"mate/l:leistungsfähig\">" + |
| 55 | " <span title=\"mate/m:degree:comp\">" + |
| 56 | " <span title=\"mate/p:ADJD\">" + |
| 57 | " <span title=\"opennlp/p:ADJD\">leistungsfähiger</span>" + |
| 58 | " </span>" + |
| 59 | " </span>" + |
| 60 | " </span>" + |
| 61 | " </span>" + |
| 62 | " </span>" + |
| 63 | " </span>" + |
| 64 | "</span>"; |
| 65 | |
| 66 | var treeSnippet = |
| 67 | "<span class=\"context-left\"></span>" + |
| 68 | "<span class=\"match\">" + |
| 69 | " <span title=\"xip/c:MC\">" + |
| 70 | " <span title=\"xip/c:TOP\">" + |
| 71 | " <span title=\"xip/c:PP\">" + |
| 72 | " <span title=\"xip/c:PREP\">Mit</span>" + |
| 73 | " <span title=\"xip/c:NP\">" + |
| 74 | " <span title=\"xip/c:DET\">dieser</span>" + |
| 75 | " <span title=\"xip/c:NPA\">" + |
| 76 | " <span title=\"xip/c:NOUN\">Methode</span>" + |
| 77 | " </span>" + |
| 78 | " </span>" + |
| 79 | " </span>" + |
| 80 | " <span title=\"xip/c:VERB\">ist</span>" + |
| 81 | " <span title=\"xip/c:NP\">" + |
| 82 | " <span title=\"xip/c:PRON\">es</span>" + |
| 83 | " </span>" + |
| 84 | " <span title=\"xip/c:AP\">" + |
| 85 | " <span title=\"xip/c:ADV\">nun</span>" + |
| 86 | " <span title=\"xip/c:ADJ\">möglich</span>" + |
| 87 | " </span>" + |
| 88 | " <span title=\"xip/c:ADV\">z. B.</span>" + |
| 89 | " <span title=\"xip/c:NPA\">" + |
| 90 | " <span title=\"xip/c:NP\">" + |
| 91 | " <span title=\"xip/c:NOUN\">Voice</span>" + |
| 92 | " </span>" + |
| 93 | " </span>" + "(" + |
| 94 | " <span title=\"xip/c:INS\">" + |
| 95 | " <span title=\"xip/c:NPA\">" + |
| 96 | " <span title=\"xip/c:NP\">" + |
| 97 | " <span title=\"xip/c:NOUN\">Sprache</span>" + |
| 98 | " </span>" + |
| 99 | " </span>" + |
| 100 | " </span>" + ")" + |
| 101 | " <span title=\"xip/c:VERB\">bevorzugt</span>" + |
| 102 | " <span title=\"xip/c:PP\">" + |
| 103 | " <span title=\"xip/c:PREP\">in</span>" + |
| 104 | " <span title=\"xip/c:NP\">" + |
| 105 | " <span title=\"xip/c:PRON\">der</span>" + |
| 106 | " </span>" + |
| 107 | " <span title=\"xip/c:NPA\">" + |
| 108 | " <span title=\"xip/c:NP\">" + |
| 109 | " <span title=\"xip/c:NOUN\">Bridge</span>" + |
| 110 | " </span>" + |
| 111 | " </span>" + |
| 112 | " </span>" + |
| 113 | " <span title=\"xip/c:INFC\">" + |
| 114 | " <span title=\"xip/c:INS\">" + |
| 115 | " <span title=\"xip/c:VERB\">weiterzugeben</span>" + |
| 116 | " </span>" + |
| 117 | " </span>" + |
| 118 | " </span>" + |
| 119 | " </span>" + |
| 120 | "</span>" + |
| 121 | "<span class=\"context-right\"></span>"; |
| 122 | |
| 123 | |
| 124 | function matchElementFactory () { |
| 125 | var me = document.createElement('li'); |
| 126 | |
| 127 | me.setAttribute( |
| 128 | 'data-available-info', |
| 129 | 'base/s=spans corenlp/c=spans corenlp/ne=tokens corenlp/p=tokens' + |
| 130 | ' corenlp/s=spans glemm/l=tokens mate/l=tokens mate/m=tokens' + |
| 131 | ' mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens' + |
| 132 | ' tt/p=tokens tt/s=spans'); |
| 133 | |
| 134 | me.setAttribute('data-corpus-id', 'WPD'); |
| 135 | me.setAttribute('data-doc-id', 'FFF'); |
| 136 | me.setAttribute('data-text-id', '01460'); |
| 137 | me.setAttribute('data-match-id', 'p119-120'); |
| 138 | me.innerHTML = '<div><div class="snippet">check</div></div><p class="ref">me</p>'; |
| 139 | return me; |
| 140 | }; |
| 141 | |
| 142 | |
| 143 | describe('KorAP.InfoLayer', function () { |
| 144 | |
| 145 | it('should be initializable', function () { |
| 146 | expect( |
| 147 | function() { KorAP.InfoLayer.create() } |
| 148 | ).toThrow(new Error("Missing parameters")); |
| 149 | |
| 150 | expect( |
| 151 | function() { KorAP.InfoLayer.create("base") } |
| 152 | ).toThrow(new Error("Missing parameters")); |
| 153 | |
| 154 | var layer = KorAP.InfoLayer.create("base", "s"); |
| 155 | expect(layer).toBeTruthy(); |
| 156 | expect(layer.foundry).toEqual("base"); |
| 157 | expect(layer.layer).toEqual("s"); |
| 158 | expect(layer.type).toEqual("tokens"); |
| 159 | |
| 160 | layer = KorAP.InfoLayer.create("cnx", "syn", "spans"); |
| 161 | expect(layer).toBeTruthy(); |
| 162 | expect(layer.foundry).toEqual("cnx"); |
| 163 | expect(layer.layer).toEqual("syn"); |
| 164 | expect(layer.type).toEqual("spans"); |
| 165 | }); |
| 166 | }); |
| 167 | |
| 168 | |
| 169 | describe('KorAP.Match', function () { |
| 170 | var match = { |
| 171 | 'corpusID' : 'WPD', |
| 172 | 'docID' : 'UUU', |
| 173 | 'textID' : '01912', |
| 174 | 'matchID' : 'p121-122', |
| 175 | 'available' : available |
| 176 | }; |
| 177 | |
| 178 | it('should be initializable by Object', function () { |
| 179 | expect(function() { |
| 180 | KorAP.Match.create() |
| 181 | }).toThrow(new Error('Missing parameters')); |
| 182 | |
| 183 | expect(KorAP.Match.create(match)).toBeTruthy(); |
| 184 | |
| 185 | var m = KorAP.Match.create(match); |
| 186 | expect(m.corpusID).toEqual("WPD"); |
| 187 | expect(m.docID).toEqual("UUU"); |
| 188 | expect(m.textID).toEqual("01912"); |
| 189 | expect(m.matchID).toEqual("p121-122"); |
| 190 | |
| 191 | // /corpus/WPD/UUU.01912/p121-122/matchInfo?spans=false&foundry=* |
| 192 | var m = KorAP.Match.create(match); |
| 193 | |
| 194 | // Spans: |
| 195 | var spans = m.getSpans(); |
| 196 | expect(spans[0].foundry).toEqual("base"); |
| 197 | expect(spans[0].layer).toEqual("s"); |
| 198 | |
| 199 | expect(spans[1].foundry).toEqual("corenlp"); |
| 200 | expect(spans[1].layer).toEqual("c"); |
| 201 | |
| 202 | expect(spans[2].foundry).toEqual("corenlp"); |
| 203 | expect(spans[2].layer).toEqual("s"); |
| 204 | |
| 205 | expect(spans[spans.length-1].foundry).toEqual("tt"); |
| 206 | expect(spans[spans.length-1].layer).toEqual("s"); |
| 207 | |
| 208 | // Tokens: |
| 209 | var tokens = m.getTokens(); |
| 210 | expect(tokens[0].foundry).toEqual("corenlp"); |
| 211 | expect(tokens[0].layer).toEqual("ne"); |
| 212 | |
| 213 | expect(tokens[1].foundry).toEqual("corenlp"); |
| 214 | expect(tokens[1].layer).toEqual("p"); |
| 215 | |
| 216 | expect(tokens[tokens.length-1].foundry).toEqual("tt"); |
| 217 | expect(tokens[tokens.length-1].layer).toEqual("p"); |
| 218 | }); |
| 219 | |
| 220 | |
| 221 | it('should be initializable by Node', function () { |
| 222 | var m = KorAP.Match.create(matchElementFactory()); |
| 223 | expect(m.corpusID).toEqual("WPD"); |
| 224 | expect(m.docID).toEqual("FFF"); |
| 225 | expect(m.textID).toEqual("01460"); |
| 226 | expect(m.matchID).toEqual("p119-120"); |
| 227 | |
| 228 | // Spans: |
| 229 | var spans = m.getSpans(); |
| 230 | expect(spans[0].foundry).toEqual("base"); |
| 231 | expect(spans[0].layer).toEqual("s"); |
| 232 | |
| 233 | expect(spans[1].foundry).toEqual("corenlp"); |
| 234 | expect(spans[1].layer).toEqual("c"); |
| 235 | |
| 236 | expect(spans[2].foundry).toEqual("corenlp"); |
| 237 | expect(spans[2].layer).toEqual("s"); |
| 238 | |
| 239 | expect(spans[spans.length-1].foundry).toEqual("tt"); |
| 240 | expect(spans[spans.length-1].layer).toEqual("s"); |
| 241 | |
| 242 | // Tokens: |
| 243 | var tokens = m.getTokens(); |
| 244 | expect(tokens[0].foundry).toEqual("corenlp"); |
| 245 | expect(tokens[0].layer).toEqual("ne"); |
| 246 | |
| 247 | expect(tokens[1].foundry).toEqual("corenlp"); |
| 248 | expect(tokens[1].layer).toEqual("p"); |
| 249 | |
| 250 | expect(tokens[tokens.length-1].foundry).toEqual("tt"); |
| 251 | expect(tokens[tokens.length-1].layer).toEqual("p"); |
| 252 | |
| 253 | }); |
| 254 | |
| 255 | it('should react to gui actions', function () { |
| 256 | var e = matchElementFactory(); |
| 257 | |
| 258 | expect(e.classList.contains('active')).toBe(false); |
| 259 | expect(e["_match"]).toBe(undefined); |
| 260 | |
| 261 | var m = KorAP.Match.create(e); |
| 262 | |
| 263 | expect(e.classList.contains('active')).toBe(false); |
| 264 | expect(e["_match"]).not.toBe(undefined); |
| 265 | |
| 266 | // Open the match |
| 267 | m.open(); |
| 268 | |
| 269 | expect(e.classList.contains('active')).toBe(true); |
| 270 | expect(e["_match"]).not.toBe(undefined); |
| 271 | |
| 272 | // Close the match |
| 273 | m.close(); |
| 274 | expect(e.classList.contains('active')).toBe(false); |
| 275 | expect(e["_match"]).not.toBe(undefined); |
| 276 | |
| 277 | }); |
| 278 | }); |
| 279 | |
| 280 | |
| 281 | describe('KorAP.MatchInfo', function () { |
| 282 | it('should parse into a table', function () { |
| 283 | |
| 284 | var m = KorAP.Match.create(match); |
| 285 | var info = m.info(); |
| 286 | expect(m._info).toEqual(info); |
| 287 | |
| 288 | expect(info.getTable('base/s')).not.toBeTruthy(); |
| 289 | |
| 290 | // Override getMatchInfo API call |
| 291 | KorAP.API.getMatchInfo = function () { |
| 292 | return { "snippet": snippet }; |
| 293 | }; |
| 294 | |
| 295 | var table = info.getTable(); |
| 296 | expect(table).toBeTruthy(); |
| 297 | |
| 298 | expect(table.length()).toBe(3); |
| 299 | |
| 300 | expect(table.getToken(0)).toBe("meist"); |
| 301 | expect(table.getToken(1)).toBe("deutlich"); |
| 302 | expect(table.getToken(2)).toBe("leistungsfähiger"); |
| 303 | |
| 304 | expect(table.getValue(0, "cnx", "p")[0]).toBe("ADV"); |
| 305 | expect(table.getValue(0, "cnx", "syn")[0]).toBe("@PREMOD"); |
| 306 | |
| 307 | expect(table.getValue(2, "cnx", "l")[0]).toBe("fähig"); |
| 308 | expect(table.getValue(2, "cnx", "l")[1]).toBe("leistung"); |
| 309 | }); |
| 310 | |
| 311 | |
| 312 | it('should parse into a table view', function () { |
| 313 | var matchElement = matchElementFactory(); |
| 314 | expect(matchElement.tagName).toEqual('LI'); |
| 315 | |
| 316 | // Match |
| 317 | expect(matchElement.children[0].tagName).toEqual('DIV'); |
| 318 | |
| 319 | // snippet |
| 320 | expect(matchElement.children[0].children[0].tagName).toEqual('DIV'); |
| 321 | expect(matchElement.children[0].children[0].classList.contains('snippet')).toBeTruthy(); |
| 322 | expect(matchElement.children[0].children[0].firstChild.nodeValue).toEqual('check'); |
| 323 | |
| 324 | // reference |
| 325 | expect(matchElement.children[1].classList.contains('ref')).toBeTruthy(); |
| 326 | expect(matchElement.children[1].firstChild.nodeValue).toEqual('me'); |
| 327 | |
| 328 | // not yet |
| 329 | expect(matchElement.children[0].children[1]).toBe(undefined); |
| 330 | |
| 331 | var info = KorAP.Match.create(matchElement).info(); |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame^] | 332 | info.toggle(); |
Nils Diewald | a297f06 | 2015-04-02 00:23:46 +0000 | [diff] [blame] | 333 | |
| 334 | // Match |
| 335 | expect(matchElement.children[0].tagName).toEqual('DIV'); |
| 336 | |
| 337 | // snippet |
| 338 | expect(matchElement.children[0].children[0].tagName).toEqual('DIV'); |
| 339 | expect(matchElement.children[0].children[0].classList.contains('snippet')).toBeTruthy(); |
| 340 | expect(matchElement.children[0].children[0].firstChild.nodeValue).toEqual('check'); |
| 341 | |
| 342 | // reference |
| 343 | expect(matchElement.children[1].classList.contains('ref')).toBeTruthy(); |
| 344 | expect(matchElement.children[1].firstChild.nodeValue).toEqual('me'); |
| 345 | |
| 346 | // now |
| 347 | var infotable = matchElement.children[0].children[1]; |
| 348 | expect(infotable.tagName).toEqual('DIV'); |
| 349 | expect(infotable.classList.contains('matchinfo')).toBeTruthy(); |
| 350 | |
| 351 | expect(infotable.children[0].classList.contains('matchtable')).toBeTruthy(); |
| 352 | expect(infotable.children[1].classList.contains('addtree')).toBeTruthy(); |
| 353 | }); |
| 354 | |
| 355 | |
| 356 | it('should parse into a tree', function () { |
| 357 | var info = KorAP.Match.create(match).info(); |
| 358 | |
| 359 | // Override getMatchInfo API call |
| 360 | KorAP.API.getMatchInfo = function () { |
| 361 | return { "snippet": treeSnippet }; |
| 362 | }; |
| 363 | |
| 364 | var tree = info.getTree(); |
| 365 | expect(tree).toBeTruthy(); |
| 366 | expect(tree.nodes()).toEqual(49); |
| 367 | }); |
| 368 | |
| 369 | |
| 370 | it('should parse into a tree view', function () { |
| 371 | var matchElement = matchElementFactory(); |
| 372 | expect(matchElement.tagName).toEqual('LI'); |
| 373 | |
| 374 | var info = KorAP.Match.create(matchElement).info(); |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame^] | 375 | info.toggle(); |
Nils Diewald | a297f06 | 2015-04-02 00:23:46 +0000 | [diff] [blame] | 376 | |
| 377 | // Match |
| 378 | expect(matchElement.children[0].tagName).toEqual('DIV'); |
| 379 | |
| 380 | // snippet |
| 381 | expect(matchElement.children[0].children[0].tagName).toEqual('DIV'); |
| 382 | expect(matchElement.children[0].children[0].classList.contains('snippet')).toBeTruthy(); |
| 383 | expect(matchElement.children[0].children[0].firstChild.nodeValue).toEqual('check'); |
| 384 | |
| 385 | // reference |
| 386 | expect(matchElement.children[1].classList.contains('ref')).toBeTruthy(); |
| 387 | expect(matchElement.children[1].firstChild.nodeValue).toEqual('me'); |
| 388 | |
| 389 | // now |
| 390 | var infotable = matchElement.children[0].children[1]; |
| 391 | expect(infotable.tagName).toEqual('DIV'); |
| 392 | expect(infotable.classList.contains('matchinfo')).toBeTruthy(); |
| 393 | expect(infotable.children[0].classList.contains('matchtable')).toBeTruthy(); |
| 394 | expect(infotable.children[1].classList.contains('addtree')).toBeTruthy(); |
| 395 | |
| 396 | // Override getMatchInfo API call |
| 397 | KorAP.API.getMatchInfo = function () { |
| 398 | return { "snippet": treeSnippet }; |
| 399 | }; |
| 400 | |
| 401 | info.addTree('mate', 'beebop'); |
| 402 | |
| 403 | // With added tree |
| 404 | var infotable = matchElement.children[0].children[1]; |
| 405 | expect(infotable.tagName).toEqual('DIV'); |
| 406 | expect(infotable.classList.contains('matchinfo')).toBeTruthy(); |
| 407 | expect(infotable.children[0].classList.contains('matchtable')).toBeTruthy(); |
| 408 | expect(infotable.children[1].classList.contains('addtree')).toBe(false); |
| 409 | |
| 410 | var tree = infotable.children[1]; |
| 411 | expect(tree.tagName).toEqual('DIV'); |
| 412 | expect(tree.classList.contains('matchtree')).toBeTruthy(); |
| 413 | expect(tree.children[0].tagName).toEqual('H6'); |
| 414 | expect(tree.children[0].children[0].tagName).toEqual('SPAN'); |
| 415 | expect(tree.children[0].children[0].firstChild.nodeValue).toEqual('mate'); |
| 416 | expect(tree.children[0].children[1].tagName).toEqual('SPAN'); |
| 417 | expect(tree.children[0].children[1].firstChild.nodeValue).toEqual('beebop'); |
| 418 | |
| 419 | expect(tree.children[1].tagName).toEqual('DIV'); |
| 420 | |
| 421 | }); |
| 422 | }); |
| 423 | |
| 424 | |
| 425 | describe('KorAP.MatchTable', function () { |
| 426 | it('should be rendered', function () { |
| 427 | var info = KorAP.Match.create(match).info(); |
| 428 | |
| 429 | // Override getMatchInfo API call |
| 430 | KorAP.API.getMatchInfo = function() { |
| 431 | return { "snippet": snippet }; |
| 432 | }; |
| 433 | |
| 434 | var table = info.getTable(); |
| 435 | var e = table.element(); |
| 436 | |
| 437 | expect(e.nodeName).toBe('TABLE'); |
| 438 | expect(e.children[0].nodeName).toBe('THEAD'); |
| 439 | var tr = e.children[0].children[0]; |
| 440 | expect(tr.nodeName).toBe('TR'); |
| 441 | expect(tr.children[0].nodeName).toBe('TH'); |
| 442 | |
| 443 | expect(tr.children[0].firstChild.nodeValue).toBe('Foundry'); |
| 444 | expect(tr.children[1].firstChild.nodeValue).toBe('Layer'); |
| 445 | expect(tr.children[2].firstChild.nodeValue).toBe('meist'); |
| 446 | expect(tr.children[3].firstChild.nodeValue).toBe('deutlich'); |
| 447 | expect(tr.children[4].firstChild.nodeValue).toBe('leistungsfähiger'); |
| 448 | |
| 449 | // first row |
| 450 | tr = e.children[1].children[0]; |
| 451 | expect(tr.nodeName).toBe('TR'); |
| 452 | expect(tr.getAttribute('tabindex')).toEqual('0'); |
| 453 | expect(tr.children[0].nodeName).toBe('TH'); |
| 454 | expect(tr.children[0].firstChild.nodeValue).toEqual('cnx'); |
| 455 | expect(tr.children[1].firstChild.nodeValue).toEqual('l'); |
| 456 | expect(tr.children[2].firstChild.nodeValue).toEqual('meist'); |
| 457 | expect(tr.children[3].firstChild.nodeValue).toEqual('deutlich'); |
| 458 | expect(tr.children[4].firstChild.nodeValue).toEqual('fähig'); |
| 459 | expect(tr.children[4].lastChild.nodeValue).toEqual('leistung'); |
| 460 | |
| 461 | // second row |
| 462 | tr = e.children[1].children[1]; |
| 463 | expect(tr.nodeName).toBe('TR'); |
| 464 | expect(tr.getAttribute('tabindex')).toEqual('0'); |
| 465 | expect(tr.children[0].nodeName).toBe('TH'); |
| 466 | expect(tr.children[0].firstChild.nodeValue).toEqual('cnx'); |
| 467 | expect(tr.children[1].firstChild.nodeValue).toEqual('p'); |
| 468 | expect(tr.children[2].firstChild.nodeValue).toEqual('ADV'); |
| 469 | expect(tr.children[3].firstChild.nodeValue).toEqual('A'); |
| 470 | expect(tr.children[4].firstChild.nodeValue).toEqual('A'); |
| 471 | }); |
| 472 | }); |
| 473 | |
| 474 | describe('KorAP.MatchTree', function () { |
| 475 | it('should be rendered', function () { |
| 476 | var info = KorAP.Match.create(match).info(); |
| 477 | |
| 478 | // Override getMatchInfo API call |
| 479 | KorAP.API.getMatchInfo = function() { |
| 480 | return { "snippet": treeSnippet }; |
| 481 | }; |
| 482 | |
| 483 | var tree = info.getTree(); |
| 484 | |
| 485 | var e = tree.element(); |
| 486 | expect(e.nodeName).toEqual('svg'); |
| 487 | expect(e.getElementsByTagName('g').length).toEqual(48); |
| 488 | }); |
| 489 | }); |
| 490 | |
| 491 | |
| 492 | describe('KorAP.MatchTreeItem', function () { |
| 493 | it('should be initializable', function () { |
| 494 | var mi = KorAP.MatchTreeItem.create(['cnx/c', 'cnx', 'c']) |
| 495 | expect(mi.element().firstChild.nodeValue).toEqual('cnx/c'); |
| 496 | expect(mi.lcField()).toEqual(' cnx/c'); |
| 497 | expect(mi.foundry()).toEqual('cnx'); |
| 498 | expect(mi.layer()).toEqual('c'); |
| 499 | }); |
| 500 | }); |
| 501 | |
| 502 | |
| 503 | describe('KorAP.MatchTreeMenu', function () { |
| 504 | it('should be initializable', function () { |
| 505 | var menu = KorAP.MatchTreeMenu.create(undefined, [ |
| 506 | ['cnx/c', 'cnx', 'c'], |
| 507 | ['xip/c', 'xip', 'c'] |
| 508 | ]); |
| 509 | |
| 510 | expect(menu.itemClass()).toEqual(KorAP.MatchTreeItem); |
| 511 | expect(menu.element().nodeName).toEqual('UL'); |
| 512 | expect(menu.element().style.opacity).toEqual("0"); |
| 513 | expect(menu.limit()).toEqual(6); |
| 514 | menu.show(); |
| 515 | expect(menu.item(0).active()).toBe(true); |
| 516 | }); |
| 517 | }); |
| 518 | |
| 519 | // table = view.toTable(); |
| 520 | // table.sortBy(''); |
| 521 | // table.element(); |
| 522 | // tree = view.toTree(); |
| 523 | // tree.element(); |
| 524 | |