aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng/directive/ngIncludeSpec.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/ngIncludeSpec.js
parent5476cb6e9b6d7a16e3a86585bc2db5e63b16cd4d (diff)
downloadangular.js-1351ba2632b5011ad6eaddf004a7f0411bea8453.tar.bz2
fix(ngAnimate): skip animation on first render
Diffstat (limited to 'test/ng/directive/ngIncludeSpec.js')
-rw-r--r--test/ng/directive/ngIncludeSpec.js31
1 files changed, 24 insertions, 7 deletions
diff --git a/test/ng/directive/ngIncludeSpec.js b/test/ng/directive/ngIncludeSpec.js
index 191eaa05..4798bacc 100644
--- a/test/ng/directive/ngIncludeSpec.js
+++ b/test/ng/directive/ngIncludeSpec.js
@@ -282,7 +282,24 @@ describe('ngInclude', function() {
});
describe('ngInclude ngAnimate', function() {
- var element, vendorPrefix, window;
+ var vendorPrefix, 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($animationProvider, $provide) {
$provide.value('$window', window = angular.mock.createMockWindow());
@@ -300,12 +317,12 @@ describe('ngInclude ngAnimate', function() {
$templateCache.put('enter', [200, '<div>data</div>', {}]);
$rootScope.tpl = 'enter';
- element = $compile(
+ element = $compile(html(
'<div ' +
'ng-include="tpl" ' +
'ng-animate="{enter: \'custom-enter\'}">' +
'</div>'
- )($rootScope);
+ ))($rootScope);
$rootScope.$digest();
//if we add the custom css stuff here then it will get picked up before the animation takes place
@@ -332,12 +349,12 @@ describe('ngInclude ngAnimate', function() {
inject(function($compile, $rootScope, $templateCache, $sniffer) {
$templateCache.put('enter', [200, '<div>data</div>', {}]);
$rootScope.tpl = 'enter';
- element = $compile(
+ element = $compile(html(
'<div ' +
'ng-include="tpl" ' +
'ng-animate="{leave: \'custom-leave\'}">' +
'</div>'
- )($rootScope);
+ ))($rootScope);
$rootScope.$digest();
//if we add the custom css stuff here then it will get picked up before the animation takes place
@@ -367,12 +384,12 @@ describe('ngInclude ngAnimate', function() {
inject(function($compile, $rootScope, $templateCache, $sniffer) {
$templateCache.put('enter', [200, '<div>data</div>', {}]);
$rootScope.tpl = 'enter';
- element = $compile(
+ element = $compile(html(
'<div ' +
'ng-include="tpl" ' +
'ng-animate="{enter: \'custom-enter\'}">' +
'</div>'
- )($rootScope);
+ ))($rootScope);
$rootScope.$digest();
//if we add the custom css stuff here then it will get picked up before the animation takes place