mirror of
https://github.com/google/blockly.git
synced 2026-01-08 01:20:12 +01:00
fix: change assertFieldValue in test helpers to use deepEqual (#6739)
This commit is contained in:
@@ -126,7 +126,7 @@ suite('Angle Fields', function() {
|
||||
function() {
|
||||
return null;
|
||||
},
|
||||
value: 2, expectedValue: 1},
|
||||
value: 2, expectedValue: '1'},
|
||||
{title: 'Force Mult of 30 Validator',
|
||||
validator:
|
||||
function(newValue) {
|
||||
@@ -150,7 +150,7 @@ suite('Angle Fields', function() {
|
||||
});
|
||||
test('When Not Editing', function() {
|
||||
this.field.setValue(suiteInfo.value);
|
||||
assertFieldValue(this.field, suiteInfo.expectedValue);
|
||||
assertFieldValue(this.field, +suiteInfo.expectedValue);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -202,11 +202,11 @@ suite('Number Fields', function() {
|
||||
function() {
|
||||
return null;
|
||||
},
|
||||
value: 2, expectedValue: 1},
|
||||
value: 2, expectedValue: '1'},
|
||||
{title: 'Force End with 6 Validator',
|
||||
validator:
|
||||
function(newValue) {
|
||||
return String(newValue).replace(/.$/, '6');
|
||||
return +String(newValue).replace(/.$/, '6');
|
||||
},
|
||||
value: 25, expectedValue: 26},
|
||||
{title: 'Returns Undefined Validator', validator: function() {}, value: 2,
|
||||
@@ -226,7 +226,7 @@ suite('Number Fields', function() {
|
||||
});
|
||||
test('When Not Editing', function() {
|
||||
this.field.setValue(suiteInfo.value);
|
||||
assertFieldValue(this.field, suiteInfo.expectedValue);
|
||||
assertFieldValue(this.field, +suiteInfo.expectedValue);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -73,8 +73,8 @@ export function assertFieldValue(field, expectedValue, expectedText = undefined)
|
||||
if (expectedText === undefined) {
|
||||
expectedText = String(expectedValue);
|
||||
}
|
||||
chai.assert.equal(actualValue, expectedValue, 'Value');
|
||||
chai.assert.equal(actualText, expectedText, 'Text');
|
||||
chai.assert.deepEqual(actualValue, expectedValue);
|
||||
chai.assert.deepEqual(actualText, expectedText);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user