mirror of
https://github.com/thoughtbot/capybara-webkit
synced 2023-03-27 23:22:28 -04:00
Merge pull request #1032 from twalpole/issue_1028
Create new object when wrapping objects - Issue #1028
This commit is contained in:
commit
5a56c48f21
2 changed files with 12 additions and 1 deletions
|
@ -557,6 +557,13 @@ describe Capybara::Webkit::Driver do
|
|||
expect(result).to eq 'one' => 1
|
||||
end
|
||||
|
||||
it "evaluate Javascript and returns an object when the original was readonly" do
|
||||
result = driver.evaluate_script(%<window.getComputedStyle(document.getElementById('greeting'))>)
|
||||
# result = driver.evaluate_script(%<document.getElementById('greeting')>)
|
||||
expect(result).to be_a Hash
|
||||
expect(result["zIndex"]).to eq "auto"
|
||||
end
|
||||
|
||||
it "evaluates Javascript and returns true" do
|
||||
result = driver.evaluate_script(%<true>)
|
||||
expect(result).to be true
|
||||
|
|
|
@ -496,12 +496,16 @@ Capybara = {
|
|||
return {'element-581e-422e-8be1-884c4e116226': this.registerNode(arg)};
|
||||
} else if (arg === null) {
|
||||
return undefined;
|
||||
} else if (arg instanceof Date){
|
||||
return arg;
|
||||
} else if ( typeof arg == 'object' ) {
|
||||
this._visitedObjects.push(arg);
|
||||
var result = {};
|
||||
for(var _k in arg){
|
||||
arg[_k] = this.wrapResult(arg[_k]);
|
||||
result[_k] = this.wrapResult(arg[_k]);
|
||||
}
|
||||
this._visitedObjects.pop();
|
||||
return result;
|
||||
}
|
||||
return arg;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue