From 76fabc91f72dd702ca7666a352167f334f0f651d Mon Sep 17 00:00:00 2001 From: Monica Kozbial Date: Tue, 29 Sep 2020 09:57:17 -0700 Subject: [PATCH] Capture deprecation warnings in tests that have associated bugs (#4314) --- tests/mocha/block_test.js | 3 +++ tests/mocha/comment_test.js | 13 +++++++++++++ tests/mocha/field_registry_test.js | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/tests/mocha/block_test.js b/tests/mocha/block_test.js index fc78017fc..5943b7cef 100644 --- a/tests/mocha/block_test.js +++ b/tests/mocha/block_test.js @@ -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'); diff --git a/tests/mocha/comment_test.js b/tests/mocha/comment_test.js index 55824823b..00ede6586 100644 --- a/tests/mocha/comment_test.js +++ b/tests/mocha/comment_test.js @@ -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(); diff --git a/tests/mocha/field_registry_test.js b/tests/mocha/field_registry_test.js index dffc47af6..29338d533 100644 --- a/tests/mocha/field_registry_test.js +++ b/tests/mocha/field_registry_test.js @@ -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'); });