Skip to content

Commit a15d495

Browse files
committed
lit
1 parent f2f95b3 commit a15d495

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

libraries/lit/src/basic-tests.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,20 @@ describe("basic support", function() {
128128
});
129129
});
130130

131+
describe("without properties", () => {
132+
it("will not overwrite unwritable properties", async function() {
133+
this.weight = 3;
134+
const root = document.createElement("component-without-properties");
135+
scratch.appendChild(root);
136+
await root.updateComplete;
137+
const wc = root.shadowRoot.querySelector("#wc");
138+
expect(wc.getAttribute('amethod')).to.eql('method');
139+
expect(wc.getAttribute('agetter')).to.eql('getter');
140+
expect(wc.getAttribute('areadonly')).to.eql('readonly');
141+
expect(wc.innerHTML).to.eql('Success');
142+
});
143+
});
144+
131145
describe("events", function() {
132146
it("can imperatively listen to a DOM event dispatched by a Custom Element", async function() {
133147
this.weight = 3;

libraries/lit/src/components.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ import "./components/component-with-children.js";
33
import "./components/component-with-children-rerender.js";
44
import "./components/component-with-different-views.js";
55
import "./components/component-with-properties.js";
6+
import "./components/component-without-properties.js";
67
import "./components/component-with-imperative-event.js";
78
import "./components/component-with-declarative-event.js";
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { LitElement, html } from "lit";
2+
import "ce-without-properties";
3+
4+
class ComponentWithoutProperties extends LitElement {
5+
6+
static get properties() {
7+
return {};
8+
}
9+
10+
render() {
11+
return html`
12+
<div>
13+
<ce-without-properties
14+
id="wc"
15+
amethod="${"method"}"
16+
agetter="${"getter"}"
17+
areadonly="${"readonly"}"
18+
></ce-without-properties>
19+
</div>
20+
`;
21+
}
22+
}
23+
customElements.define(
24+
"component-without-properties",
25+
ComponentWithoutProperties
26+
);

0 commit comments

Comments
 (0)