File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ import {
26
26
ComponentWithChildrenRerender ,
27
27
ComponentWithDifferentViews ,
28
28
ComponentWithProperties ,
29
+ ComponentWithoutProperties ,
29
30
ComponentWithImperativeEvent ,
30
31
ComponentWithDeclarativeEvent
31
32
} from "./components" ;
@@ -131,6 +132,16 @@ describe("basic support", function() {
131
132
let data = wc . str || wc . getAttribute ( "str" ) ;
132
133
expect ( data ) . to . eql ( "hyperHTML" ) ;
133
134
} ) ;
135
+
136
+ it ( 'will not overwrite unwriteable properties' , function ( ) {
137
+ this . weight = 3 ;
138
+ ComponentWithoutProperties ( root ) ;
139
+ let wc = root . querySelector ( "#wc" ) ;
140
+ expect ( wc . getAttribute ( 'amethod' ) ) . to . eql ( 'method' ) ;
141
+ expect ( wc . getAttribute ( 'agetter' ) ) . to . eql ( 'getter' ) ;
142
+ expect ( wc . getAttribute ( 'areadonly' ) ) . to . eql ( 'readonly' ) ;
143
+ expect ( wc . innerHTML ) . to . eql ( 'Success' ) ;
144
+ } ) ;
134
145
} ) ;
135
146
136
147
describe ( "events" , function ( ) {
Original file line number Diff line number Diff line change 18
18
import 'ce-without-children' ;
19
19
import 'ce-with-children' ;
20
20
import 'ce-with-properties' ;
21
+ import 'ce-without-properties' ;
21
22
import 'ce-with-event' ;
22
23
23
24
import HyperHTMLELement from 'hyperhtml-element/esm' ;
@@ -79,6 +80,16 @@ export const ComponentWithProperties = (root) => hyper(root)`
79
80
></ce-with-properties>
80
81
</div>` ;
81
82
83
+ export const ComponentWithoutProperties = ( root ) => hyper ( root ) `
84
+ <div>
85
+ <ce-without-properties id="wc"
86
+ amethod="${ "method" } "
87
+ agetter="${ "getter" } "
88
+ areadonly="${ "readonly" } "
89
+ ></ce-without-properties>
90
+ </div>
91
+ `
92
+
82
93
export class ComponentWithImperativeEvent extends HyperHTMLELement {
83
94
created ( ) {
84
95
this . eventClicks = 0 ;
You can’t perform that action at this time.
0 commit comments