Fix tutorial links to support query-languages
Change-Id: Ic32258b8421bc7a0b90a49fc4ec4b3d29790bf74
diff --git a/dev/js/spec/selectMenuSpec.js b/dev/js/spec/selectMenuSpec.js
index 26cfd25..8145611 100644
--- a/dev/js/spec/selectMenuSpec.js
+++ b/dev/js/spec/selectMenuSpec.js
@@ -27,17 +27,22 @@
value : 'cql'
}
];
-
- it('should replace a select element', function () {
- var div = document.createElement('div');
+
+ function _selectE() {
+ var div = document.createElement('div');
var element = div.appendChild(document.createElement('select'));
for (i in list) {
var opt = element.appendChild(document.createElement('option'));
opt.setAttribute('value', list[i].value);
opt.appendChild(document.createTextNode(list[i].content));
};
-
+ return div;
+ };
+
+ it('should replace a select element', function () {
+ var div = _selectE();
var menu = selectMenuClass.create(div);
+ var element = div.firstChild;
expect(element.style.display).toEqual('none');
@@ -55,14 +60,10 @@
expect(menu.shownItem(0).lcField()).toEqual(' poliqarp');
});
+
it('should first show the selected value', function () {
- var div = document.createElement('div');
- var element = div.appendChild(document.createElement('select'));
- for (i in list) {
- var opt = element.appendChild(document.createElement('option'));
- opt.setAttribute('value', list[i].value);
- opt.appendChild(document.createTextNode(list[i].content));
- };
+ var div = _selectE();
+ var element = div.firstChild;
expect(element.selectedIndex).toEqual(0);
@@ -75,6 +76,16 @@
menu.show(3);
expect(menu._title.textContent).toEqual('Annis');
});
+
+ it('should be selectable via method', function () {
+ var div = _selectE();
+ var element = div.firstChild;
+ var menu = selectMenuClass.create(div);
+
+ expect(element.selectedIndex).toEqual(0);
+ menu.selectValue('annis');
+ expect(element.selectedIndex).toEqual(2);
+ });
});
}
);