File tree 2 files changed +31
-0
lines changed
2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ import {
24
24
ComponentWithChildrenRerender ,
25
25
ComponentWithDifferentViews ,
26
26
ComponentWithProperties ,
27
+ ComponentWithoutProperties ,
27
28
ComponentWithUnregistered ,
28
29
ComponentWithImperativeEvent ,
29
30
ComponentWithDeclarativeEvent
@@ -122,6 +123,18 @@ describe("basic support", function() {
122
123
} ) ;
123
124
} ) ;
124
125
126
+ it ( "will not overwrite unwriteable properties" , function ( ) {
127
+ this . weight = 3 ;
128
+ S . root ( ( ) => {
129
+ let root = < ComponentWithoutProperties /> ;
130
+ let wc = root . wc ;
131
+ expect ( wc . getAttribute ( 'amethod' ) ) . to . eql ( 'method' ) ;
132
+ expect ( wc . getAttribute ( 'agetter' ) ) . to . eql ( 'getter' ) ;
133
+ expect ( wc . getAttribute ( 'areadonly' ) ) . to . eql ( 'readonly' ) ;
134
+ expect ( wc . innerHTML ) . to . eql ( 'Success' ) ;
135
+ } )
136
+ } ) ;
137
+
125
138
// TODO: Is it the framework's responsibility to check if the underlying
126
139
// property is defined? Or should it just always assume it is and do its
127
140
// usual default behavior? Preact will actually check if it's defined and
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import on from 'surplus-mixin-on';
21
21
import 'ce-without-children' ;
22
22
import 'ce-with-children' ;
23
23
import 'ce-with-properties' ;
24
+ import 'ce-without-properties' ;
24
25
import 'ce-with-event' ;
25
26
26
27
export const ComponentWithoutChildren = ( ) =>
@@ -80,6 +81,23 @@ export const ComponentWithProperties = () => {
80
81
) ;
81
82
}
82
83
84
+ export const ComponentWithoutProperties = ( ) => {
85
+ const data = {
86
+ getter : 'getter' ,
87
+ method : 'method' ,
88
+ readonly : 'readonly' ,
89
+ } ;
90
+ return (
91
+ < div >
92
+ < ce-without-properties ref = { __ . wc }
93
+ amethod = { data . method }
94
+ agetter = { data . getter }
95
+ areadonly = { data . readonly }
96
+ > </ ce-without-properties >
97
+ </ div >
98
+ )
99
+ }
100
+
83
101
export const ComponentWithUnregistered = ( ) => {
84
102
const data = {
85
103
bool : true ,
You can’t perform that action at this time.
0 commit comments