mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1092953: update the room delete button test to take the confirm dialog into account. r=Standard8
This commit is contained in:
parent
011dcd1626
commit
e71f5882c6
@ -54,7 +54,8 @@ describe("loop.panel", function() {
|
||||
callback(null, []);
|
||||
},
|
||||
on: sandbox.stub()
|
||||
}
|
||||
},
|
||||
confirm: sandbox.stub()
|
||||
};
|
||||
|
||||
document.mozL10n.initialize(navigator.mozLoop);
|
||||
@ -815,15 +816,27 @@ describe("loop.panel", function() {
|
||||
expect(deleteButton).to.not.equal(null);
|
||||
});
|
||||
|
||||
it("should call the delete function when clicked", function() {
|
||||
it("should dispatch a delete action when confirmation is granted", function() {
|
||||
sandbox.stub(dispatcher, "dispatch");
|
||||
|
||||
navigator.mozLoop.confirm.callsArgWith(1, null, true);
|
||||
TestUtils.Simulate.click(deleteButton);
|
||||
|
||||
sinon.assert.calledOnce(navigator.mozLoop.confirm);
|
||||
sinon.assert.calledOnce(dispatcher.dispatch);
|
||||
sinon.assert.calledWithExactly(dispatcher.dispatch,
|
||||
new sharedActions.DeleteRoom({roomToken: roomData.roomToken}));
|
||||
});
|
||||
|
||||
it("should not dispatch an action when the confirmation is cancelled", function() {
|
||||
sandbox.stub(dispatcher, "dispatch");
|
||||
|
||||
navigator.mozLoop.confirm.callsArgWith(1, null, false);
|
||||
TestUtils.Simulate.click(deleteButton);
|
||||
|
||||
sinon.assert.calledOnce(navigator.mozLoop.confirm);
|
||||
sinon.assert.notCalled(dispatcher.dispatch);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Room URL click", function() {
|
||||
|
Loading…
Reference in New Issue
Block a user