Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

Commit

Permalink
Port the tests of the web page's setContent().
Browse files Browse the repository at this point in the history
  • Loading branch information
ariya committed Oct 3, 2014
1 parent bad1fee commit 2cbb695
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
18 changes: 18 additions & 0 deletions test/module/webpage/set-content.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
var assert = require('../../assert');
var webpage = require('webpage');

var page = webpage.create();
var expectedContent = '<html><body><div>Test div</div></body></html>';
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);

16 changes: 0 additions & 16 deletions test/webpage-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<html><body><div>Test div</div></body></html>";
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() {
Expand Down

0 comments on commit 2cbb695

Please sign in to comment.