11describe ( 'angular.scenario.Application' , function ( ) {
2+ var $window ;
23 var app , frames ;
34
45 function callLoadHandlers ( app ) {
@@ -52,61 +53,67 @@ describe('angular.scenario.Application', function() {
5253 } ) ;
5354
5455 it ( 'should use a new iframe each time' , function ( ) {
55- app . navigateTo ( 'about:blank ' ) ;
56+ app . navigateTo ( 'http://localhost/ ' ) ;
5657 var frame = app . getFrame_ ( ) ;
5758 frame . attr ( 'test' , true ) ;
58- app . navigateTo ( 'about:blank ' ) ;
59+ app . navigateTo ( 'http://localhost/ ' ) ;
5960 expect ( app . getFrame_ ( ) . attr ( 'test' ) ) . toBeFalsy ( ) ;
6061 } ) ;
6162
6263 it ( 'should call error handler if document not accessible' , function ( ) {
64+ var called ;
6365 app . getWindow_ = function ( ) {
6466 return { } ;
6567 } ;
66- app . navigateTo ( 'about:blank ' , angular . noop , function ( error ) {
68+ app . navigateTo ( 'http://localhost/ ' , angular . noop , function ( error ) {
6769 expect ( error ) . toMatch ( / S a n d b o x E r r o r / ) ;
70+ called = true ;
6871 } ) ;
6972 callLoadHandlers ( app ) ;
73+ expect ( called ) . toBeTruthy ( ) ;
7074 } ) ;
7175
72- it ( 'should call error handler if using file:// URL' , function ( ) {
73- app . navigateTo ( 'file://foo/bar.txt' , angular . noop , function ( error ) {
76+ it ( 'should call error handler if navigating to about:blank' , function ( ) {
77+ var called ;
78+ app . navigateTo ( 'about:blank' , angular . noop , function ( error ) {
7479 expect ( error ) . toMatch ( / S a n d b o x E r r o r / ) ;
80+ called = true ;
7581 } ) ;
82+ expect ( called ) . toBeTruthy ( ) ;
7683 } ) ;
7784
7885 it ( 'should call error handler if status check fails' , function ( ) {
7986 app . checkUrlStatus_ = function ( url , callback ) {
8087 callback . call ( this , 'Example Error' ) ;
8188 } ;
82- app . navigateTo ( 'about:blank ' , angular . noop , function ( error ) {
89+ app . navigateTo ( 'http://localhost/ ' , angular . noop , function ( error ) {
8390 expect ( error ) . toEqual ( 'Example Error' ) ;
8491 } ) ;
8592 } ) ;
8693
8794 it ( 'should hide old iframes and navigate to about:blank' , function ( ) {
88- app . navigateTo ( 'about:blank #foo' ) ;
89- app . navigateTo ( 'about:blank #bar' ) ;
95+ app . navigateTo ( 'http://localhost/ #foo' ) ;
96+ app . navigateTo ( 'http://localhost/ #bar' ) ;
9097 var iframes = frames . find ( 'iframe' ) ;
9198 expect ( iframes . length ) . toEqual ( 2 ) ;
9299 expect ( iframes [ 0 ] . src ) . toEqual ( 'about:blank' ) ;
93- expect ( iframes [ 1 ] . src ) . toEqual ( 'about:blank #bar' ) ;
100+ expect ( iframes [ 1 ] . src ) . toEqual ( 'http://localhost/ #bar' ) ;
94101 expect ( _jQuery ( iframes [ 0 ] ) . css ( 'display' ) ) . toEqual ( 'none' ) ;
95102 } ) ;
96103
97104 it ( 'should URL update description bar' , function ( ) {
98- app . navigateTo ( 'about:blank ' ) ;
105+ app . navigateTo ( 'http://localhost/ ' ) ;
99106 var anchor = frames . find ( '> h2 a' ) ;
100- expect ( anchor . attr ( 'href' ) ) . toEqual ( 'about:blank ' ) ;
101- expect ( anchor . text ( ) ) . toEqual ( 'about:blank ' ) ;
107+ expect ( anchor . attr ( 'href' ) ) . toEqual ( 'http://localhost/ ' ) ;
108+ expect ( anchor . text ( ) ) . toEqual ( 'http://localhost/ ' ) ;
102109 } ) ;
103110
104111 it ( 'should call onload handler when frame loads' , function ( ) {
105112 var called ;
106113 app . getWindow_ = function ( ) {
107114 return { document : { } } ;
108115 } ;
109- app . navigateTo ( 'about:blank ' , function ( $window , $document ) {
116+ app . navigateTo ( 'http://localhost/ ' , function ( $window , $document ) {
110117 called = true ;
111118 } ) ;
112119 callLoadHandlers ( app ) ;
@@ -130,7 +137,7 @@ describe('angular.scenario.Application', function() {
130137 notifyWhenNoOutstandingRequests : function ( fn ) {
131138 handlers . push ( fn ) ;
132139 }
133- }
140+ } ;
134141 } ;
135142 app . getWindow_ = function ( ) {
136143 return testWindow ;
@@ -173,35 +180,35 @@ describe('angular.scenario.Application', function() {
173180 expect ( options . type ) . toEqual ( 'HEAD' ) ;
174181 expect ( options . url ) . toEqual ( 'http://www.google.com/' ) ;
175182 } ) ;
176-
183+
177184 it ( 'should call error handler if status code is less than 200' , function ( ) {
178185 var finished ;
179186 response . status = 199 ;
180187 response . statusText = 'Error Message' ;
181- app . navigateTo ( 'about:blank ' , angular . noop , function ( error ) {
188+ app . navigateTo ( 'http://localhost/ ' , angular . noop , function ( error ) {
182189 expect ( error ) . toEqual ( '199 Error Message' ) ;
183190 finished = true ;
184191 } ) ;
185192 expect ( finished ) . toBeTruthy ( ) ;
186193 } ) ;
187-
194+
188195 it ( 'should call error handler if status code is greater than 299' , function ( ) {
189196 var finished ;
190197 response . status = 300 ;
191198 response . statusText = 'Error' ;
192- app . navigateTo ( 'about:blank ' , angular . noop , function ( error ) {
199+ app . navigateTo ( 'http://localhost/ ' , angular . noop , function ( error ) {
193200 expect ( error ) . toEqual ( '300 Error' ) ;
194201 finished = true ;
195202 } ) ;
196203 expect ( finished ) . toBeTruthy ( ) ;
197204 } ) ;
198-
205+
199206 it ( 'should call error handler if status code is 0 for sandbox error' , function ( ) {
200207 var finished ;
201208 response . status = 0 ;
202209 response . statusText = '' ;
203- app . navigateTo ( 'about:blank ' , angular . noop , function ( error ) {
204- expect ( error ) . toEqual ( 'Sandbox Error: Cannot access about:blank ' ) ;
210+ app . navigateTo ( 'http://localhost/ ' , angular . noop , function ( error ) {
211+ expect ( error ) . toEqual ( 'Sandbox Error: Cannot access http://localhost/ ' ) ;
205212 finished = true ;
206213 } ) ;
207214 expect ( finished ) . toBeTruthy ( ) ;
0 commit comments