Testing dynamic adding of items. Currently depends on 5115.
Change-Id: I812bb0959863d5b57d8936c5099ab6eb9076be68
diff --git a/dev/js/spec/containerMenuSpec.js b/dev/js/spec/containerMenuSpec.js
index 5a628e4..006a7fb 100644
--- a/dev/js/spec/containerMenuSpec.js
+++ b/dev/js/spec/containerMenuSpec.js
@@ -2113,6 +2113,64 @@
menu.prev();
expect(container.active()).toBeTruthy();
});
+ it("should support dynamic adding of items", function () {
+
+ var list = [
+ ["Constituency"],
+ ["Lemma"],
+ ["Morphology"],
+ ["Part-of-Speech"],
+ ["Syntax"]
+ ];
+
+ var ExampleItemList2 = new Array;
+ ExampleItemList2.push({defaultTextValue : "CIText1 "});
+ ExampleItemList2.push({});
+
+ var menu = OwnContainerMenu.create(list,ExampleItemList2);
+ var container = menu.container();
+ expect(container.item(0).initContent().nodeValue).toEqual("CIText1 ");
+ expect(container.item(1).initContent().nodeValue).toEqual("");
+ expect(container.item(2).initContent()).toEqual(undefined);
+ expect(container.item(2)).toBeDefined();
+ expect(container._cItemPrefix.element().innerHTML).toEqual("");
+ container.addItem({defaultTextValue : "CIText2 "});
+ expect(container.item(0).initContent().nodeValue).toEqual("CIText1 ");
+ expect(container.item(1).initContent().nodeValue).toEqual("");
+ expect(container.item(2).initContent().nodeValue).toEqual("CIText2 ");
+ expect(container.item(3)).toBeDefined();
+ expect(container.item(3).initContent()).toEqual(undefined);
+ expect(container._cItemPrefix.element().innerHTML).toEqual("");
+ container.add("a");
+
+ menu.next();
+ menu.next();
+ menu.next();
+ menu.next();
+ menu.next();
+ expect(container.item(0).active()).toBeTruthy();
+ menu.next();
+ expect(container.item(1).active()).toBeTruthy();
+ menu.next();
+ expect(container.item(2).active()).toBeTruthy();
+ menu.next();
+ expect(container.item(3).active()).toBeTruthy();
+ menu.next();
+ expect(container.item(3).active()).toBeFalsy();
+ menu.prev();
+ expect(container.item(3).active()).toBeTruthy();
+ menu.prev();
+ expect(container.item(2).active()).toBeTruthy();
+ menu.prev();
+ expect(container.item(1).active()).toBeTruthy();
+ menu.prev();
+ expect(container.item(0).active()).toBeTruthy();
+ menu.prev();
+ expect(container.item(0).active()).toBeFalsy();
+
+
+
+ });
it("should support dynamic changing of text content", function () {
var list = [