Evaluate JavaScript Date objects

This commit is contained in:
Jason Karns 2016-04-04 22:49:42 -04:00
parent 18651a0caf
commit ed34e301ab
2 changed files with 10 additions and 0 deletions

View File

@ -479,6 +479,11 @@ describe Capybara::Webkit::Driver do
result.should eq nil
end
it "evaluates Javascript and returns a date" do
result = driver.evaluate_script(%<new Date("2016-04-01T00:00:00Z")>)
result.should eq "2016-04-01T00:00:00Z"
end
it "evaluates Javascript and returns an object" do
result = driver.evaluate_script(%<({ 'one' : 1 })>)
result.should eq 'one' => 1

View File

@ -46,6 +46,11 @@ void JsonSerializer::addVariant(const QVariant &object) {
m_buffer.append(object.toString());
break;
}
case QMetaType::QDateTime:
{
addString(object.toString());
break;
}
default:
m_buffer.append("null");
}