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 {
2626 ComponentWithChildrenRerender ,
2727 ComponentWithDifferentViews ,
2828 ComponentWithProperties ,
29+ ComponentWithoutProperties ,
2930 ComponentWithImperativeEvent ,
3031 ComponentWithDeclarativeEvent
3132} from "./components" ;
@@ -131,6 +132,16 @@ describe("basic support", function() {
131132 let data = wc . str || wc . getAttribute ( "str" ) ;
132133 expect ( data ) . to . eql ( "hyperHTML" ) ;
133134 } ) ;
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+ } ) ;
134145 } ) ;
135146
136147 describe ( "events" , function ( ) {
Original file line number Diff line number Diff line change 1818import 'ce-without-children' ;
1919import 'ce-with-children' ;
2020import 'ce-with-properties' ;
21+ import 'ce-without-properties' ;
2122import 'ce-with-event' ;
2223
2324import HyperHTMLELement from 'hyperhtml-element/esm' ;
@@ -79,6 +80,16 @@ export const ComponentWithProperties = (root) => hyper(root)`
7980 ></ce-with-properties>
8081 </div>` ;
8182
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+
8293export class ComponentWithImperativeEvent extends HyperHTMLELement {
8394 created ( ) {
8495 this . eventClicks = 0 ;
You can’t perform that action at this time.
0 commit comments