Skip to content

Commit 4f8f7e5

Browse files
committed
Solid
1 parent 9763c5e commit 4f8f7e5

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

libraries/solid/src/basic-tests.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
ComponentWithChildrenRerender,
2424
ComponentWithDifferentViews,
2525
ComponentWithProperties,
26+
ComponentWithoutProperties,
2627
ComponentWithUnregistered,
2728
ComponentWithImperativeEvent,
2829
ComponentWithDeclarativeEvent
@@ -110,6 +111,16 @@ describe("basic support", function() {
110111
expect(data).to.eql("Solid");
111112
});
112113

114+
it("will not overwrite unwriteable properties", function () {
115+
this.weight = 3;
116+
let wc;
117+
render(() => wc = <ComponentWithoutProperties />, document.body);
118+
expect(wc.getAttribute('amethod')).to.eql('method');
119+
expect(wc.getAttribute('agetter')).to.eql('getter');
120+
expect(wc.getAttribute('areadonly')).to.eql('readonly');
121+
expect(wc.innerHTML).to.eql('Success');
122+
});
123+
113124
// TODO: Is it the framework's responsibility to check if the underlying
114125
// property is defined? Or should it just always assume it is and do its
115126
// usual default behavior? Preact will actually check if it's defined and

libraries/solid/src/components.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { createStore } from "solid-js/store";
2020
import "ce-without-children";
2121
import "ce-with-children";
2222
import "ce-with-properties";
23+
import "ce-without-properties";
2324
import "ce-with-event";
2425

2526
export const ComponentWithoutChildren = () => <ce-without-children />;
@@ -63,6 +64,21 @@ export const ComponentWithProperties = () => {
6364
);
6465
};
6566

67+
export const ComponentWithoutProperties = () => {
68+
const data = {
69+
getter: 'getter',
70+
method: 'method',
71+
readonly: 'readonly',
72+
}
73+
return (
74+
<ce-without-properties
75+
attr:agetter={data.getter}
76+
attr:amethod={data.method}
77+
attr:areadonly={data.readonly}
78+
/>
79+
)
80+
}
81+
6682
export const ComponentWithUnregistered = () => {
6783
const data = {
6884
bool: true,

0 commit comments

Comments
 (0)