@@ -42,18 +42,30 @@ describe('event directives', function() {
4242
4343 describe ( 'focus' , function ( ) {
4444
45- it ( 'should call the listener asynchronously during $apply' ,
46- inject ( function ( $rootScope , $compile ) {
47- element = $compile ( '<input type="text" ng-focus="focus()">' ) ( $rootScope ) ;
48- $rootScope . focus = jasmine . createSpy ( 'focus' ) ;
45+ describe ( 'call the listener asynchronously during $apply' , function ( ) {
46+ function run ( scope ) {
47+ inject ( function ( $compile ) {
48+ element = $compile ( '<input type="text" ng-focus="focus()">' ) ( scope ) ;
49+ scope . focus = jasmine . createSpy ( 'focus' ) ;
4950
50- $rootScope . $apply ( function ( ) {
51- element . triggerHandler ( 'focus' ) ;
52- expect ( $rootScope . focus ) . not . toHaveBeenCalled ( ) ;
53- } ) ;
51+ scope . $apply ( function ( ) {
52+ element . triggerHandler ( 'focus' ) ;
53+ expect ( scope . focus ) . not . toHaveBeenCalled ( ) ;
54+ } ) ;
5455
55- expect ( $rootScope . focus ) . toHaveBeenCalledOnce ( ) ;
56- } ) ) ;
56+ expect ( scope . focus ) . toHaveBeenCalledOnce ( ) ;
57+ } ) ;
58+ }
59+
60+ it ( 'should call the listener with non isolate scopes' , inject ( function ( $rootScope ) {
61+ run ( $rootScope . $new ( ) ) ;
62+ } ) ) ;
63+
64+ it ( 'should call the listener with isolate scopes' , inject ( function ( $rootScope ) {
65+ run ( $rootScope . $new ( true ) ) ;
66+ } ) ) ;
67+
68+ } ) ;
5769
5870 it ( 'should call the listener synchronously inside of $apply if outside of $apply' ,
5971 inject ( function ( $rootScope , $compile ) {
@@ -72,18 +84,30 @@ describe('event directives', function() {
7284
7385 describe ( 'blur' , function ( ) {
7486
75- it ( 'should call the listener asynchronously during $apply' ,
76- inject ( function ( $rootScope , $compile ) {
77- element = $compile ( '<input type="text" ng-blur="blur()">' ) ( $rootScope ) ;
78- $rootScope . blur = jasmine . createSpy ( 'blur' ) ;
87+ describe ( 'call the listener asynchronously during $apply' , function ( ) {
88+ function run ( scope ) {
89+ inject ( function ( $compile ) {
90+ element = $compile ( '<input type="text" ng-blur="blur()">' ) ( scope ) ;
91+ scope . blur = jasmine . createSpy ( 'blur' ) ;
7992
80- $rootScope . $apply ( function ( ) {
81- element . triggerHandler ( 'blur' ) ;
82- expect ( $rootScope . blur ) . not . toHaveBeenCalled ( ) ;
83- } ) ;
93+ scope . $apply ( function ( ) {
94+ element . triggerHandler ( 'blur' ) ;
95+ expect ( scope . blur ) . not . toHaveBeenCalled ( ) ;
96+ } ) ;
8497
85- expect ( $rootScope . blur ) . toHaveBeenCalledOnce ( ) ;
86- } ) ) ;
98+ expect ( scope . blur ) . toHaveBeenCalledOnce ( ) ;
99+ } ) ;
100+ }
101+
102+ it ( 'should call the listener with non isolate scopes' , inject ( function ( $rootScope ) {
103+ run ( $rootScope . $new ( ) ) ;
104+ } ) ) ;
105+
106+ it ( 'should call the listener with isolate scopes' , inject ( function ( $rootScope ) {
107+ run ( $rootScope . $new ( true ) ) ;
108+ } ) ) ;
109+
110+ } ) ;
87111
88112 it ( 'should call the listener synchronously inside of $apply if outside of $apply' ,
89113 inject ( function ( $rootScope , $compile ) {
0 commit comments