mirror of https://github.com/vitalif/phantomjs
parent
bad1fee468
commit
2cbb695490
|
@ -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);
|
||||||
|
|
|
@ -177,22 +177,6 @@ describe("WebPage object", function() {
|
||||||
|
|
||||||
checkViewportSize(page, {height:300,width:400});
|
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() {
|
it("should handle keydown event", function() {
|
||||||
runs(function() {
|
runs(function() {
|
||||||
page.evaluate(function() {
|
page.evaluate(function() {
|
||||||
|
|
Loading…
Reference in New Issue