8000 Fixed tests to work while running under different browser time zones · rmm5t/jquery-timeago@9f15ffa · GitHub
[go: up one dir, main page]

Skip to content

Commit 9f15ffa

Browse files
committed
Fixed tests to work while running under different browser time zones
1 parent 69a5ffc commit 9f15ffa

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/test.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ <h2>Settings</h2>
268268

269269
$('abbr.todate').each(function () {
270270
var date = $.timeago.parse(this.title);
271-
$(this).text(date.toString());
271+
$(this).text(date.toUTCString());
272272
});
273273

274274
$('abbr.towords').each(toWords);
@@ -308,7 +308,7 @@ <h2>Settings</h2>
308308

309309
module('Long term');
310310

311-
test("Dates older than one year should container the word 'year'", function () {
311+
test("Dates older than one year should contain the word 'year'", function () {
312312
ok(testElements('abbr.testLongTerm', function (element) {
313313
return (element.html().match(/year/));
314314
}), 'All long term dates correctly parsed');
@@ -317,7 +317,7 @@ <h2>Settings</h2>
317317
module('Parsing');
318318

319319
// Note, different browsers behave slightly different
320-
var correctMatch = /Mon Dec 18 1978 17:17:00 GMT\+0000 \((?:BST|GMT)\)/;
320+
var correctMatch = /Mon, 18 Dec 1978 17:17:00 GMT/;
321321

322322
test('From Z', function () {
323323
ok(($('#testParsing1').html().match(correctMatch)), 'Correctly parsed');
@@ -344,7 +344,7 @@ <h2>Settings</h2>
344344
});
345345

346346
test('From blank TZ', function () {
347-
ok(($('#testParsing7').html().match(correctMatch)), 'Correctly parsed');
347+
ok(($('#testParsing7').html().match(/Mon, 18 Dec 1978 \d\d:17:00 GMT/)), 'Correctly parsed, assumed local time');
348348
});
349349

350350
module('Wording');

0 commit comments

Comments
 (0)
0