mirror of
https://github.com/google/blockly.git
synced 2026-05-14 08:00:13 +02:00
fix: remove some attributes from the JSO system (#5356)
* fix: remove some attributes from the JSO system Remove the deletable, movable, and editable attributes. Normally this would be a breaking change, but because this isn't released yet it's just a patch. * fixup: serializer tests
This commit is contained in:
committed by
alschmiedt
parent
415d8e72ff
commit
9aa79a76df
@@ -83,70 +83,6 @@ suite('JSO Serialization', function() {
|
||||
});
|
||||
});
|
||||
|
||||
suite('Deletable', function() {
|
||||
test('False', function() {
|
||||
const block = this.workspace.newBlock('row_block');
|
||||
block.setDeletable(false);
|
||||
const jso = Blockly.serialization.blocks.save(block);
|
||||
assertProperty(jso, 'deletable', false);
|
||||
});
|
||||
|
||||
test('True', function() {
|
||||
const block = this.workspace.newBlock('row_block');
|
||||
block.setDeletable(true);
|
||||
const jso = Blockly.serialization.blocks.save(block);
|
||||
assertNoProperty(jso, 'deletable');
|
||||
});
|
||||
|
||||
test('False and Shadow', function() {
|
||||
const block = this.workspace.newBlock('row_block');
|
||||
block.setDeletable(false);
|
||||
block.setShadow(true);
|
||||
const jso = Blockly.serialization.blocks.save(block);
|
||||
assertNoProperty(jso, 'deletable');
|
||||
});
|
||||
});
|
||||
|
||||
suite('Movable', function() {
|
||||
test('False', function() {
|
||||
const block = this.workspace.newBlock('row_block');
|
||||
block.setMovable(false);
|
||||
const jso = Blockly.serialization.blocks.save(block);
|
||||
assertProperty(jso, 'movable', false);
|
||||
});
|
||||
|
||||
test('True', function() {
|
||||
const block = this.workspace.newBlock('row_block');
|
||||
block.setMovable(true);
|
||||
const jso = Blockly.serialization.blocks.save(block);
|
||||
assertNoProperty(jso, 'movable');
|
||||
});
|
||||
|
||||
test('False and Shadow', function() {
|
||||
const block = this.workspace.newBlock('row_block');
|
||||
block.setMovable(false);
|
||||
block.setShadow(true);
|
||||
const jso = Blockly.serialization.blocks.save(block);
|
||||
assertNoProperty(jso, 'movable');
|
||||
});
|
||||
});
|
||||
|
||||
suite('Editable', function() {
|
||||
test('False', function() {
|
||||
const block = this.workspace.newBlock('row_block');
|
||||
block.setEditable(false);
|
||||
const jso = Blockly.serialization.blocks.save(block);
|
||||
assertProperty(jso, 'editable', false);
|
||||
});
|
||||
|
||||
test('True', function() {
|
||||
const block = this.workspace.newBlock('row_block');
|
||||
block.setEditable(true);
|
||||
const jso = Blockly.serialization.blocks.save(block);
|
||||
assertNoProperty(jso, 'editable');
|
||||
});
|
||||
});
|
||||
|
||||
suite('Inline', function() {
|
||||
test('True', function() {
|
||||
const block = this.workspace.newBlock('statement_block');
|
||||
|
||||
@@ -49,7 +49,7 @@ Serializer.Empty = new SerializerTestCase('Empty',
|
||||
);
|
||||
Serializer.Data = new SerializerTestCase('Data',
|
||||
'<xml xmlns="https://developers.google.com/blockly/xml">' +
|
||||
'<block type="logic_negate" id="id******************" editable="false" x="42" y="42">' +
|
||||
'<block type="logic_negate" id="id******************" x="42" y="42">' +
|
||||
'<data>test data</data>' +
|
||||
'</block>' +
|
||||
'</xml>');
|
||||
@@ -71,25 +71,10 @@ Serializer.Attributes.Disabled = new SerializerTestCase('Disabled',
|
||||
'<xml xmlns="https://developers.google.com/blockly/xml">' +
|
||||
'<block type="logic_negate" id="id******************" disabled="true" x="42" y="42"></block>' +
|
||||
'</xml>');
|
||||
Serializer.Attributes.Deletable = new SerializerTestCase('Deletable',
|
||||
'<xml xmlns="https://developers.google.com/blockly/xml">' +
|
||||
'<block type="logic_negate" id="id******************" deletable="false" x="42" y="42"></block>' +
|
||||
'</xml>');
|
||||
Serializer.Attributes.Movable = new SerializerTestCase('Movable',
|
||||
'<xml xmlns="https://developers.google.com/blockly/xml">' +
|
||||
'<block type="logic_negate" id="id******************" movable="false" x="42" y="42"></block>' +
|
||||
'</xml>');
|
||||
Serializer.Attributes.Editable = new SerializerTestCase('Editable',
|
||||
'<xml xmlns="https://developers.google.com/blockly/xml">' +
|
||||
'<block type="logic_negate" id="id******************" editable="false" x="42" y="42"></block>' +
|
||||
'</xml>');
|
||||
Serializer.Attributes.testCases = [
|
||||
Serializer.Attributes.Basic,
|
||||
Serializer.Attributes.Collapsed,
|
||||
Serializer.Attributes.Disabled,
|
||||
Serializer.Attributes.Deletable,
|
||||
Serializer.Attributes.Movable,
|
||||
Serializer.Attributes.Editable,
|
||||
];
|
||||
|
||||
Serializer.Attributes.Inline = new SerializerTestSuite('Inline');
|
||||
|
||||
Reference in New Issue
Block a user