Fix regex bug in VC
diff --git a/dev/js/spec/vcSpec.js b/dev/js/spec/vcSpec.js
index 98ffc3f..16ddf82 100644
--- a/dev/js/spec/vcSpec.js
+++ b/dev/js/spec/vcSpec.js
@@ -1985,13 +1985,21 @@
it('should have a toggleble regex value', function () {
var sv = stringValClass.create();
+
+ expect(sv.element().firstChild.value).toBe('');
+ sv.element().firstChild.value = 'der'
+ expect(sv.element().firstChild.value).toBe('der');
+
expect(sv.regex()).toBe(false);
sv.toggleRegex();
+ expect(sv.element().firstChild.value).toBe('der');
expect(sv.regex()).toBe(true);
+ sv.element().firstChild.value = 'derbe'
sv.toggleRegex();
expect(sv.regex()).toBe(false);
+ expect(sv.element().firstChild.value).toBe('derbe');
});
it('should have an element', function () {
diff --git a/dev/js/src/vc/stringval.js b/dev/js/src/vc/stringval.js
index cce278a..c7a5d67 100644
--- a/dev/js/src/vc/stringval.js
+++ b/dev/js/src/vc/stringval.js
@@ -64,6 +64,7 @@
value : function (val) {
if (arguments.length === 1) {
this._value = val;
+ this._input.value = val;
this._update();
};
return this._value;
@@ -72,7 +73,8 @@
// Update dom element
_update : function () {
- this._input.value = this._value;
+ this._value = this._input.value;
+
if (this._regex) {
this._element.classList.add('regex');
}