Port the tests of JavaScript's date parsing.

https://github.com/ariya/phantomjs/issues/12439
2.0
Ariya Hidayat 2014-09-04 08:28:45 -07:00
parent 729f12c7d8
commit e8598a849e
3 changed files with 13 additions and 11 deletions

View File

@ -22,12 +22,12 @@ TESTS = [
'module/system/stdout.js',
'module/system/stdin.js',
'module/system/stderr.js',
'standards/javascript/date.js',
'standards/javascript/function.js',
'regression/issue12482.js',
'run-tests.js'
]
def init():
global base_path, phantomjs_exe, options

View File

@ -0,0 +1,12 @@
var assert = require('../../assert');
// construct date in mm-dd-yyyy format
var date = new Date('2012-09-07');
assert.isTrue(date.toString() != 'Invalid Date');
assert.equal(date.getDate(), 6);
assert.equal(date.getMonth(), 8);
assert.equal(date.getYear(), 112);
// parse date in ISO8601 format (yyyy-mm-dd)
var date = Date.parse("2012-01-01");
assert.equal(date, 1325376000000);

View File

@ -1,14 +1,4 @@
describe("WebKit", function() {
it("should construct date in mm-dd-yyyy format", function() {
var date = new Date('2012-09-07');
expect(date.toString()).toNotEqual('Invalid Date');
});
it("should parse date in ISO8601 format (yyyy-mm-dd)", function() {
var date = Date.parse("2012-01-01");
expect(date).toEqual(1325376000000);
});
it("should not crash when failing to dirty lines while removing a inline.", function () {
var p = require("webpage").create();
p.open('../test/webkit-spec/inline-destroy-dirty-lines-crash.html');