Skip to content

Commit

Permalink
Disable visual editor (#42)
Browse files Browse the repository at this point in the history
Visual editor doesn't work since Home Assistant 2022.3, see https://developers.home-assistant.io/blog/2022/02/18/paper-elements/
  • Loading branch information
avataar authored Apr 17, 2023
1 parent 00b2561 commit 227e4ee
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions src/components/horizonCard/HorizonCard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { Constants } from '../../constants'
import { EHorizonCardErrors, IHorizonCardConfig, THorizonCardData, THorizonCardTimes, TSunInfo } from '../../types'
import { HelperFunctions } from '../../utils/HelperFunctions'
import { I18N } from '../../utils/I18N'
import { HorizonCardEditor } from '../horizonCardEditor'
import { HorizonErrorContent } from '../HorizonErrorContent'
import { HorizonCardContent } from './HorizonCardContent'

Expand Down Expand Up @@ -42,9 +41,10 @@ export class HorizonCard extends LitElement {
this.processLastHass()
}

static getConfigElement (): HTMLElement {
return document.createElement(HorizonCardEditor.cardType)
}
// Visual editor disabled because it's broken, see https://developers.home-assistant.io/blog/2022/02/18/paper-elements/
// static getConfigElement (): HTMLElement {
// return document.createElement(HorizonCardEditor.cardType)
// }

// called by HASS whenever config changes
public setConfig (config: IHorizonCardConfig): void {
Expand Down
24 changes: 12 additions & 12 deletions tests/unit/components/horizonCard/HorizonCard.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { HomeAssistant } from 'custom-card-helpers'
import { css, CSSResult } from 'lit'

import { HorizonCard } from '../../../../src/components/horizonCard'
import { HorizonCardEditor } from '../../../../src/components/horizonCardEditor'
import { Constants } from '../../../../src/constants'
import { EHorizonCardErrors, IHorizonCardConfig, THorizonCardData } from '../../../../src/types'
import { CustomSnapshotSerializer, TemplateResultTestHelper } from '../../../helpers/TestHelpers'
Expand Down Expand Up @@ -73,17 +72,18 @@ describe('HorizonCard', () => {
})
})

describe('getConfigElement', () => {
it('creates and return a horizon card config element', () => {
const expectedElement = document.createElement('div')
const createElementSpy = jest.spyOn(document, 'createElement').mockReturnValueOnce(expectedElement)
const result = HorizonCard.getConfigElement()

expect(result).toEqual(expectedElement)
expect(createElementSpy).toHaveBeenCalledTimes(1)
expect(createElementSpy).toHaveBeenCalledWith(HorizonCardEditor.cardType)
})
})
// Visual editor disabled because it's broken, see https://developers.home-assistant.io/blog/2022/02/18/paper-elements/
// describe('getConfigElement', () => {
// it('creates and return a horizon card config element', () => {
// const expectedElement = document.createElement('div')
// const createElementSpy = jest.spyOn(document, 'createElement').mockReturnValueOnce(expectedElement)
// const result = HorizonCard.getConfigElement()
//
// expect(result).toEqual(expectedElement)
// expect(createElementSpy).toHaveBeenCalledTimes(1)
// expect(createElementSpy).toHaveBeenCalledWith(HorizonCardEditor.cardType)
// })
// })

describe('setConfig', () => {
it('overrides old config with new values', () => {
Expand Down

0 comments on commit 227e4ee

Please sign in to comment.