text.test.js 633 B

1234567891011121314151617181920212223
  1. require("./chai.helper");
  2. var domHelper = require("./dom.helper");
  3. describe("text", function () {
  4. var expected = "I am the text for no2";
  5. beforeEach(function () {
  6. domHelper(
  7. "<div id=\"no1\"></div>" +
  8. "<div id=\"no2\">" + expected + "</div>"
  9. );
  10. });
  11. it("should set text inside an element", function () {
  12. var text = "this is a test";
  13. $("#no1").text(text);
  14. document.getElementById("no1").textContent.should.equal(text);
  15. });
  16. it("should get text from inside an element", function () {
  17. $("#no2").text().should.equal(expected);
  18. });
  19. });