test_webconsole_l10n.js (928B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 const { require } = ChromeUtils.importESModule( 7 "resource://devtools/shared/loader/Loader.sys.mjs" 8 ); 9 10 function run_test() { 11 const TEST_TIMESTAMP = 12345678; 12 const WCUL10n = require("resource://devtools/client/webconsole/utils/l10n.js"); 13 const date = new Date(TEST_TIMESTAMP); 14 const localizedString = WCUL10n.timestampString(TEST_TIMESTAMP); 15 ok( 16 localizedString.includes(date.getHours()), 17 "the localized timestamp contains the hours" 18 ); 19 ok( 20 localizedString.includes(date.getMinutes()), 21 "the localized timestamp contains the minutes" 22 ); 23 ok( 24 localizedString.includes(date.getSeconds()), 25 "the localized timestamp contains the seconds" 26 ); 27 ok( 28 localizedString.includes(date.getMilliseconds()), 29 "the localized timestamp contains the milliseconds" 30 ); 31 }