mirror of
https://github.com/google/blockly.git
synced 2026-01-18 06:17:12 +01:00
Update captureWarnings usages to assertWarnings
This commit is contained in:
@@ -257,12 +257,10 @@ suite('Registry', function() {
|
||||
test('Incorrect Plugin Name', function() {
|
||||
this.options['plugins']['test'] = 'random';
|
||||
var testClass;
|
||||
var warnings = testHelpers.captureWarnings(() => {
|
||||
assertWarnings(() => {
|
||||
testClass = Blockly.registry.getClassFromOptions('test', this.options);
|
||||
});
|
||||
}, /Unable to find/);
|
||||
chai.assert.isNull(testClass);
|
||||
chai.assert.equal(warnings.length, 1,
|
||||
'Expecting 1 warning about no name "random" found.');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
goog.module('Blockly.test.workspaceHelpers');
|
||||
|
||||
const {assertVariableValues, workspaceTeardown} = goog.require('Blockly.test.helpers');
|
||||
const {assertVariableValues, assertWarnings, workspaceTeardown} = goog.require('Blockly.test.helpers');
|
||||
|
||||
|
||||
function testAWorkspace() {
|
||||
@@ -1294,11 +1294,9 @@ function testAWorkspace() {
|
||||
this.workspace.createVariable('name1', 'type1', 'id1');
|
||||
this.workspace.deleteVariableById('id1');
|
||||
var workspace = this.workspace;
|
||||
var warnings = testHelpers.captureWarnings(function() {
|
||||
assertWarnings(() => {
|
||||
workspace.deleteVariableById('id1');
|
||||
});
|
||||
chai.assert.equal(warnings.length, 1,
|
||||
'Expected 1 warning for second deleteVariableById call.');
|
||||
}, /Can't delete/);
|
||||
|
||||
// Check the undoStack only recorded one delete event.
|
||||
var undoStack = this.workspace.undoStack_;
|
||||
@@ -1323,11 +1321,9 @@ function testAWorkspace() {
|
||||
createVarBlocksNoEvents(this.workspace, ['id1']);
|
||||
this.workspace.deleteVariableById('id1');
|
||||
var workspace = this.workspace;
|
||||
var warnings = testHelpers.captureWarnings(function() {
|
||||
assertWarnings(() => {
|
||||
workspace.deleteVariableById('id1');
|
||||
});
|
||||
chai.assert.equal(warnings.length, 1,
|
||||
'Expected 1 warning for second deleteVariableById call.');
|
||||
}, /Can't delete/);
|
||||
|
||||
// Check the undoStack only recorded one delete event.
|
||||
var undoStack = this.workspace.undoStack_;
|
||||
|
||||
Reference in New Issue
Block a user