@@ -1081,16 +1081,48 @@ describe('globals', function() {
1081
1081
} ) ;
1082
1082
1083
1083
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
+
1084
1091
it ( 'should load an Image' , function ( ) {
1085
1092
authQueryString = '?lol' ;
1086
1093
globalServer = 'http://localhost/' ;
1087
- var imageCache = [ ] ;
1088
- this . sinon . stub ( window , 'newImage' , function ( ) { var img = { } ; imageCache . push ( img ) ; return img ; } ) ;
1089
1094
1090
1095
makeRequest ( { foo : 'bar' } ) ;
1091
1096
assert . equal ( imageCache . length , 1 ) ;
1092
1097
assert . equal ( imageCache [ 0 ] . src , 'http://localhost/?lol&sentry_data=%7B%22foo%22%3A%22bar%22%7D' ) ;
1093
1098
} ) ;
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
+ } ) ;
1094
1126
} ) ;
1095
1127
1096
1128
describe ( 'handleStackInfo' , function ( ) {
0 commit comments