diff options
| author | Matias Niemelä | 2013-08-30 09:39:08 -0400 |
|---|---|---|
| committer | Misko Hevery | 2013-09-03 17:06:49 -0700 |
| commit | 40c0220c47c620070b30aec6ec4552c68a8689eb (patch) | |
| tree | 30cbf41f0866ae412606b9fab199c03d4e8d8b96 /test/ngRoute/directive/ngViewSpec.js | |
| parent | 36ad40b18cfdd0690411a5169aa94e222946b5cf (diff) | |
| download | angular.js-40c0220c47c620070b30aec6ec4552c68a8689eb.tar.bz2 | |
fix(ngView): ensure ngClass works with together with ngView's transclusion behavior
Closes: #3727
Diffstat (limited to 'test/ngRoute/directive/ngViewSpec.js')
| -rw-r--r-- | test/ngRoute/directive/ngViewSpec.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/test/ngRoute/directive/ngViewSpec.js b/test/ngRoute/directive/ngViewSpec.js index 1bce2b62..d354a355 100644 --- a/test/ngRoute/directive/ngViewSpec.js +++ b/test/ngRoute/directive/ngViewSpec.js @@ -600,6 +600,46 @@ describe('ngView animations', function() { expect(itemA).not.toEqual(itemB); var itemB = $animate.flushNext('enter').element; })); + + it('should render ngClass on ngView', + inject(function($compile, $rootScope, $templateCache, $animate, $location, $timeout) { + + var item; + $rootScope.tpl = 'one'; + $rootScope.klass = 'classy'; + element = $compile(html('<div><div ng-view ng-class="klass"></div></div>'))($rootScope); + $rootScope.$digest(); + + $location.path('/foo'); + $rootScope.$digest(); + + item = $animate.flushNext('enter').element; + + $animate.flushNext('addClass').element; + $animate.flushNext('addClass').element; + + expect(item.hasClass('classy')).toBe(true); + + $rootScope.klass = 'boring'; + $rootScope.$digest(); + + $animate.flushNext('removeClass').element; + $animate.flushNext('addClass').element; + + expect(item.hasClass('classy')).toBe(false); + expect(item.hasClass('boring')).toBe(true); + + $location.path('/bar'); + $rootScope.$digest(); + + $animate.flushNext('leave').element; + item = $animate.flushNext('enter').element; + + $animate.flushNext('addClass').element; + $animate.flushNext('addClass').element; + + expect(item.hasClass('boring')).toBe(true); + })); }); it('should not double compile when the route changes', function() { |
