Capture deprecation warnings in tests that have associated bugs (#4314)

This commit is contained in:
Monica Kozbial
2020-09-29 09:57:17 -07:00
committed by GitHub
parent a0370f1b34
commit 76fabc91f7
3 changed files with 24 additions and 0 deletions

View File

@@ -1081,7 +1081,10 @@ suite('Blocks', function() {
// Restored up by call to sinon.restore() in sharedTestTeardown()
sinon.stub(this.block, 'isEditable').returns(false);
var icon = this.block.getCommentIcon();
// TODO(#4186): Remove stubbing of deprecation warning after fixing.
var deprecationWarnStub = createDeprecationWarningStub();
icon.setVisible(true);
deprecationWarnStub.restore();
this.block.setCommentText('test2');
chai.assert.equal(this.block.getCommentText(), 'test2');

View File

@@ -55,7 +55,11 @@ suite('Comments', function() {
test('Not Editable', function() {
sinon.stub(this.block, 'isEditable').returns(false);
// TODO(#4186): Remove stubbing of deprecation warning after fixing.
var deprecationWarnStub = createDeprecationWarningStub();
this.comment.setVisible(true);
deprecationWarnStub.restore();
chai.assert.isTrue(this.comment.isVisible());
assertNotEditable(this.comment);
assertEventFired(
@@ -67,7 +71,11 @@ suite('Comments', function() {
this.comment.setVisible(true);
sinon.stub(this.block, 'isEditable').returns(false);
// TODO(#4186): Remove stubbing of deprecation warning after fixing.
var deprecationWarnStub = createDeprecationWarningStub();
this.comment.updateEditable();
deprecationWarnStub.restore();
chai.assert.isTrue(this.comment.isVisible());
assertNotEditable(this.comment);
assertEventFired(
@@ -77,7 +85,12 @@ suite('Comments', function() {
});
test('Not Editable -> Editable', function() {
var editableStub = sinon.stub(this.block, 'isEditable').returns(false);
// TODO(#4186): Remove stubbing of deprecation warning after fixing.
var deprecationWarnStub = createDeprecationWarningStub();
this.comment.setVisible(true);
deprecationWarnStub.restore();
editableStub.returns(true);
this.comment.updateEditable();

View File

@@ -64,7 +64,11 @@ suite('Field Registry', function() {
value: 'ok'
};
// TODO(#4197): Remove stubbing of deprecation warning after fixing.
var deprecationWarnStub = createDeprecationWarningStub();
var field = Blockly.fieldRegistry.fromJson(json);
deprecationWarnStub.restore();
chai.assert.isNotNull(field);
chai.assert.equal(field.getValue(), 'ok');
});
@@ -88,7 +92,11 @@ suite('Field Registry', function() {
value: 'ok'
};
// TODO(#4197): Remove stubbing of deprecation warning after fixing.
var deprecationWarnStub = createDeprecationWarningStub();
var field = Blockly.fieldRegistry.fromJson(json);
deprecationWarnStub.restore();
chai.assert.isNotNull(field);
chai.assert.equal(field.getValue(), 'ok');
});