Matteo Scandolo | 46b5610 | 2015-12-16 14:23:08 -0800 | [diff] [blame] | 1 | describe('modal window', function() { |
| 2 | var $rootScope, $compile; |
| 3 | |
| 4 | beforeEach(module('ui.bootstrap.modal')); |
| 5 | beforeEach(module('template/modal/window.html')); |
| 6 | beforeEach(inject(function (_$rootScope_, _$compile_) { |
| 7 | $rootScope = _$rootScope_; |
| 8 | $compile = _$compile_; |
| 9 | })); |
| 10 | |
| 11 | it('should not use transclusion scope for modals content - issue 2110', function() { |
| 12 | $rootScope.animate = false; |
| 13 | $compile('<div uib-modal-window animate="animate"><span ng-init="foo=true"></span></div>')($rootScope); |
| 14 | $rootScope.$digest(); |
| 15 | |
| 16 | expect($rootScope.foo).toBeTruthy(); |
| 17 | }); |
| 18 | |
| 19 | it('should support custom CSS classes as string', function() { |
| 20 | $rootScope.animate = false; |
| 21 | var windowEl = $compile('<div uib-modal-window animate="animate" window-class="test foo">content</div>')($rootScope); |
| 22 | $rootScope.$digest(); |
| 23 | |
| 24 | expect(windowEl).toHaveClass('test'); |
| 25 | expect(windowEl).toHaveClass('foo'); |
| 26 | }); |
| 27 | |
| 28 | it('should support window top class', function () { |
| 29 | $rootScope.animate = false; |
| 30 | var windowEl = $compile('<div uib-modal-window animate="animate" window-top-class="test foo">content</div>')($rootScope); |
| 31 | $rootScope.$digest(); |
| 32 | |
| 33 | expect(windowEl).toHaveClass('test'); |
| 34 | expect(windowEl).toHaveClass('foo'); |
| 35 | }); |
| 36 | |
| 37 | it('should support custom template url', inject(function($templateCache) { |
| 38 | $templateCache.put('window.html', '<div class="mywindow" ng-transclude></div>'); |
| 39 | |
| 40 | var windowEl = $compile('<div uib-modal-window template-url="window.html" window-class="test">content</div>')($rootScope); |
| 41 | $rootScope.$digest(); |
| 42 | |
| 43 | expect(windowEl).toHaveClass('mywindow'); |
| 44 | expect(windowEl).toHaveClass('test'); |
| 45 | })); |
| 46 | }); |