Created
November 24, 2014 12:16
-
-
Save philgyford/2585604d9619c436c153 to your computer and use it in GitHub Desktop.
jasmine-jquery SlideUp() test
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
<html> | |
<head> | |
<title>Test</title> | |
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script> | |
<script> | |
$( document ).ready(function() { | |
$('a.link-1').on('click', function (ev) { | |
ev.preventDefault(); | |
$('.para-1').hide(); | |
}); | |
$('a.link-2').on('click', function (ev) { | |
ev.preventDefault(); | |
$('.para-2').slideUp(); | |
}); | |
$('a.link-3').on('click', function (ev) { | |
ev.preventDefault(); | |
$('.para-3').slideDown(); | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<form action="#" method="get"> | |
<a href="#" class="link-1">Hide paragraph 1</a><br> | |
<a href="#" class="link-2">Slide Up paragraph 2</a><br> | |
<a href="#" class="link-3">Slide Down paragraph 3</a> | |
<p class="para-1"> | |
Paragraph 1 | |
</p> | |
<p class="para-2"> | |
Paragraph 2 | |
</p> | |
<p class="para-3" style="display: none;"> | |
Paragraph 3 | |
</p> | |
</form> | |
</body> | |
</html> |
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('Test', function() { | |
beforeEach(function(){ | |
loadFixtures('test.html'); | |
}); | |
it('Hides paragraph 1', function() { | |
$('a.link-1').click(); | |
expect($('.para-1')).not.toBeVisible(); | |
}); | |
it('Slides Up paragraph 2', function() { | |
$('a.link-2').click(); | |
expect($('.para-2')).not.toBeVisible(); | |
}); | |
it('Slides Down paragraph 3', function() { | |
$('a.link-3').click(); | |
expect($('.para-3')).toBeVisible(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment