Keep plugin state in state manager (fixes #201)
Change-Id: If4a5305f3e41f1fcac4a47afeba613b3106c69fa
diff --git a/dev/js/spec/stateSpec.js b/dev/js/spec/stateSpec.js
index 996eca4..661f394 100644
--- a/dev/js/spec/stateSpec.js
+++ b/dev/js/spec/stateSpec.js
@@ -231,5 +231,18 @@
expect(sm.toString()).toEqual("\"test\":2");
});
+
+ it('should load stored states', function () {
+ const el = document.createElement('input');
+ el.setAttribute("value","\"test\":2");
+ const sm = stateManagerClass.create(el);
+ expect(sm).toBeTruthy();
+
+ const s1 = sm.newState('test', [1,2,3], 1);
+
+ expect(s1.get()).toEqual(2);
+
+ expect(sm.toString()).toEqual("\"test\":2");
+ });
});
});