mirror of
https://github.com/google/blockly.git
synced 2026-01-09 01:50:11 +01:00
feat: procedure event serialization (#6669)
* feat: add serialization to procedure base event * feat: add serialization to procedure change return event * feat: add serialization to procedure create event * feat: add serialization of the procedure delete event * feat: add serialization of procedure enable events * feat: add serialization of procedure parameter create events * feat: add serialization of the parameter delete event * feat: add serialization of procedure parameter rename events * feat: add serialization for procedure rename events
This commit is contained in:
@@ -181,10 +181,11 @@ suite('Procedure Change Return Event', function() {
|
||||
});
|
||||
});
|
||||
|
||||
suite.skip('serialization', function() {
|
||||
suite('serialization', function() {
|
||||
test('events round-trip through JSON', function() {
|
||||
const model = new Blockly.procedures.ObservableProcedureModel(
|
||||
this.workspace, 'test name', 'test id');
|
||||
this.procedureMap.add(model);
|
||||
const origEvent = new Blockly.Events.ProcedureChangeReturn(
|
||||
this.workspace, model, NON_DEFAULT_TYPES);
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ suite('Procedure Create Event', function() {
|
||||
});
|
||||
});
|
||||
|
||||
suite.skip('serialization', function() {
|
||||
suite('serialization', function() {
|
||||
test('events round-trip through JSON', function() {
|
||||
const model = new Blockly.procedures.ObservableProcedureModel(
|
||||
this.workspace, 'test name', 'test id');
|
||||
|
||||
@@ -146,10 +146,11 @@ suite('Procedure Delete Event', function() {
|
||||
});
|
||||
});
|
||||
|
||||
suite.skip('serialization', function() {
|
||||
suite('serialization', function() {
|
||||
test('events round-trip through JSON', function() {
|
||||
const model = new Blockly.procedures.ObservableProcedureModel(
|
||||
this.workspace, 'test name', 'test id');
|
||||
this.procedureMap.add(model);
|
||||
const origEvent = new Blockly.Events.ProcedureDelete(this.workspace, model);
|
||||
|
||||
const json = origEvent.toJson();
|
||||
|
||||
@@ -172,10 +172,11 @@ suite('Procedure Enable Event', function() {
|
||||
});
|
||||
});
|
||||
|
||||
suite.skip('serialization', function() {
|
||||
suite('serialization', function() {
|
||||
test('events round-trip through JSON', function() {
|
||||
const model = new Blockly.procedures.ObservableProcedureModel(
|
||||
this.workspace, 'test name', 'test id');
|
||||
this.procedureMap.add(model);
|
||||
const origEvent = new Blockly.Events.ProcedureEnable(this.workspace, model);
|
||||
|
||||
const json = origEvent.toJson();
|
||||
|
||||
@@ -197,16 +197,16 @@ suite('Procedure Parameter Create Event', function() {
|
||||
});
|
||||
});
|
||||
|
||||
suite.skip('serialization', function() {
|
||||
suite('serialization', function() {
|
||||
test('events round-trip through JSON', function() {
|
||||
const param = new Blockly.procedures.ObservableParameterModel(
|
||||
this.workspace, 'test param name', 'test param id');
|
||||
const model =
|
||||
new Blockly.procedures.ObservableProcedureModel(
|
||||
this.workspace, 'test name', 'test id')
|
||||
.insertParameter(param, 0);
|
||||
this.workspace, 'test name', 'test id');
|
||||
this.procedureMap.add(model);
|
||||
const origEvent = new Blockly.Events.ProcedureParameterCreate(
|
||||
this.workspace, model);
|
||||
this.workspace, model, param, 0);
|
||||
|
||||
const json = origEvent.toJson();
|
||||
const newEvent = new Blockly.Events.fromJson(json, this.workspace);
|
||||
|
||||
@@ -197,7 +197,7 @@ suite('Procedure Parameter Delete Event', function() {
|
||||
});
|
||||
});
|
||||
|
||||
suite.skip('serialization', function() {
|
||||
suite('serialization', function() {
|
||||
test('events round-trip through JSON', function() {
|
||||
const param = new Blockly.procedures.ObservableParameterModel(
|
||||
this.workspace, 'test param name', 'test param id');
|
||||
@@ -205,6 +205,7 @@ suite('Procedure Parameter Delete Event', function() {
|
||||
new Blockly.procedures.ObservableProcedureModel(
|
||||
this.workspace, 'test name', 'test id')
|
||||
.insertParameter(param, 0);
|
||||
this.procedureMap.add(model);
|
||||
const origEvent = new Blockly.Events.ProcedureParameterDelete(
|
||||
this.workspace, model);
|
||||
|
||||
|
||||
@@ -204,7 +204,7 @@ suite('Procedure Parameter Rename Event', function() {
|
||||
});
|
||||
});
|
||||
|
||||
suite.skip('serialization', function() {
|
||||
suite('serialization', function() {
|
||||
test('events round-trip through JSON', function() {
|
||||
const param = new Blockly.procedures.ObservableParameterModel(
|
||||
this.workspace, 'test param name', 'test param id');
|
||||
@@ -212,6 +212,7 @@ suite('Procedure Parameter Rename Event', function() {
|
||||
new Blockly.procedures.ObservableProcedureModel(
|
||||
this.workspace, 'test name', 'test id')
|
||||
.insertParameter(param, 0);
|
||||
this.procedureMap.add(model);
|
||||
const origEvent = new Blockly.Events.ProcedureParameterDelete(
|
||||
this.workspace, model);
|
||||
|
||||
|
||||
@@ -169,10 +169,11 @@ suite('Procedure Rename Event', function() {
|
||||
});
|
||||
});
|
||||
|
||||
suite.skip('serialization', function() {
|
||||
suite('serialization', function() {
|
||||
test('events round-trip through JSON', function() {
|
||||
const model = new Blockly.procedures.ObservableProcedureModel(
|
||||
this.workspace, 'test name', 'test id');
|
||||
this.procedureMap.add(model);
|
||||
const origEvent = new Blockly.Events.ProcedureRename(
|
||||
this.workspace, model, NON_DEFAULT_NAME);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user