mirror of
https://github.com/google/blockly.git
synced 2026-01-11 10:57:07 +01:00
Minor stub and assert cleanup (#4185)
* Fix order or assert equal arguments. * Replace usages of callsFake with returns where appropriate
This commit is contained in:
@@ -199,14 +199,10 @@ suite('Connection Database', function() {
|
||||
setup(function() {
|
||||
// Ignore type checks.
|
||||
sinon.stub(this.database.connectionChecker_, 'doTypeChecks')
|
||||
.callsFake(function(_a, _b) {
|
||||
return true;
|
||||
});
|
||||
.returns(true);
|
||||
// Ignore safety checks.
|
||||
sinon.stub(this.database.connectionChecker_, 'doSafetyChecks')
|
||||
.callsFake(function(_a, _b) {
|
||||
return Blockly.Connection.CAN_CONNECT;
|
||||
});
|
||||
.returns(Blockly.Connection.CAN_CONNECT);
|
||||
// Skip everything but the distance checks.
|
||||
sinon.stub(this.database.connectionChecker_, 'doDragChecks')
|
||||
.callsFake(function(a, b, distance) {
|
||||
|
||||
@@ -730,7 +730,7 @@ suite('Events', function() {
|
||||
// The first varCreate and move event should have been ignored.
|
||||
sinon.assert.callCount(this.changeListenerSpy, 3);
|
||||
// Expect two events on undo stack: varCreate and block create.
|
||||
chai.assert.equal(2, this.workspace.undoStack_.length,
|
||||
chai.assert.equal(this.workspace.undoStack_.length, 2,
|
||||
'Undo stack length');
|
||||
|
||||
assertNthCallEventArgEquals(
|
||||
|
||||
@@ -395,9 +395,7 @@ suite('Navigation', function() {
|
||||
var block = this.workspace.getTopBlocks()[0];
|
||||
var field = block.inputList[0].fieldRow[0];
|
||||
|
||||
sinon.stub(field, 'onBlocklyAction').callsFake(function(){
|
||||
return true;
|
||||
});
|
||||
sinon.stub(field, 'onBlocklyAction').returns(true);
|
||||
this.workspace.getCursor().setCurNode(Blockly.ASTNode.createFieldNode(field));
|
||||
|
||||
var isHandled = Blockly.navigation.onBlocklyAction(Blockly.navigation.ACTION_OUT);
|
||||
|
||||
Reference in New Issue
Block a user