Skip to content

Instantly share code, notes, and snippets.

@dodecaphonic
Created July 19, 2011 13:18
Show Gist options
  • Save dodecaphonic/1092282 to your computer and use it in GitHub Desktop.
Save dodecaphonic/1092282 to your computer and use it in GitHub Desktop.
Como fica o fetchImage
it ("should set an image source into a tile", function() {
spyOn(tileProvider, 'fetchImage').andCallFake(function(tile) {
tile.image.src = 'http://localhost/fakeImage.jpg';
});
tileProvider.loadTile(tile);
waitsFor(function() {
return tile.state == ProjectViewer.Tile.State.ERROR;
}, 2000);
runs(function() {
expect(tile.image).not.toBeNull();
expect(tileProvider.fetchImage).toHaveBeenCalledWith(tile);
expect(tile.state).toEqual(ProjectViewer.Tile.State.ERROR); // redundante, já que estamos vendo isso no waitsFor
//expect(tile.image.src).toBe(tileProvider.getTileURL(tile.zoom, tile.x, tile.y));
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment