browser/devtools/webconsole/test/browser_webconsole_bug_580454_timestamp_l10n.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:5f70fa7aaf24
1 /* vim:set ts=2 sw=2 sts=2 et: */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Any copyright is dedicated to the Public Domain.
4 * http://creativecommons.org/publicdomain/zero/1.0/
5 *
6 * Contributor(s):
7 * Patrick Walton <pcwalton@mozilla.com>
8 *
9 * ***** END LICENSE BLOCK ***** */
10
11 // Tests that appropriately-localized timestamps are printed.
12
13 const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
14
15 function test() {
16 addTab(TEST_URI);
17 browser.addEventListener("DOMContentLoaded", testTimestamp, false);
18
19 function testTimestamp()
20 {
21 browser.removeEventListener("DOMContentLoaded", testTimestamp, false);
22 const TEST_TIMESTAMP = 12345678;
23 let date = new Date(TEST_TIMESTAMP);
24 let localizedString = WCU_l10n.timestampString(TEST_TIMESTAMP);
25 isnot(localizedString.indexOf(date.getHours()), -1, "the localized " +
26 "timestamp contains the hours");
27 isnot(localizedString.indexOf(date.getMinutes()), -1, "the localized " +
28 "timestamp contains the minutes");
29 isnot(localizedString.indexOf(date.getSeconds()), -1, "the localized " +
30 "timestamp contains the seconds");
31 isnot(localizedString.indexOf(date.getMilliseconds()), -1, "the localized " +
32 "timestamp contains the milliseconds");
33 finishTest();
34 }
35 }
36

mercurial