blob: 3be39fd934b1d436a0cbe86d94cac39bd8e6c8f4 [file] [log] [blame]
Akronad894832016-06-08 18:24:48 +02001define(
2 ['selectMenu'],
3 function (selectMenuClass) {
4
5 describe('KorAP.SelectMenu', function () {
6 var list = [
7 {
8 content : 'Poliqarp',
9 value : 'poliqarp',
10 desc : 'The Polish National Corpus QL'
11 },
12 {
13 content : 'Cosmas II',
14 value : 'cosmas2',
15 desc : 'The Polish National Corpus QL'
16 },
17 {
18 content : 'Annis',
19 value : 'annis'
20 },
21 {
22 content : 'CQL v1.2',
23 value : 'cql'
24 }
25 ];
26
27 it('should replace a select element', function () {
28 var div = document.createElement('div');
29 var element = div.appendChild(document.createElement('select'));
30 for (i in list) {
31 var opt = element.appendChild(document.createElement('option'));
32 opt.setAttribute('value', list[i].value);
33 opt.appendChild(document.createTextNode(list[i].content));
34 };
35
36 var menu = selectMenuClass.create(element);
37
38 expect(element.style.display).toEqual('none');
39
40 menu.show();
41
42 expect(menu.item(0).active()).toBe(true);
43 expect(menu.item(0).noMore()).toBe(true);
44
45 // TODO: Improve lcfield!!!!!!
46 expect(menu.shownItem(0).lcField()).toEqual(' poliqarp');
47 });
48 });
49 }
50);