browser/devtools/webconsole/test/browser_webconsole_bug_580454_timestamp_l10n.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/devtools/webconsole/test/browser_webconsole_bug_580454_timestamp_l10n.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,36 @@
     1.4 +/* vim:set ts=2 sw=2 sts=2 et: */
     1.5 +/* ***** BEGIN LICENSE BLOCK *****
     1.6 + * Any copyright is dedicated to the Public Domain.
     1.7 + * http://creativecommons.org/publicdomain/zero/1.0/
     1.8 + *
     1.9 + * Contributor(s):
    1.10 + *  Patrick Walton <pcwalton@mozilla.com>
    1.11 + *
    1.12 + * ***** END LICENSE BLOCK ***** */
    1.13 +
    1.14 +// Tests that appropriately-localized timestamps are printed.
    1.15 +
    1.16 +const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
    1.17 +
    1.18 +function test() {
    1.19 +  addTab(TEST_URI);
    1.20 +  browser.addEventListener("DOMContentLoaded", testTimestamp, false);
    1.21 +
    1.22 +  function testTimestamp()
    1.23 +  {
    1.24 +    browser.removeEventListener("DOMContentLoaded", testTimestamp, false);
    1.25 +    const TEST_TIMESTAMP = 12345678;
    1.26 +    let date = new Date(TEST_TIMESTAMP);
    1.27 +    let localizedString = WCU_l10n.timestampString(TEST_TIMESTAMP);
    1.28 +    isnot(localizedString.indexOf(date.getHours()), -1, "the localized " +
    1.29 +          "timestamp contains the hours");
    1.30 +    isnot(localizedString.indexOf(date.getMinutes()), -1, "the localized " +
    1.31 +          "timestamp contains the minutes");
    1.32 +    isnot(localizedString.indexOf(date.getSeconds()), -1, "the localized " +
    1.33 +          "timestamp contains the seconds");
    1.34 +    isnot(localizedString.indexOf(date.getMilliseconds()), -1, "the localized " +
    1.35 +          "timestamp contains the milliseconds");
    1.36 +    finishTest();
    1.37 +  }
    1.38 +}
    1.39 +

mercurial