Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gaizka-allende/ded21cdb49578e7a1f10e35c874882ed to your computer and use it in GitHub Desktop.
Save gaizka-allende/ded21cdb49578e7a1f10e35c874882ed to your computer and use it in GitHub Desktop.
Jasmine test for hidden element
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