mirror of
https://github.com/google/blockly.git
synced 2026-01-07 00:50:27 +01:00
do value update if the value is valid again (#4351)
* do value update if the value is valid again * update the logic at set value * fix tests * update logging
This commit is contained in:
committed by
GitHub
parent
a0c0b86679
commit
9bafa7e40d
@@ -898,7 +898,8 @@ Blockly.Field.prototype.setValue = function(newValue) {
|
||||
}
|
||||
var oldValue = this.getValue();
|
||||
if (oldValue === newValue) {
|
||||
doLogging && console.log('same, return');
|
||||
doLogging && console.log('same, doValueUpdate_, return');
|
||||
this.doValueUpdate_(newValue);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -215,7 +215,7 @@ suite('Abstract Fields', function() {
|
||||
addSpies(this.field);
|
||||
this.field.setValue('value');
|
||||
sinon.assert.notCalled(this.field.doValueInvalid_);
|
||||
sinon.assert.notCalled(this.field.doValueUpdate_);
|
||||
sinon.assert.calledOnce(this.field.doValueUpdate_);
|
||||
sinon.assert.notCalled(this.field.forceRerender);
|
||||
});
|
||||
test('New Value (Class)Validates to Old Value', function() {
|
||||
@@ -224,7 +224,7 @@ suite('Abstract Fields', function() {
|
||||
addSpies(this.field);
|
||||
this.field.setValue('notValue');
|
||||
sinon.assert.notCalled(this.field.doValueInvalid_);
|
||||
sinon.assert.notCalled(this.field.doValueUpdate_);
|
||||
sinon.assert.calledOnce(this.field.doValueUpdate_);
|
||||
sinon.assert.notCalled(this.field.forceRerender);
|
||||
});
|
||||
test('New Value (Local)Validates to Old Value', function() {
|
||||
@@ -233,7 +233,7 @@ suite('Abstract Fields', function() {
|
||||
addSpies(this.field);
|
||||
this.field.setValue('notValue');
|
||||
sinon.assert.notCalled(this.field.doValueInvalid_);
|
||||
sinon.assert.notCalled(this.field.doValueUpdate_);
|
||||
sinon.assert.calledOnce(this.field.doValueUpdate_);
|
||||
sinon.assert.notCalled(this.field.forceRerender);
|
||||
});
|
||||
test('New Value (Class)Validates to not Old Value', function() {
|
||||
|
||||
Reference in New Issue
Block a user