diff --git a/test/module/webpage/set-content.js b/test/module/webpage/set-content.js new file mode 100644 index 00000000..d8b64de6 --- /dev/null +++ b/test/module/webpage/set-content.js @@ -0,0 +1,18 @@ +var assert = require('../../assert'); +var webpage = require('webpage'); + +var page = webpage.create(); +var expectedContent = '
Test div
'; +var expectedLocation = 'http://www.phantomjs.org/'; +page.setContent(expectedContent, expectedLocation); + +var actualContent = page.evaluate(function() { + return document.documentElement.textContent; +}); +assert.equal(actualContent, 'Test div'); + +var actualLocation = page.evaluate(function() { + return window.location.href; +}); +assert.equal(actualLocation, expectedLocation); + diff --git a/test/webpage-spec.js b/test/webpage-spec.js index ef2d6211..0f126616 100644 --- a/test/webpage-spec.js +++ b/test/webpage-spec.js @@ -177,22 +177,6 @@ describe("WebPage object", function() { checkViewportSize(page, {height:300,width:400}); - it("should set content and location", function() { - runs(function() { - var expectedContent = "
Test div
"; - var expectedLocation = "http://www.phantomjs.org/"; - page.setContent(expectedContent, expectedLocation); - var actualLocation = page.evaluate(function(){ - return window.location.href; - }); - var actualContent = page.evaluate(function(){ - return document.documentElement.textContent; - }); - expect(expectedLocation).toEqual(actualLocation); - expect(expectedContent).toContain("Test div"); - }); - }); - it("should handle keydown event", function() { runs(function() { page.evaluate(function() {