mirror of
https://github.com/home-assistant/frontend.git
synced 2025-12-20 02:38:53 +00:00
* Move computeDomain and format functions to js * Add tests for computeStateDisplay * Always recalculate state display * Remove LANGUAGE from hassUtils object * Move AppLocalizeBehavior import to mixins * Import mixins to state-card-display * Safety check on computeStateDisplay * Don't store computed domains on stateObj * Integration tests for state-card-display * Include extractDomain code in polymer repo * Remove util function null checking * Dont render test element without hass and stateObj * Revert "Don't store computed domains on stateObj" This reverts commite3509d7182. * Revert "Always recalculate state display" This reverts commit27c24e2694.
21 lines
619 B
JavaScript
21 lines
619 B
JavaScript
import formatDateTime from '../../../js/common/util/format_date_time';
|
|
|
|
const assert = require('assert');
|
|
|
|
describe('formatDateTime', function() {
|
|
const dateObj = new Date(
|
|
2017, 10, 18,
|
|
11, 12, 13, 1400,
|
|
);
|
|
|
|
it('Formats English date times', function() {
|
|
assert.strictEqual(formatDateTime(dateObj, 'en'), 'November 18, 2017, 11:12 AM');
|
|
});
|
|
|
|
// Node only contains intl support for english formats. This test at least ensures
|
|
// the fallback to a different locale
|
|
it('Formats other date times', function() {
|
|
assert.strictEqual(formatDateTime(dateObj, 'fr'), '2017 M11 18 11:12');
|
|
});
|
|
});
|