Created
May 2, 2012 12:01
-
-
Save kimjoar/2576094 to your computer and use it in GitHub Desktop.
Testing a view
This file contains hidden or 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('user view', function() { | |
| it('should be able to show image', function() { | |
| var user = { | |
| image: "user.png" | |
| }; | |
| var view = new UserView($('<div></div>'), user); | |
| view.showImage(); | |
| // remember that `view.el` is a jQuery object. So now we can call | |
| // `find` on it directly instead of looking for `img` in the entire | |
| // DOM. | |
| var image = view.el.find('img'); | |
| expect(image.attr("src")).toEqual("user.png"); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment