From 2a5c1f279c9dfc58eae62bfd052cb0398527af1d Mon Sep 17 00:00:00 2001 From: Kirk Stork Date: Wed, 19 Mar 2014 18:42:14 -0700 Subject: [PATCH] test(macModal): Add tests demonstrating premature calls to Modal callbacks. --- test/unit/modal.spec.coffee | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/unit/modal.spec.coffee b/test/unit/modal.spec.coffee index 88bedd2..c7e854c 100644 --- a/test/unit/modal.spec.coffee +++ b/test/unit/modal.spec.coffee @@ -130,6 +130,7 @@ describe "Mac modal", -> modalElement = $compile("") $rootScope $rootScope.$digest() + expect(opened).toBe false modal.show "test-modal" $timeout.flush() @@ -140,6 +141,8 @@ describe "Mac modal", -> modalElement = $compile("") $rootScope $rootScope.$digest() + expect($rootScope.beforeShow).not.toHaveBeenCalled() + modal.show "test-modal" $timeout.flush() @@ -150,6 +153,8 @@ describe "Mac modal", -> modalElement = $compile("") $rootScope $rootScope.$digest() + expect($rootScope.afterShow).not.toHaveBeenCalled() + modal.show "test-modal" $timeout.flush() @@ -160,7 +165,12 @@ describe "Mac modal", -> modalElement = $compile("") $rootScope $rootScope.$digest() + expect($rootScope.beforeHide).not.toHaveBeenCalled() + modal.show "test-modal" + + expect($rootScope.beforeHide).not.toHaveBeenCalled() + $timeout.flush() modal.hide() @@ -171,8 +181,13 @@ describe "Mac modal", -> modalElement = $compile("") $rootScope $rootScope.$digest() + expect($rootScope.afterHide).not.toHaveBeenCalled() + modal.show "test-modal" $timeout.flush() + + expect($rootScope.afterHide).not.toHaveBeenCalled() + modal.hide() expect($rootScope.afterHide).toHaveBeenCalled()