Created
July 18, 2012 09:44
-
-
Save biot023/3135295 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe( "setFailed()", function() { | |
var imageBox = new ImageBox( widget, boxesList ); | |
var element = new MockElement(); | |
var subject = function() { imageBox.setFailed(); return imageBox; } | |
beforeEach( function() { | |
widget.imageBoxes = [ {}, imageBox, {} ]; | |
imageBox.element = element; | |
spyOn( element, "removeClass" ); | |
spyOn( element, "addClass" ); | |
spyOn( element, "delay" ).andReturn( element ); | |
spyOn( element, "fadeOut" ).andCallThrough(); | |
spyOn( element, "remove" ); | |
spyOn( widget, "populateImageBoxes" ); | |
spyOn( widget, "setSelectionBox" ); | |
} ); | |
it( "should change the class to 'failed'", function() { | |
subject(); | |
expect( element.removeClass ).toHaveBeenCalledWith( "uploading" ); | |
expect( element.addClass ).toHaveBeenCalledWith( "failed" ); | |
} ); | |
it( "should set the state as 'failed'", function() { | |
expect( subject().state ).toEqual( "failed" ); | |
} ); | |
it( "should set itself to disappear", function() { | |
subject(); | |
expect( element.delay ).toHaveBeenCalled(); | |
expect( element.fadeOut ).toHaveBeenCalled(); | |
expect( element.remove ).toHaveBeenCalled(); | |
} ); | |
xit( "should remove itself from the widget's image boxes collection", function() { | |
subject(); | |
expect( widget.imageBoxes ).not.toContain( imageBox ); | |
} ); | |
xit( "should tell its owning widget to populate its image boxes", function() { | |
subject(); | |
expect( widget.populateImageBoxes ).toHaveBeenCalled(); | |
} ); | |
xit( "should tell its owning widget to set its selection box", function() { | |
subject(); | |
expect( widget.setSelectionBox ).toHaveBeenCalled(); | |
} ); | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment