Use statemanager for toggle states
Change-Id: Iafbdf69140b69ffabd5c26ffab3b2e055d2e3fe3
diff --git a/dev/js/spec/pluginSpec.js b/dev/js/spec/pluginSpec.js
index 973ad16..acadeac 100644
--- a/dev/js/spec/pluginSpec.js
+++ b/dev/js/spec/pluginSpec.js
@@ -230,14 +230,14 @@
p.element().querySelector("span.close").click();
expect(p.element().querySelectorAll("iframe").length).toEqual(0);
-
+
b.click();
expect(p.element().querySelectorAll("iframe").length).toEqual(1);
expect(p.element().querySelectorAll("div.view.widget").length).toEqual(1);
expect(p.element().querySelectorAll("div.view.show.widget").length).toEqual(1);
expect(p.element().querySelector("iframe").getAttribute('sandbox')).toEqual('');
-
+
manager.destroy();
KorAP.Panel["result"] = undefined;
@@ -254,6 +254,7 @@
panel : 'result',
title : 'Glemm',
onClick : {
+ state : 'check',
template : 'about:blank',
action : 'toggle',
'default' : false
@@ -271,8 +272,12 @@
expect(p.element().querySelectorAll("iframe").length).toEqual(0);
+ expect(manager.states().toString()).toEqual("");
+
b.click();
+ expect(manager.states().toString()).toEqual("\"check\":true");
+
expect(b.getAttribute("title")).toEqual("Glemm");
expect(b.firstChild.classList.contains('button-icon')).toBeTruthy();
expect(b.firstChild.classList.contains('check')).toBeTruthy();