Add front end button to leave quest

This commit is contained in:
Blade Barringer
2015-08-23 22:38:55 -05:00
parent 0b7e43f156
commit bc24fa8130
9 changed files with 77 additions and 12 deletions

View File

@@ -71,7 +71,7 @@ describe("Party Controller", function() {
cancelSpy.should.have.been.calledOnce;
});
it('does not call Groups.questCancel when alert box is confirmed', function() {
it('does not call Groups.questCancel when alert box is not confirmed', function() {
windowSpy = sandbox.stub(window, "confirm", function(){return false});
scope.questCancel(party);
@@ -128,6 +128,35 @@ describe("Party Controller", function() {
});
});
describe('#questLeave', function() {
var party, leaveSpy, windowSpy;
beforeEach(function() {
party = {};
sandbox.stub(rootScope, 'hardRedirect');
leaveSpy = sandbox.stub(groups, 'questLeave').returns({
then: sandbox.stub().yields()
});
});
it('calls Groups.questLeave when alert box is confirmed', function() {
windowSpy = sandbox.stub(window, "confirm").returns(true);
scope.questLeave(party);
windowSpy.should.have.been.calledOnce;
windowSpy.should.have.been.calledWith(window.env.t('sureLeave'));
leaveSpy.should.have.been.calledOnce;
});
it('does not call Groups.questLeave when alert box is not confirmed', function() {
windowSpy = sandbox.stub(window, "confirm").returns(false);
scope.questLeave(party);
windowSpy.should.have.been.calledOnce;
leaveSpy.should.not.have.been.calledOnce;
});
});
describe('clickStartQuest', function() {
beforeEach(function() {
sandbox.stub(rootScope, 'openModal');