Add support for more advanced forms of overriding
This commit is contained in:
@@ -420,7 +420,7 @@ describe('should handle version specific upgrades', () => {
|
||||
media_loaded: true,
|
||||
},
|
||||
],
|
||||
overrides: {
|
||||
merge: {
|
||||
view: {
|
||||
default: 'clips',
|
||||
},
|
||||
@@ -489,7 +489,7 @@ describe('should handle version specific upgrades', () => {
|
||||
overrides: [
|
||||
{
|
||||
conditions: {},
|
||||
overrides: {
|
||||
merge: {
|
||||
menu: {
|
||||
buttons: {
|
||||
camera_ui: {
|
||||
@@ -1872,7 +1872,7 @@ describe('should handle version specific upgrades', () => {
|
||||
views: ['clips', 'snapshots'],
|
||||
},
|
||||
],
|
||||
overrides: {
|
||||
merge: {
|
||||
view: {
|
||||
default: 'clips',
|
||||
},
|
||||
@@ -1987,7 +1987,7 @@ describe('should handle version specific upgrades', () => {
|
||||
cameras: ['camera_1', 'camera_2'],
|
||||
},
|
||||
],
|
||||
overrides: {
|
||||
merge: {
|
||||
view: {
|
||||
default: 'clips',
|
||||
},
|
||||
@@ -2107,7 +2107,7 @@ describe('should handle version specific upgrades', () => {
|
||||
[condition]: true,
|
||||
},
|
||||
],
|
||||
overrides: {
|
||||
merge: {
|
||||
view: {
|
||||
default: 'clips',
|
||||
},
|
||||
@@ -2255,7 +2255,7 @@ describe('should handle version specific upgrades', () => {
|
||||
state_not: 'off',
|
||||
},
|
||||
],
|
||||
overrides: {
|
||||
merge: {
|
||||
view: {
|
||||
default: 'clips',
|
||||
},
|
||||
@@ -2387,7 +2387,7 @@ describe('should handle version specific upgrades', () => {
|
||||
media_query: 'query',
|
||||
},
|
||||
],
|
||||
overrides: {
|
||||
merge: {
|
||||
view: {
|
||||
default: 'clips',
|
||||
},
|
||||
@@ -2497,5 +2497,48 @@ describe('should handle version specific upgrades', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('from overrides to merge', () => {
|
||||
const config = {
|
||||
type: 'custom:frigate-card',
|
||||
cameras: [],
|
||||
overrides: [
|
||||
{
|
||||
conditions: [
|
||||
{
|
||||
condition: 'view',
|
||||
view: ['clips'],
|
||||
},
|
||||
],
|
||||
overrides: {
|
||||
menu: {
|
||||
style: 'hidden',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
expect(upgradeConfig(config)).toBeTruthy();
|
||||
expect(config).toEqual({
|
||||
type: 'custom:frigate-card',
|
||||
cameras: [],
|
||||
overrides: [
|
||||
{
|
||||
conditions: [
|
||||
{
|
||||
condition: 'view',
|
||||
view: ['clips'],
|
||||
},
|
||||
],
|
||||
merge: {
|
||||
menu: {
|
||||
style: 'hidden',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -25,7 +25,7 @@ describe('setProfiles', () => {
|
||||
it('should handle profiles', () => {
|
||||
const input = {
|
||||
type: 'frigate-hass-card',
|
||||
cameras: [],
|
||||
cameras: [{}],
|
||||
live: {
|
||||
controls: {
|
||||
timeline: {
|
||||
|
||||
@@ -12,7 +12,7 @@ import { createConfig } from '../test-utils';
|
||||
describe('config defaults', () => {
|
||||
it('should be as expected', () => {
|
||||
expect(createConfig()).toEqual({
|
||||
cameras: [],
|
||||
cameras: [{}],
|
||||
cameras_global: {
|
||||
dependencies: {
|
||||
all_cameras: false,
|
||||
@@ -453,7 +453,7 @@ describe('should handle custom frigate elements', () => {
|
||||
it('should not require title controls to specify all options', () => {
|
||||
expect(
|
||||
createConfig({
|
||||
cameras: [],
|
||||
cameras: [{}],
|
||||
live: {
|
||||
controls: {
|
||||
title: {
|
||||
|
||||
Reference in New Issue
Block a user