@@ -1081,16 +1081,48 @@ describe('globals', function() {
10811081 } ) ;
10821082
10831083 describe ( 'makeRequest' , function ( ) {
1084+ var imageCache ;
1085+
1086+ beforeEach ( function ( ) {
1087+ imageCache = [ ] ;
1088+ this . sinon . stub ( window , 'newImage' , function ( ) { var img = { } ; imageCache . push ( img ) ; return img ; } ) ;
1089+ } )
1090+
10841091 it ( 'should load an Image' , function ( ) {
10851092 authQueryString = '?lol' ;
10861093 globalServer = 'http://localhost/' ;
1087- var imageCache = [ ] ;
1088- this . sinon . stub ( window , 'newImage' , function ( ) { var img = { } ; imageCache . push ( img ) ; return img ; } ) ;
10891094
10901095 makeRequest ( { foo : 'bar' } ) ;
10911096 assert . equal ( imageCache . length , 1 ) ;
10921097 assert . equal ( imageCache [ 0 ] . src , 'http://localhost/?lol&sentry_data=%7B%22foo%22%3A%22bar%22%7D' ) ;
10931098 } ) ;
1099+
1100+ it ( 'should populate crossOrigin based on globalOptions' , function ( ) {
1101+ globalOptions = {
1102+ crossOrigin : 'something'
1103+ } ;
1104+ makeRequest ( { foo : 'bar' } ) ;
1105+ assert . equal ( imageCache . length , 1 ) ;
1106+ assert . equal ( imageCache [ 0 ] . crossOrigin , 'something' ) ;
1107+ } ) ;
1108+
1109+ it ( 'should populate crossOrigin if empty string' , function ( ) {
1110+ globalOptions = {
1111+ crossOrigin : ''
1112+ } ;
1113+ makeRequest ( { foo : 'bar' } ) ;
1114+ assert . equal ( imageCache . length , 1 ) ;
1115+ assert . equal ( imageCache [ 0 ] . crossOrigin , '' ) ;
1116+ } ) ;
1117+
1118+ it ( 'should not populate crossOrigin if falsey' , function ( ) {
1119+ globalOptions = {
1120+ crossOrigin : false
1121+ } ;
1122+ makeRequest ( { foo : 'bar' } ) ;
1123+ assert . equal ( imageCache . length , 1 ) ;
1124+ assert . isUndefined ( imageCache [ 0 ] . crossOrigin ) ;
1125+ } ) ;
10941126 } ) ;
10951127
10961128 describe ( 'handleStackInfo' , function ( ) {
0 commit comments