File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import {
23
23
ComponentWithChildrenRerender ,
24
24
ComponentWithDifferentViews ,
25
25
ComponentWithProperties ,
26
+ ComponentWithoutProperties ,
26
27
ComponentWithUnregistered ,
27
28
ComponentWithImperativeEvent ,
28
29
ComponentWithDeclarativeEvent
@@ -110,6 +111,16 @@ describe("basic support", function() {
110
111
expect ( data ) . to . eql ( "Solid" ) ;
111
112
} ) ;
112
113
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
+
113
124
// TODO: Is it the framework's responsibility to check if the underlying
114
125
// property is defined? Or should it just always assume it is and do its
115
126
// usual default behavior? Preact will actually check if it's defined and
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import { createStore } from "solid-js/store";
20
20
import "ce-without-children" ;
21
21
import "ce-with-children" ;
22
22
import "ce-with-properties" ;
23
+ import "ce-without-properties" ;
23
24
import "ce-with-event" ;
24
25
25
26
export const ComponentWithoutChildren = ( ) => < ce-without-children /> ;
@@ -63,6 +64,21 @@ export const ComponentWithProperties = () => {
63
64
) ;
64
65
} ;
65
66
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
+
66
82
export const ComponentWithUnregistered = ( ) => {
67
83
const data = {
68
84
bool : true ,
You can’t perform that action at this time.
0 commit comments