mirror of
https://github.com/google/blockly.git
synced 2026-01-04 23:50:12 +01:00
feat: added intermediate event change (#7671)
* feat: added intermediate event change * fix: update prettier format for the code * fix: update comment style * fix: update test statements
This commit is contained in:
@@ -35,4 +35,38 @@ suite('Field Intermediate Change Event', function () {
|
||||
chai.assert.deepEqual(newEvent, origEvent);
|
||||
});
|
||||
});
|
||||
|
||||
suite('Change Value', function () {
|
||||
test("running forward changes the block's value to new value", function () {
|
||||
const block = this.workspace.newBlock('text', 'block_id');
|
||||
const origEvent = new Blockly.Events.BlockFieldIntermediateChange(
|
||||
block,
|
||||
'TEXT',
|
||||
'old value',
|
||||
'new value',
|
||||
);
|
||||
origEvent.run(true);
|
||||
|
||||
chai.assert.deepEqual(
|
||||
block.getField(origEvent.name).getValue(),
|
||||
'new value',
|
||||
);
|
||||
});
|
||||
|
||||
test("running backward changes the block's value to old value", function () {
|
||||
const block = this.workspace.newBlock('text', 'block_id');
|
||||
const origEvent = new Blockly.Events.BlockFieldIntermediateChange(
|
||||
block,
|
||||
'TEXT',
|
||||
'old value',
|
||||
'new value',
|
||||
);
|
||||
origEvent.run(false);
|
||||
|
||||
chai.assert.deepEqual(
|
||||
block.getField(origEvent.name).getValue(),
|
||||
'old value',
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user