From 2cbb6954903a85503ecff85a40096214115415bd Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Thu, 2 Oct 2014 22:30:45 -0700 Subject: [PATCH] Port the tests of the web page's setContent(). https://github.com/ariya/phantomjs/issues/12439 --- test/module/webpage/set-content.js | 18 ++++++++++++++++++ test/webpage-spec.js | 16 ---------------- 2 files changed, 18 insertions(+), 16 deletions(-) create mode 100644 test/module/webpage/set-content.js 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() {