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() {
138
138
} ) ;
139
139
} ) ;
140
140
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
+
141
155
describe ( "events" , function ( ) {
142
156
it ( "can imperatively listen to a DOM event dispatched by a Custom Element" , async function ( ) {
143
157
this . weight = 3 ;
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import { h } from "preact";
23
23
import "ce-without-children" ;
24
24
import "ce-with-children" ;
25
25
import "ce-with-properties" ;
26
+ import "ce-without-properties" ;
26
27
import "ce-with-event" ;
27
28
28
29
export class ComponentWithoutChildren extends withComponent ( withPreact ( ) ) {
@@ -128,6 +129,27 @@ export class ComponentWithProperties extends withComponent(withPreact()) {
128
129
}
129
130
customElements . define ( "component-with-properties" , ComponentWithProperties ) ;
130
131
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
+
131
153
export class ComponentWithUnregistered extends withComponent ( withPreact ( ) ) {
132
154
render ( ) {
133
155
const data = {
You can’t perform that action at this time.
0 commit comments