Port the tests of the web page's setContent().

https://github.com/ariya/phantomjs/issues/12439
2.0
Ariya Hidayat 2014-10-02 22:30:45 -07:00
parent bad1fee468
commit 2cbb695490
2 changed files with 18 additions and 16 deletions

View File

@ -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);

View File

@ -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() {