Created
March 1, 2014 12:39
-
-
Save adamrights/9289200 to your computer and use it in GitHub Desktop.
This file contains hidden or 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("DOM Tests", function () { | |
var el = document.createElement("div"); | |
el.id = "myDiv"; | |
el.innerHTML = "Hi there!"; | |
el.style.background = "#ccc"; | |
document.body.appendChild(el); | |
var myEl = document.getElementById('myDiv'); | |
it("is in the DOM", function () { | |
expect(myEl).not.toBeNull(); | |
}); | |
it("is a child of the body", function () { | |
expect(myEl.parentElement).toBe(document.body); | |
}); | |
it("has the right text", function () { | |
expect(myEl.innerHTML).toEqual("Hi there!"); | |
}); | |
it("has the right background", function () { | |
expect(myEl.style.background).toEqual("rgb(204, 204, 204)"); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment