Created
July 22, 2016 10:47
-
-
Save gaizka-allende/ded21cdb49578e7a1f10e35c874882ed to your computer and use it in GitHub Desktop.
Jasmine test for hidden element
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("Search", function() { | |
//css should be included in Karma config | |
var divElem = document.createElement('div'); | |
divElem.id = 'sample-div'; | |
document.body.appendChild(divElem); | |
it("sample div should be hidden", function() { | |
//the hidden class should be in the css | |
divElem.className += " hidden"; | |
var elemStyle = window.getComputedStyle(divElem); | |
expect(elemStyle.getPropertyValue('display')).toEqual('none'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment