From 8026e992197a0d46d765ecfe0eb3d1601ca27984 Mon Sep 17 00:00:00 2001 From: hairlessbear Date: Mon, 22 Jun 2015 20:48:11 -0400 Subject: [PATCH] Added quest completion modal watch tests --- test/spec/controllers/notificationCtrlSpec.js | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/spec/controllers/notificationCtrlSpec.js b/test/spec/controllers/notificationCtrlSpec.js index 5d7edc50c7..e67c2f5b61 100644 --- a/test/spec/controllers/notificationCtrlSpec.js +++ b/test/spec/controllers/notificationCtrlSpec.js @@ -67,4 +67,24 @@ describe('Notification Controller', function() { expect(rootScope.openModal).to.be.calledWith('questCompleted', {controller:'InventoryCtrl'}); }); }); + describe('Quest Completion modal watch', function() { + beforeEach(function() { + sandbox.stub(rootScope, 'openModal'); + }); + + it('opens quest completion modal', function() { + user.party.quest.completed = "hedgebeast"; + scope.$digest(); + + expect(rootScope.openModal).to.be.calledOnce; + expect(rootScope.openModal).to.be.calledWith('questCompleted', {controller:'InventoryCtrl'}); + }); + + it('does not open quest completion modal if quest.completed is null', function() { + user.party.quest.completed = null; + scope.$digest(); + + expect(rootScope.openModal).to.not.be.called; + }); + }); });