From 15389b0e377e2a84b85178e993e4940d8098d0ed Mon Sep 17 00:00:00 2001
From: Matias Niemelàˆ
Date: Mon, 22 Jul 2013 15:37:45 -0400
Subject: fix(ngAnimate): $timeout integration and cancel callbacks added
---
test/ngRoute/directive/ngViewSpec.js | 32 ++++++--------------------------
1 file changed, 6 insertions(+), 26 deletions(-)
(limited to 'test/ngRoute/directive')
diff --git a/test/ngRoute/directive/ngViewSpec.js b/test/ngRoute/directive/ngViewSpec.js
index 7d96a581..0cc70bc5 100644
--- a/test/ngRoute/directive/ngViewSpec.js
+++ b/test/ngRoute/directive/ngViewSpec.js
@@ -623,7 +623,7 @@ describe('ngView animations', function() {
});
});
- inject(function($rootScope, $compile, $location, $route, $window, $rootElement, $sniffer, $animate) {
+ inject(function($rootScope, $compile, $location, $route, $timeout, $rootElement, $sniffer, $animate) {
element = $compile(html('
'))($rootScope);
$animate.enabled(true);
@@ -632,20 +632,12 @@ describe('ngView animations', function() {
$animate.process('enter'); //ngView
- if($sniffer.transitions) {
- $window.setTimeout.expect(1).process();
- $window.setTimeout.expect(0).process();
- }
+ $timeout.flush();
$animate.process('enter'); //repeat 1
$animate.process('enter'); //repeat 2
- if($sniffer.transitions) {
- $window.setTimeout.expect(1).process();
- $window.setTimeout.expect(1).process();
- $window.setTimeout.expect(0).process();
- $window.setTimeout.expect(0).process();
- }
+ $timeout.flush();
expect(element.text()).toEqual('12');
@@ -653,29 +645,17 @@ describe('ngView animations', function() {
$rootScope.$digest();
$animate.process('leave'); //ngView old
- if($sniffer.transitions) {
- $window.setTimeout.expect(1).process();
- $window.setTimeout.expect(0).process();
- }
+ $timeout.flush();
$animate.process('enter'); //ngView new
- if($sniffer.transitions) {
- $window.setTimeout.expect(1).process();
- $window.setTimeout.expect(0).process();
- }
+ $timeout.flush();
expect(n(element.text())).toEqual(''); //this is midway during the animation
$animate.process('enter'); //ngRepeat 3
$animate.process('enter'); //ngRepeat 4
-
- if($sniffer.transitions) {
- $window.setTimeout.expect(1).process();
- $window.setTimeout.expect(1).process();
- $window.setTimeout.expect(0).process();
- $window.setTimeout.expect(0).process();
- }
+ $timeout.flush();
expect(element.text()).toEqual('34');
--
cgit v1.2.3