@@ -96,7 +96,7 @@ describe("PreloadJS.LoadQueue", function () {
9696
9797 it ( "should load an existing video tag" , function ( done ) {
9898 this . queue . addEventListener ( "fileload" , function ( evt ) {
99- expect ( evt . result == tag ) . toBe ( true ) ;
99+ expect ( evt . result ) . toEqual ( tag ) ;
100100 done ( ) ;
101101 } ) ;
102102
@@ -108,7 +108,7 @@ describe("PreloadJS.LoadQueue", function () {
108108
109109 it ( "should load an existing sound tag" , function ( done ) {
110110 this . queue . addEventListener ( "fileload" , function ( evt ) {
111- expect ( evt . result == tag ) . toBe ( true ) ;
111+ expect ( evt . result ) . toEqual ( tag ) ;
112112 done ( ) ;
113113 } ) ;
114114
@@ -119,17 +119,26 @@ describe("PreloadJS.LoadQueue", function () {
119119
120120 it ( "tag sound loading send progress events." , function ( done ) {
121121 var _this = this ;
122- var callback = function ( evt ) {
123- expect ( true ) . toBe ( true ) ;
124- sound . removeEventListener ( "progress" , callback ) ;
122+
123+ var func = {
124+ progress : function ( ) { }
125+ } ;
126+ spyOn ( func , 'progress' ) ;
127+
128+ var completeCallback = function ( evt ) {
129+ expect ( func . progress ) . toHaveBeenCalled ( ) ;
130+ sound . removeEventListener ( "progress" , func . progress ) ;
125131 done ( ) ;
126132 } ;
127133
128134 var sound = new createjs . SoundLoader ( {
129135 src : "audio/Thunder.mp3" ,
130136 type : createjs . LoadQueue . SOUND
131137 } ) ;
132- sound . addEventListener ( "progress" , callback ) ;
138+
139+ sound . addEventListener ( "progress" , func . progress ) ;
140+ sound . addEventListener ( "complete" , completeCallback ) ;
141+
133142 sound . load ( ) ;
134143 } ) ;
135144
@@ -143,7 +152,7 @@ describe("PreloadJS.LoadQueue", function () {
143152
144153 it ( "should load an existing image tag" , function ( done ) {
145154 this . queue . addEventListener ( "fileload" , function ( evt ) {
146- expect ( evt . result === tag ) . toBe ( true ) ;
155+ expect ( evt . result ) . toEqual ( tag ) ;
147156 done ( ) ;
148157 } ) ;
149158
@@ -330,12 +339,20 @@ describe("PreloadJS.LoadQueue", function () {
330339
331340 it ( "should send progress events." , function ( done ) {
332341 var _this = this ;
333- var callback = function ( evt ) {
334- expect ( true ) . toBe ( true ) ;
335- _this . queue . removeEventListener ( "progress" , callback ) ;
342+
343+ var func = {
344+ progress : function ( ) { }
345+ } ;
346+ spyOn ( func , 'progress' ) ;
347+
348+ var completeCallback = function ( evt ) {
349+ expect ( func . progress ) . toHaveBeenCalled ( ) ;
350+ _this . queue . removeEventListener ( "progress" , func . progress ) ;
336351 done ( ) ;
337352 } ;
338- this . queue . addEventListener ( "progress" , callback ) ;
353+ this . queue . addEventListener ( "progress" , func . progress ) ;
354+ this . queue . addEventListener ( "complete" , completeCallback ) ;
355+
339356 this . loadFile ( {
340357 src : "audio/Thunder.mp3" ,
341358 type : createjs . LoadQueue . SOUND
0 commit comments