* MVP tests for hass-util.html * MVP util.js to allow individual JS function export * Use mocha to unit test js logic * Isolate mocha test directory * Move mocha opts to separate file * Default export of util function * Use reify for mocha tests instead of babel
7 lines
260 B
JavaScript
7 lines
260 B
JavaScript
export default function attributeClassNames(stateObj, attributes) {
|
|
if (!stateObj) return '';
|
|
return attributes.map(function (attribute) {
|
|
return attribute in stateObj.attributes ? 'has-' + attribute : '';
|
|
}).filter(attr => attr !== '').join(' ');
|
|
}
|