mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-09 10:26:35 +00:00
Mock subscribe template (#7529)
This commit is contained in:
parent
76a088e177
commit
f1c16d6674
@ -6,4 +6,11 @@ export const mockTemplate = (hass: MockHomeAssistant) => {
|
|||||||
body: { message: "Template dev tool does not work in the demo." },
|
body: { message: "Template dev tool does not work in the demo." },
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
hass.mockWS("render_template", (msg, onChange) => {
|
||||||
|
onChange!({
|
||||||
|
result: msg.template,
|
||||||
|
listeners: { all: false, domains: [], entities: [], time: false },
|
||||||
|
});
|
||||||
|
return () => {};
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
import { html } from "@polymer/polymer/lib/utils/html-tag";
|
import { html } from "@polymer/polymer/lib/utils/html-tag";
|
||||||
/* eslint-plugin-disable lit */
|
/* eslint-plugin-disable lit */
|
||||||
import { PolymerElement } from "@polymer/polymer/polymer-element";
|
import { PolymerElement } from "@polymer/polymer/polymer-element";
|
||||||
|
import { mockTemplate } from "../../../demo/src/stubs/template";
|
||||||
|
import { provideHass } from "../../../src/fake_data/provide_hass";
|
||||||
import "../components/demo-cards";
|
import "../components/demo-cards";
|
||||||
|
|
||||||
const CONFIGS = [
|
const CONFIGS = [
|
||||||
@ -254,7 +256,7 @@ const CONFIGS = [
|
|||||||
|
|
||||||
class DemoMarkdown extends PolymerElement {
|
class DemoMarkdown extends PolymerElement {
|
||||||
static get template() {
|
static get template() {
|
||||||
return html` <demo-cards configs="[[_configs]]"></demo-cards> `;
|
return html` <demo-cards id="demos" configs="[[_configs]]"></demo-cards> `;
|
||||||
}
|
}
|
||||||
|
|
||||||
static get properties() {
|
static get properties() {
|
||||||
@ -265,6 +267,12 @@ class DemoMarkdown extends PolymerElement {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ready() {
|
||||||
|
super.ready();
|
||||||
|
const hass = provideHass(this.$.demos);
|
||||||
|
mockTemplate(hass);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
customElements.define("demo-hui-markdown-card", DemoMarkdown);
|
customElements.define("demo-hui-markdown-card", DemoMarkdown);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user