mirror of
https://github.com/google/blockly.git
synced 2026-01-20 07:17:10 +01:00
Remove field tests with null
Null is explicitly disallowed in most field constructors. Thus the random results of passing null are undefined and may change. These changes should not be tested against. Exceptions: Variable and serializable lable fields acually do take null. This commit is due to the upcoming parseInt->Number commit which happens to change how null behaves. Also added missing ‘empty’ test for checkboxes.
This commit is contained in:
@@ -35,10 +35,6 @@ suite('Angle Fields', function() {
|
||||
var angleField = new Blockly.FieldAngle();
|
||||
assertValueDefault(angleField);
|
||||
});
|
||||
test('Null', function() {
|
||||
var angleField = new Blockly.FieldAngle(null);
|
||||
assertValueDefault(angleField);
|
||||
});
|
||||
test('Undefined', function() {
|
||||
var angleField = new Blockly.FieldAngle(undefined);
|
||||
assertValueDefault(angleField);
|
||||
@@ -77,10 +73,6 @@ suite('Angle Fields', function() {
|
||||
var angleField = Blockly.FieldAngle.fromJson({});
|
||||
assertValueDefault(angleField);
|
||||
});
|
||||
test('Null', function() {
|
||||
var angleField = Blockly.FieldAngle.fromJson({ angle:null });
|
||||
assertValueDefault(angleField);
|
||||
});
|
||||
test('Undefined', function() {
|
||||
var angleField = Blockly.FieldAngle.fromJson({ angle:undefined });
|
||||
assertValueDefault(angleField);
|
||||
|
||||
@@ -29,8 +29,8 @@ suite('Checkbox Fields', function() {
|
||||
assertValue(checkboxField, 'FALSE', 'false');
|
||||
}
|
||||
suite('Constructor', function() {
|
||||
test('Null', function() {
|
||||
var checkboxField = new Blockly.FieldCheckbox(null);
|
||||
test('Empty', function() {
|
||||
var checkboxField = new Blockly.FieldCheckbox();
|
||||
assertValueDefault(checkboxField);
|
||||
});
|
||||
test('Undefined', function() {
|
||||
@@ -59,8 +59,8 @@ suite('Checkbox Fields', function() {
|
||||
});
|
||||
});
|
||||
suite('fromJson', function() {
|
||||
test('Null', function() {
|
||||
var checkboxField = Blockly.FieldCheckbox.fromJson({ checked: null});
|
||||
test('Empty', function() {
|
||||
var checkboxField = Blockly.FieldCheckbox.fromJson({});
|
||||
assertValueDefault(checkboxField);
|
||||
});
|
||||
test('Undefined', function() {
|
||||
|
||||
@@ -49,10 +49,6 @@ suite('Colour Fields', function() {
|
||||
var colourField = new Blockly.FieldColour();
|
||||
assertValueDefault(colourField);
|
||||
});
|
||||
test('Null', function() {
|
||||
var colourField = new Blockly.FieldColour(null);
|
||||
assertValueDefault(colourField);
|
||||
});
|
||||
test('Undefined', function() {
|
||||
var colourField = new Blockly.FieldColour(undefined);
|
||||
assertValueDefault(colourField);
|
||||
@@ -107,10 +103,6 @@ suite('Colour Fields', function() {
|
||||
var colourField = new Blockly.FieldColour.fromJson({});
|
||||
assertValueDefault(colourField);
|
||||
});
|
||||
test('Null', function() {
|
||||
var colourField = new Blockly.FieldColour.fromJson({ colour:null });
|
||||
assertValueDefault(colourField);
|
||||
});
|
||||
test('Undefined', function() {
|
||||
var colourField = new Blockly.FieldColour.fromJson({ colour:undefined });
|
||||
assertValueDefault(colourField);
|
||||
|
||||
@@ -34,10 +34,6 @@ suite('Date Fields', function() {
|
||||
var dateField = new Blockly.FieldDate();
|
||||
assertValueDefault(dateField);
|
||||
});
|
||||
test('Null', function() {
|
||||
var dateField = new Blockly.FieldDate(null);
|
||||
assertValueDefault(dateField);
|
||||
});
|
||||
test('Undefined', function() {
|
||||
var dateField = new Blockly.FieldDate(undefined);
|
||||
assertValueDefault(dateField);
|
||||
@@ -64,10 +60,6 @@ suite('Date Fields', function() {
|
||||
var dateField = Blockly.FieldDate.fromJson({});
|
||||
assertValueDefault(dateField);
|
||||
});
|
||||
test('Null', function() {
|
||||
var dateField = Blockly.FieldDate.fromJson({ date: null });
|
||||
assertValueDefault(dateField);
|
||||
});
|
||||
test('Undefined', function() {
|
||||
var dateField = Blockly.FieldDate.fromJson({ date: undefined });
|
||||
assertValueDefault(dateField);
|
||||
|
||||
@@ -31,11 +31,6 @@ suite('Dropdown Fields', function() {
|
||||
new Blockly.FieldDropdown();
|
||||
});
|
||||
});
|
||||
test('Null', function() {
|
||||
chai.assert.throws(function() {
|
||||
new Blockly.FieldDropdown(null);
|
||||
});
|
||||
});
|
||||
test('Undefined', function() {
|
||||
chai.assert.throws(function() {
|
||||
new Blockly.FieldDropdown(undefined);
|
||||
@@ -102,11 +97,6 @@ suite('Dropdown Fields', function() {
|
||||
Blockly.FieldDropdown.fromJson({});
|
||||
});
|
||||
});
|
||||
test('Null', function() {
|
||||
chai.assert.throws(function() {
|
||||
Blockly.FieldDropdown.fromJson({ options: null });
|
||||
});
|
||||
});
|
||||
test('Undefined', function() {
|
||||
chai.assert.throws(function() {
|
||||
Blockly.FieldDropdown.fromJson({ options: undefined });
|
||||
|
||||
@@ -31,21 +31,11 @@ suite('Image Fields', function() {
|
||||
new Blockly.FieldImage();
|
||||
});
|
||||
});
|
||||
test('Null Src', function() {
|
||||
chai.assert.throws(function() {
|
||||
new Blockly.FieldImage(null, 1, 1);
|
||||
});
|
||||
});
|
||||
test('Undefined Src', function() {
|
||||
chai.assert.throws(function() {
|
||||
new Blockly.FieldImage(undefined, 1, 1);
|
||||
});
|
||||
});
|
||||
test('Null Size', function() {
|
||||
chai.assert.throws(function() {
|
||||
new Blockly.FieldImage('src', null, null);
|
||||
});
|
||||
});
|
||||
test('Undefined Size', function() {
|
||||
chai.assert.throws(function() {
|
||||
new Blockly.FieldImage('src', undefined, undefined);
|
||||
@@ -79,15 +69,6 @@ suite('Image Fields', function() {
|
||||
Blockly.FieldImage.fromJson({});
|
||||
});
|
||||
});
|
||||
test('Null Src', function() {
|
||||
chai.assert.throws(function() {
|
||||
Blockly.FieldImage.fromJson({
|
||||
src: null,
|
||||
width: 1,
|
||||
height: 1
|
||||
});
|
||||
});
|
||||
});
|
||||
test('Undefined Src', function() {
|
||||
chai.assert.throws(function() {
|
||||
Blockly.FieldImage.fromJson({
|
||||
@@ -97,15 +78,6 @@ suite('Image Fields', function() {
|
||||
});
|
||||
});
|
||||
});
|
||||
test('Null Size', function() {
|
||||
chai.assert.throws(function() {
|
||||
Blockly.FieldImage.fromJson({
|
||||
src: 'src',
|
||||
width: null,
|
||||
height: null
|
||||
});
|
||||
});
|
||||
});
|
||||
test('Undefined Size', function() {
|
||||
chai.assert.throws(function() {
|
||||
Blockly.FieldImage.fromJson({
|
||||
|
||||
@@ -33,10 +33,6 @@ suite('Label Fields', function() {
|
||||
var labelField = new Blockly.FieldLabel();
|
||||
assertValueDefault(labelField);
|
||||
});
|
||||
test('Null', function() {
|
||||
var labelField = new Blockly.FieldLabel(null);
|
||||
assertValueDefault(labelField);
|
||||
});
|
||||
test('Undefined', function() {
|
||||
var labelField = new Blockly.FieldLabel(undefined);
|
||||
assertValueDefault(labelField);
|
||||
@@ -67,10 +63,6 @@ suite('Label Fields', function() {
|
||||
var labelField = new Blockly.FieldLabel.fromJson({});
|
||||
assertValueDefault(labelField);
|
||||
});
|
||||
test('Null', function() {
|
||||
var labelField = new Blockly.FieldLabel.fromJson({ text:null });
|
||||
assertValueDefault(labelField);
|
||||
});
|
||||
test('Undefined', function() {
|
||||
var labelField = new Blockly.FieldLabel.fromJson({ text:undefined });
|
||||
assertValueDefault(labelField);
|
||||
|
||||
@@ -55,10 +55,6 @@ suite('Number Fields', function() {
|
||||
var numberField = new Blockly.FieldNumber();
|
||||
assertNumberFieldDefault(numberField);
|
||||
});
|
||||
test('Null', function() {
|
||||
var numberField = createNumberFieldSameValuesConstructor(null);
|
||||
assertNumberFieldDefault(numberField);
|
||||
});
|
||||
test('Undefined', function() {
|
||||
var numberField = createNumberFieldSameValuesConstructor(undefined);
|
||||
assertNumberFieldDefault(numberField);
|
||||
@@ -93,10 +89,6 @@ suite('Number Fields', function() {
|
||||
var numberField = Blockly.FieldNumber.fromJson({});
|
||||
assertNumberFieldDefault(numberField);
|
||||
});
|
||||
test('Null', function() {
|
||||
var numberField = createNumberFieldSameValuesJson(null);
|
||||
assertNumberFieldDefault(numberField);
|
||||
});
|
||||
test('Undefined', function() {
|
||||
var numberField = createNumberFieldSameValuesJson(undefined);
|
||||
assertNumberFieldDefault(numberField);
|
||||
|
||||
@@ -34,10 +34,6 @@ suite('Text Input Fields', function() {
|
||||
var textInputField = new Blockly.FieldTextInput();
|
||||
assertValueDefault(textInputField);
|
||||
});
|
||||
test('Null', function() {
|
||||
var textInputField = new Blockly.FieldTextInput(null);
|
||||
assertValueDefault(textInputField);
|
||||
});
|
||||
test('Undefined', function() {
|
||||
var textInputField = new Blockly.FieldTextInput(undefined);
|
||||
assertValueDefault(textInputField);
|
||||
@@ -68,10 +64,6 @@ suite('Text Input Fields', function() {
|
||||
var textInputField = new Blockly.FieldTextInput.fromJson({});
|
||||
assertValueDefault(textInputField);
|
||||
});
|
||||
test('Null', function() {
|
||||
var textInputField = new Blockly.FieldTextInput.fromJson({ text: null});
|
||||
assertValueDefault(textInputField);
|
||||
});
|
||||
test('Undefined', function() {
|
||||
var textInputField = new Blockly.FieldTextInput
|
||||
.fromJson({ text: undefined});
|
||||
|
||||
Reference in New Issue
Block a user