Created
March 11, 2016 14:20
-
-
Save mhairston/c09b9bcf95e89bd30c3b to your computer and use it in GitHub Desktop.
Jasmine sample test code
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
/* | |
Jasmine sample code | |
This file is called a spec. | |
describe() groups related tests within a spec. | |
it() contains a single test. | |
The outer describe() matches the name of the module being tested. | |
Select elements only via test-foo classes! | |
*/ | |
describe("VHL.MyModuleName", function () { | |
describe('hide translation', function() { | |
it('toggles the translation when both are not visible', function() { | |
$('.test-target').css('visibility', 'visible'); | |
$('.test-translation').css('visibility', 'hidden'); | |
$('.test-hide_target').trigger('click'); | |
expect($('.test-translation')).toHaveCss({'visibility': 'visible'}); | |
}); | |
it('toggles the visibility', function() { | |
$('.test-hide_translation').trigger('click'); | |
expect($('.test-translation')).toHaveCss({'visibility': 'hidden'}); | |
$('.test-hide_translation').trigger('click'); | |
expect($('.test-translation')).toHaveCss({'visibility': 'visible'}); | |
}); | |
it('toggles the target when both are not visible', function() { | |
$('.test-target').css('visibility', 'hidden'); | |
$('.test-translation').css('visibility', 'visible'); | |
$('.test-hide_translation').trigger('click'); | |
expect($('.test-target')).toHaveCss({'visibility': 'visible'}); | |
}) | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment