@@ -126,6 +126,7 @@ describe('createScript', () => {
126
126
127
127
it ( 'should set section attributes on the script element' , ( ) => {
128
128
const url = 'https://example.com/script.js' ;
129
+ const scriptHookUrl = 'https://example.com/hook-script.js' ;
129
130
const cb = jest . fn ( ) ;
130
131
const attrs = {
131
132
async : true ,
@@ -138,14 +139,15 @@ describe('createScript', () => {
138
139
attrs,
139
140
createScriptHook : ( url ) => {
140
141
const scriptEle = document . createElement ( 'script' ) ;
141
- scriptEle . src = url ;
142
+ scriptEle . src = scriptHookUrl ;
142
143
scriptEle . crossOrigin = 'use-credentials' ;
143
144
scriptEle . async = false ;
144
145
return scriptEle ;
145
146
} ,
146
147
} ) ;
147
148
148
149
// if user return element by createScriptHook, it will not add default attrs
150
+ expect ( script . src ) . toBe ( scriptHookUrl ) ;
149
151
expect ( script . async ) . toBe ( false ) ;
150
152
expect ( script . crossOrigin ) . toBe ( 'use-credentials' ) ;
151
153
expect ( script . getAttribute ( 'data-test' ) ) . toBe ( null ) ;
@@ -223,7 +225,7 @@ describe('createLink', () => {
223
225
} ,
224
226
} ) ;
225
227
226
- // if user return element by createScriptHook , it will not add default attrs
228
+ // if user return element by createLinkHook , it will not add default attrs
227
229
expect ( link . rel ) . toBe ( '' ) ;
228
230
expect ( link . crossOrigin ) . toBe ( 'use-credentials' ) ;
229
231
expect ( link . getAttribute ( 'as' ) ) . toBe ( null ) ;
0 commit comments