Support default value for state
Change-Id: I566a16753016dd2673ee1d298baca61a90175757
diff --git a/dev/js/spec/stateSpec.js b/dev/js/spec/stateSpec.js
index fec337c..09ab274 100644
--- a/dev/js/spec/stateSpec.js
+++ b/dev/js/spec/stateSpec.js
@@ -16,6 +16,20 @@
expect(s.get()).toBeTruthy();
});
+ it('should accept a default value', function () {
+ let s = stateClass.create([true, false]);
+ expect(s.get()).toBeTruthy();
+ s.set(false);
+ expect(s.get()).toBeFalsy();
+
+ s = stateClass.create([true, false]);
+ s.setIfNotYet(false);
+ expect(s.get()).toBeFalsy();
+
+ s.setIfNotYet(true);
+ expect(s.get()).toBeFalsy();
+ });
+
it('should be associatable', function () {
let s = stateClass.create();