Skip to content

Instantly share code, notes, and snippets.

@searls
Created October 15, 2011 15:36
Show Gist options
  • Save searls/1289719 to your computer and use it in GitHub Desktop.
Save searls/1289719 to your computer and use it in GitHub Desktop.
describe("clicking a show description link", function() {
beforeEach(function(){
loadFixtures("two_index_trip.html");
//I recommend against writing assertions in the 'arrange' phase
//because if you're test-driving, feedback from the system is all you need to validate your arrangement.
//expect($('#description_trip_2')).toBeHidden();
$("#detail_link_trip_2").click();
});
it("shows the trip description", function() {
expect($('#description_trip_2')).toBeVisible();
});
it('changes the link action to "Hide"',function(){
expect($('#detail_link_trip_2')).toHaveText("Hide Details");
});
describe('clicking the link again',function(){
beforeEach(function(){
$("#detail_link_trip_2").click();
});
it('hides the description',function(){
expect($('#description_trip_2')).toBeHidden();
});
it('Changes the link action back to "Show"',function(){
expect($('#detail_link_trip_2')).toHaveText("Show Details");
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment