File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -138,6 +138,20 @@ describe("basic support", function() {
138138 } ) ;
139139 } ) ;
140140
141+ describe ( "without properties" , function ( ) {
142+ it ( "will not overwrite unwriteable properties" , async function ( ) {
143+ this . weight = 3 ;
144+ let root = document . createElement ( 'component-without-properties' ) ;
145+ scratch . appendChild ( root ) ;
146+ await Promise . resolve ( ) ;
147+ let wc = root . shadowRoot . querySelector ( "#wc" ) ;
148+ expect ( wc . getAttribute ( 'amethod' ) ) . to . eql ( 'method' ) ;
149+ expect ( wc . getAttribute ( 'agetter' ) ) . to . eql ( 'getter' ) ;
150+ expect ( wc . getAttribute ( 'areadonly' ) ) . to . eql ( 'readonly' ) ;
151+ expect ( wc . innerHTML ) . to . eql ( 'Success' ) ;
152+ } ) ;
153+ } )
154+
141155 describe ( "events" , function ( ) {
142156 it ( "can imperatively listen to a DOM event dispatched by a Custom Element" , async function ( ) {
143157 this . weight = 3 ;
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import { h } from "preact";
2323import "ce-without-children" ;
2424import "ce-with-children" ;
2525import "ce-with-properties" ;
26+ import "ce-without-properties" ;
2627import "ce-with-event" ;
2728
2829export class ComponentWithoutChildren extends withComponent ( withPreact ( ) ) {
@@ -128,6 +129,27 @@ export class ComponentWithProperties extends withComponent(withPreact()) {
128129}
129130customElements . define ( "component-with-properties" , ComponentWithProperties ) ;
130131
132+ export class ComponentWithoutProperties extends withComponent ( withPreact ( ) ) {
133+ render ( ) {
134+ const data = {
135+ getter : 'getter' ,
136+ readonly : 'readonly' ,
137+ method : 'method' ,
138+ }
139+ return (
140+ < div >
141+ < ce-without-properties
142+ id = "wc"
143+ agetter = { data . getter }
144+ areadonly = { data . readonly }
145+ amethod = { data . method }
146+ > </ ce-without-properties >
147+ </ div >
148+ )
149+ }
150+ }
151+ customElements . define ( "component-without-properties" , ComponentWithoutProperties )
152+
131153export class ComponentWithUnregistered extends withComponent ( withPreact ( ) ) {
132154 render ( ) {
133155 const data = {
You can’t perform that action at this time.
0 commit comments