mirror of
https://github.com/google/blockly.git
synced 2026-01-10 10:27:08 +01:00
feat!: Add support for preserving block comment locations. (#8231)
* feat: Add support for preserving block comment locations. * chore: format the tests.
This commit is contained in:
@@ -1388,6 +1388,10 @@ suite('Blocks', function () {
|
||||
return Blockly.utils.Size(0, 0);
|
||||
}
|
||||
|
||||
setBubbleLocation() {}
|
||||
|
||||
getBubbleLocation() {}
|
||||
|
||||
bubbleIsVisible() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -141,4 +141,30 @@ suite('Comments', function () {
|
||||
assertBubbleSize(this.comment, 100, 100);
|
||||
});
|
||||
});
|
||||
suite('Set/Get Bubble Location', function () {
|
||||
teardown(function () {
|
||||
sinon.restore();
|
||||
});
|
||||
function assertBubbleLocation(comment, x, y) {
|
||||
const location = comment.getBubbleLocation();
|
||||
assert.equal(location.x, x);
|
||||
assert.equal(location.y, y);
|
||||
}
|
||||
test('Set Location While Visible', function () {
|
||||
this.comment.setBubbleVisible(true);
|
||||
|
||||
this.comment.setBubbleLocation(new Blockly.utils.Coordinate(100, 100));
|
||||
assertBubbleLocation(this.comment, 100, 100);
|
||||
|
||||
this.comment.setBubbleVisible(false);
|
||||
assertBubbleLocation(this.comment, 100, 100);
|
||||
});
|
||||
test('Set Location While Invisible', function () {
|
||||
this.comment.setBubbleLocation(new Blockly.utils.Coordinate(100, 100));
|
||||
assertBubbleLocation(this.comment, 100, 100);
|
||||
|
||||
this.comment.setBubbleVisible(true);
|
||||
assertBubbleLocation(this.comment, 100, 100);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user