@@ -531,47 +531,47 @@ describe('$uibModal', function () {
531
531
532
532
describe ( 'controller' , function ( ) {
533
533
it ( 'should accept controllers and inject modal instances' , function ( ) {
534
- var TestCtrl = function ( $scope , $modalInstance ) {
534
+ var TestCtrl = function ( $scope , $uibModalInstance ) {
535
535
$scope . fromCtrl = 'Content from ctrl' ;
536
- $scope . isModalInstance = angular . isObject ( $modalInstance ) && angular . isFunction ( $modalInstance . close ) ;
536
+ $scope . isModalInstance = angular . isObject ( $uibModalInstance ) && angular . isFunction ( $uibModalInstance . close ) ;
537
537
} ;
538
538
539
539
open ( { template : '<div>{{fromCtrl}} {{isModalInstance}}</div>' , controller : TestCtrl } ) ;
540
540
expect ( $document ) . toHaveModalOpenWithContent ( 'Content from ctrl true' , 'div' ) ;
541
541
} ) ;
542
542
543
543
it ( 'should accept controllerAs alias' , function ( ) {
544
- $controllerProvider . register ( 'TestCtrl' , function ( $modalInstance ) {
544
+ $controllerProvider . register ( 'TestCtrl' , function ( $uibModalInstance ) {
545
545
this . fromCtrl = 'Content from ctrl' ;
546
- this . isModalInstance = angular . isObject ( $modalInstance ) && angular . isFunction ( $modalInstance . close ) ;
546
+ this . isModalInstance = angular . isObject ( $uibModalInstance ) && angular . isFunction ( $uibModalInstance . close ) ;
547
547
} ) ;
548
548
549
549
open ( { template : '<div>{{test.fromCtrl}} {{test.isModalInstance}}</div>' , controller : 'TestCtrl as test' } ) ;
550
550
expect ( $document ) . toHaveModalOpenWithContent ( 'Content from ctrl true' , 'div' ) ;
551
551
} ) ;
552
552
553
553
it ( 'should respect the controllerAs property as an alternative for the controller-as syntax' , function ( ) {
554
- $controllerProvider . register ( 'TestCtrl' , function ( $modalInstance ) {
554
+ $controllerProvider . register ( 'TestCtrl' , function ( $uibModalInstance ) {
555
555
this . fromCtrl = 'Content from ctrl' ;
556
- this . isModalInstance = angular . isObject ( $modalInstance ) && angular . isFunction ( $modalInstance . close ) ;
556
+ this . isModalInstance = angular . isObject ( $uibModalInstance ) && angular . isFunction ( $uibModalInstance . close ) ;
557
557
} ) ;
558
558
559
559
open ( { template : '<div>{{test.fromCtrl}} {{test.isModalInstance}}</div>' , controller : 'TestCtrl' , controllerAs : 'test' } ) ;
560
560
expect ( $document ) . toHaveModalOpenWithContent ( 'Content from ctrl true' , 'div' ) ;
561
561
} ) ;
562
562
563
563
it ( 'should allow defining in-place controller-as controllers' , function ( ) {
564
- open ( { template : '<div>{{test.fromCtrl}} {{test.isModalInstance}}</div>' , controller : function ( $modalInstance ) {
564
+ open ( { template : '<div>{{test.fromCtrl}} {{test.isModalInstance}}</div>' , controller : function ( $uibModalInstance ) {
565
565
this . fromCtrl = 'Content from ctrl' ;
566
- this . isModalInstance = angular . isObject ( $modalInstance ) && angular . isFunction ( $modalInstance . close ) ;
566
+ this . isModalInstance = angular . isObject ( $uibModalInstance ) && angular . isFunction ( $uibModalInstance . close ) ;
567
567
} , controllerAs : 'test' } ) ;
568
568
expect ( $document ) . toHaveModalOpenWithContent ( 'Content from ctrl true' , 'div' ) ;
569
569
} ) ;
570
570
571
571
it ( 'should allow usage of bindToController' , function ( ) {
572
- open ( { template : '<div>{{test.fromCtrl}} {{test.isModalInstance}}</div>' , controller : function ( $modalInstance ) {
572
+ open ( { template : '<div>{{test.fromCtrl}} {{test.isModalInstance}}</div>' , controller : function ( $uibModalInstance ) {
573
573
this . fromCtrl = 'Content from ctrl' ;
574
- this . isModalInstance = angular . isObject ( $modalInstance ) && angular . isFunction ( $modalInstance . close ) ;
574
+ this . isModalInstance = angular . isObject ( $uibModalInstance ) && angular . isFunction ( $uibModalInstance . close ) ;
575
575
} , controllerAs : 'test' , bindToController : true } ) ;
576
576
expect ( $document ) . toHaveModalOpenWithContent ( 'Content from ctrl true' , 'div' ) ;
577
577
} ) ;
@@ -1201,7 +1201,7 @@ describe('$modal deprecation', function() {
1201
1201
inject ( function ( $modal , $timeout , $log , $rootScope ) {
1202
1202
spyOn ( $log , 'warn' ) ;
1203
1203
1204
- $modal . open ( { template : '<div>Foo</div>' } ) ;
1204
+ $modal . open ( { template : '<div>Foo</div>' , controller : function ( $modalInstance ) { } } ) ;
1205
1205
$rootScope . $digest ( ) ;
1206
1206
$timeout . flush ( 0 ) ;
1207
1207
expect ( $log . warn . calls . count ( ) ) . toBe ( 0 ) ;
@@ -1229,16 +1229,17 @@ describe('$modal deprecation', function() {
1229
1229
'</div>' ;
1230
1230
$templateCache . put ( 'template/modal/window.html' , windowTemplate ) ;
1231
1231
1232
- $modal . open ( { template : '<div>Foo</div>' } ) ;
1232
+ $modal . open ( { template : '<div>Foo</div>' , controller : function ( $modalInstance ) { } } ) ;
1233
1233
$rootScope . $digest ( ) ;
1234
1234
$timeout . flush ( 0 ) ;
1235
1235
1236
- expect ( $log . warn . calls . count ( ) ) . toBe ( 5 ) ;
1236
+ expect ( $log . warn . calls . count ( ) ) . toBe ( 6 ) ;
1237
1237
expect ( $log . warn . calls . argsFor ( 0 ) ) . toEqual ( [ '$modal is now deprecated. Use $uibModal instead.' ] ) ;
1238
- expect ( $log . warn . calls . argsFor ( 1 ) ) . toEqual ( [ '$modalStack is now deprecated. Use $uibModalStack instead.' ] ) ;
1239
- expect ( $log . warn . calls . argsFor ( 2 ) ) . toEqual ( [ 'modal-animation-class is now deprecated. Use uib-modal-animation-class instead.' ] ) ;
1238
+ expect ( $log . warn . calls . argsFor ( 1 ) ) . toEqual ( [ '$modalInstance is now deprecated. Use $uibModalInstance instead.' ] ) ;
1239
+ expect ( $log . warn . calls . argsFor ( 2 ) ) . toEqual ( [ '$modalStack is now deprecated. Use $uibModalStack instead.' ] ) ;
1240
1240
expect ( $log . warn . calls . argsFor ( 3 ) ) . toEqual ( [ 'modal-animation-class is now deprecated. Use uib-modal-animation-class instead.' ] ) ;
1241
- expect ( $log . warn . calls . argsFor ( 4 ) ) . toEqual ( [ 'modal-transclude is now deprecated. Use uib-modal-transclude instead.' ] ) ;
1241
+ expect ( $log . warn . calls . argsFor ( 4 ) ) . toEqual ( [ 'modal-animation-class is now deprecated. Use uib-modal-animation-class instead.' ] ) ;
1242
+ expect ( $log . warn . calls . argsFor ( 5 ) ) . toEqual ( [ 'modal-transclude is now deprecated. Use uib-modal-transclude instead.' ] ) ;
1242
1243
1243
1244
$log . warn . calls . reset ( ) ;
1244
1245
$compile ( '<div modal-backdrop></div>' ) ( $rootScope ) ;
0 commit comments