1
0
mirror of https://github.com/home-assistant/frontend.git synced 2025-12-24 04:39:01 +00:00

Compute state display tests (#643)

* 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 commit e3509d7182.

* Revert "Always recalculate state display"

This reverts commit 27c24e2694.
This commit is contained in:
Adam Mills
2017-11-21 00:46:36 -05:00
committed by Paulus Schoutsen
parent 7e77a7c32c
commit 3412edb843
20 changed files with 476 additions and 141 deletions

View File

@@ -7,7 +7,22 @@
*/
import attributeClassNames from './common/util/attribute_class_names';
import computeDomain from './common/util/compute_domain';
import computeStateDisplay from './common/util/compute_state_display';
import formatDate from './common/util/format_date';
import formatDateTime from './common/util/format_date_time';
import formatTime from './common/util/format_time';
window.hassUtil = window.hassUtil || {};
const language = navigator.languages ?
navigator.languages[0] : navigator.language || navigator.userLanguage;
window.fecha.masks.haDateTime = window.fecha.masks.shortTime + ' ' + window.fecha.masks.mediumDate;
window.hassUtil.attributeClassNames = attributeClassNames;
window.hassUtil.computeDomain = computeDomain;
window.hassUtil.computeStateDisplay = computeStateDisplay;
window.hassUtil.formatDate = dateObj => formatDate(dateObj, language);
window.hassUtil.formatDateTime = dateObj => formatDateTime(dateObj, language);
window.hassUtil.formatTime = dateObj => formatTime(dateObj, language);