aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng/directive/ngViewSpec.js
diff options
context:
space:
mode:
authorMatias Niemelàˆ2013-04-09 18:33:16 -0400
committerMisko Hevery2013-04-11 14:15:20 -0700
commit1351ba2632b5011ad6eaddf004a7f0411bea8453 (patch)
tree2afaf00419536007ee6330a3ff047708e931d5b5 /test/ng/directive/ngViewSpec.js
parent5476cb6e9b6d7a16e3a86585bc2db5e63b16cd4d (diff)
downloadangular.js-1351ba2632b5011ad6eaddf004a7f0411bea8453.tar.bz2
fix(ngAnimate): skip animation on first render
Diffstat (limited to 'test/ng/directive/ngViewSpec.js')
-rw-r--r--test/ng/directive/ngViewSpec.js35
1 files changed, 25 insertions, 10 deletions
diff --git a/test/ng/directive/ngViewSpec.js b/test/ng/directive/ngViewSpec.js
index dcdfe686..c0348568 100644
--- a/test/ng/directive/ngViewSpec.js
+++ b/test/ng/directive/ngViewSpec.js
@@ -486,7 +486,26 @@ describe('ngView', function() {
});
describe('ngAnimate', function() {
- var element, window;
+ var window;
+ var body, element;
+
+ function html(html) {
+ body.html(html);
+ element = body.children().eq(0);
+ return element;
+ }
+
+ beforeEach(function() {
+ // we need to run animation on attached elements;
+ body = jqLite(document.body);
+ });
+
+ afterEach(function(){
+ dealoc(body);
+ dealoc(element);
+ });
+
+
beforeEach(module(function($provide, $routeProvider) {
$provide.value('$window', window = angular.mock.createMockWindow());
@@ -496,13 +515,9 @@ describe('ngAnimate', function() {
}
}));
- afterEach(function(){
- dealoc(element);
- });
-
it('should fire off the enter animation + add and remove the css classes',
inject(function($compile, $rootScope, $sniffer, $location, $templateCache) {
- element = $compile('<div ng-view ng-animate="{enter: \'custom-enter\'}"></div>')($rootScope);
+ element = $compile(html('<div ng-view ng-animate="{enter: \'custom-enter\'}"></div>'))($rootScope);
$location.path('/foo');
$rootScope.$digest();
@@ -530,7 +545,7 @@ describe('ngAnimate', function() {
it('should fire off the leave animation + add and remove the css classes',
inject(function($compile, $rootScope, $sniffer, $location, $templateCache) {
$templateCache.put('/foo.html', [200, '<div>foo</div>', {}]);
- element = $compile('<div ng-view ng-animate="{leave: \'custom-leave\'}"></div>')($rootScope);
+ element = $compile(html('<div ng-view ng-animate="{leave: \'custom-leave\'}"></div>'))($rootScope);
$location.path('/foo');
$rootScope.$digest();
@@ -561,12 +576,12 @@ describe('ngAnimate', function() {
it('should catch and use the correct duration for animations',
inject(function($compile, $rootScope, $sniffer, $location, $templateCache) {
$templateCache.put('/foo.html', [200, '<div>foo</div>', {}]);
- element = $compile(
+ element = $compile(html(
'<div ' +
'ng-view ' +
- 'ng-animate="{enter: \'customEnter\'}">' +
+ 'ng-animate="{enter: \'customEnter\', animateFirst: false}">' +
'</div>'
- )($rootScope);
+ ))($rootScope);
$location.path('/foo');
$rootScope.$digest();