@@ -17,19 +17,22 @@ describe('integration-tester', function() {
17
17
. readyOnLoad ( ) ;
18
18
19
19
beforeEach ( function ( ) {
20
- analytics = new Analytics ;
21
- integration = new Integration ;
20
+ analytics = new Analytics ( ) ;
21
+ integration = new Integration ( ) ;
22
22
analytics . use ( tester ) ;
23
23
analytics . add ( integration ) ;
24
24
} ) ;
25
25
26
26
it ( 'should compare two integrations' , function ( ) {
27
- analytics . compare ( Integration , createIntegration ( 'Name' )
28
- . global ( 'global' )
29
- . option ( 'option' , 'value' )
30
- . option ( 'object' , { } )
31
- . mapping ( 'map' )
32
- . readyOnLoad ( ) ) ;
27
+ analytics . compare (
28
+ Integration ,
29
+ createIntegration ( 'Name' )
30
+ . global ( 'global' )
31
+ . option ( 'option' , 'value' )
32
+ . option ( 'object' , { } )
33
+ . mapping ( 'map' )
34
+ . readyOnLoad ( )
35
+ ) ;
33
36
} ) ;
34
37
35
38
describe ( '#spy' , function ( ) {
@@ -151,7 +154,11 @@ describe('integration-tester', function() {
151
154
} ) ;
152
155
153
156
it ( 'should not throw if the spy returned the value' , function ( ) {
154
- var obj = { method : function ( ) { return 1 ; } } ;
157
+ var obj = {
158
+ method : function ( ) {
159
+ return 1 ;
160
+ }
161
+ } ;
155
162
analytics . spy ( obj , 'method' ) ;
156
163
obj . method ( ) ;
157
164
analytics . returned ( obj . method , 1 ) ;
@@ -166,7 +173,11 @@ describe('integration-tester', function() {
166
173
} ) ;
167
174
168
175
it ( 'should throw if the spy returned the value' , function ( ) {
169
- var obj = { method : function ( ) { return 1 ; } } ;
176
+ var obj = {
177
+ method : function ( ) {
178
+ return 1 ;
179
+ }
180
+ } ;
170
181
analytics . spy ( obj , 'method' ) ;
171
182
obj . method ( ) ;
172
183
assert [ 'throws' ] ( function ( ) {
@@ -220,9 +231,18 @@ describe('integration-tester', function() {
220
231
221
232
describe ( '#loaded' , function ( ) {
222
233
beforeEach ( function ( ) {
223
- Integration . tag ( 'example-img' , '<img src="http://example.com/{{name}}.png">' ) ;
224
- Integration . tag ( 'example-script' , '<script src="http://ajax.googleapis.com/ajax/libs/jquery/{{version}}/jquery.min.js"></script>' ) ;
225
- Integration . tag ( 'example-iframe' , '<iframe src="http://ad.doubleclick.net/activity;src=654757884637545;type=groupTag;cat=activityTag;ord=2700503028455676400?"></iframe>' ) ;
234
+ Integration . tag (
235
+ 'example-img' ,
236
+ '<img src="http://example.com/{{name}}.png">'
237
+ ) ;
238
+ Integration . tag (
239
+ 'example-script' ,
240
+ '<script src="http://ajax.googleapis.com/ajax/libs/jquery/{{version}}/jquery.min.js"></script>'
241
+ ) ;
242
+ Integration . tag (
243
+ 'example-iframe' ,
244
+ '<iframe src="http://ad.doubleclick.net/activity;src=654757884637545;type=groupTag;cat=activityTag;ord=2700503028455676400?"></iframe>'
245
+ ) ;
226
246
analytics = new Analytics ( ) ;
227
247
integration = new Integration ( ) ;
228
248
analytics . use ( tester ) ;
@@ -246,32 +266,43 @@ describe('integration-tester', function() {
246
266
describe ( 'script tag' , function ( ) {
247
267
it ( 'should throw if it does not find a script tag' , function ( ) {
248
268
assert [ 'throws' ] ( function ( ) {
249
- analytics . loaded ( '<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>' ) ;
269
+ analytics . loaded (
270
+ '<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>'
271
+ ) ;
250
272
} ) ;
251
273
} ) ;
252
274
253
275
it ( 'should not throw if it does find a script tag' , function ( ) {
254
276
integration . load ( 'example-script' , { version : '1.11.1' } ) ;
255
- analytics . loaded ( '<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>' ) ;
277
+ analytics . loaded (
278
+ '<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>'
279
+ ) ;
256
280
} ) ;
257
281
} ) ;
258
282
259
283
describe ( 'iframe tag' , function ( ) {
260
284
it ( 'should throw if it does not find a iframe tag' , function ( ) {
261
285
assert [ 'throws' ] ( function ( ) {
262
- analytics . loaded ( '<iframe src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></iframe>' ) ;
286
+ analytics . loaded (
287
+ '<iframe src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></iframe>'
288
+ ) ;
263
289
} ) ;
264
290
} ) ;
265
291
266
292
it ( 'should not throw if it does find a iframe tag' , function ( ) {
267
293
integration . load ( 'example-iframe' ) ;
268
- analytics . loaded ( '<iframe src="http://ad.doubleclick.net/activity;src=654757884637545;type=groupTag;cat=activityTag;ord=2700503028455676400?"></iframe>' ) ;
294
+ analytics . loaded (
295
+ '<iframe src="http://ad.doubleclick.net/activity;src=654757884637545;type=groupTag;cat=activityTag;ord=2700503028455676400?"></iframe>'
296
+ ) ;
269
297
} ) ;
270
298
} ) ;
271
299
272
300
it ( 'should accept integration argument' , function ( ) {
273
301
integration . load ( 'example-img' , { name : 'example' } ) ;
274
- analytics . loaded ( integration , '<img src="http://example.com/example.png"/>' ) ;
302
+ analytics . loaded (
303
+ integration ,
304
+ '<img src="http://example.com/example.png"/>'
305
+ ) ;
275
306
} ) ;
276
307
} ) ;
277
308
@@ -291,7 +322,7 @@ describe('integration-tester', function() {
291
322
292
323
it ( 'should not callback before all scripts have finished loading' , function ( done ) {
293
324
var script = document . createElement ( 'script' ) ;
294
- script . src = '/base/test/static/setGlobal.js' ;
325
+ script . src = '/base/test/static/setGlobal.js' ;
295
326
document . body . appendChild ( script ) ;
296
327
analytics . waitForScripts ( function ( ) {
297
328
document . body . removeChild ( script ) ;
@@ -303,7 +334,7 @@ describe('integration-tester', function() {
303
334
304
335
it ( 'should call all callbacks once scripts have finished loading' , function ( done ) {
305
336
var script = document . createElement ( 'script' ) ;
306
- script . src = '/base/test/static/setGlobal.js' ;
337
+ script . src = '/base/test/static/setGlobal.js' ;
307
338
document . body . appendChild ( script ) ;
308
339
var called = 0 ;
309
340
analytics . waitForScripts ( function ( ) {
0 commit comments