Skip to content

Commit 9763c5e

Browse files
committed
skate
1 parent 357915b commit 9763c5e

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

libraries/skate/src/basic-tests.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,20 @@ describe("basic support", function() {
138138
});
139139
});
140140

141+
describe("without properties", function() {
142+
it("will not overwrite unwriteable properties", async function() {
143+
this.weight = 3;
144+
let root = document.createElement('component-without-properties');
145+
scratch.appendChild(root);
146+
await Promise.resolve();
147+
let wc = root.shadowRoot.querySelector("#wc");
148+
expect(wc.getAttribute('amethod')).to.eql('method');
149+
expect(wc.getAttribute('agetter')).to.eql('getter');
150+
expect(wc.getAttribute('areadonly')).to.eql('readonly');
151+
expect(wc.innerHTML).to.eql('Success');
152+
});
153+
})
154+
141155
describe("events", function() {
142156
it("can imperatively listen to a DOM event dispatched by a Custom Element", async function() {
143157
this.weight = 3;

libraries/skate/src/components.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { h } from "preact";
2323
import "ce-without-children";
2424
import "ce-with-children";
2525
import "ce-with-properties";
26+
import "ce-without-properties";
2627
import "ce-with-event";
2728

2829
export class ComponentWithoutChildren extends withComponent(withPreact()) {
@@ -128,6 +129,27 @@ export class ComponentWithProperties extends withComponent(withPreact()) {
128129
}
129130
customElements.define("component-with-properties", ComponentWithProperties);
130131

132+
export class ComponentWithoutProperties extends withComponent(withPreact()) {
133+
render() {
134+
const data = {
135+
getter: 'getter',
136+
readonly: 'readonly',
137+
method: 'method',
138+
}
139+
return (
140+
<div>
141+
<ce-without-properties
142+
id="wc"
143+
agetter={data.getter}
144+
areadonly={data.readonly}
145+
amethod={data.method}
146+
></ce-without-properties>
147+
</div>
148+
)
149+
}
150+
}
151+
customElements.define("component-without-properties", ComponentWithoutProperties)
152+
131153
export class ComponentWithUnregistered extends withComponent(withPreact()) {
132154
render() {
133155
const data = {

0 commit comments

Comments
 (0)