File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import {
2323 ComponentWithChildrenRerender ,
2424 ComponentWithDifferentViews ,
2525 ComponentWithProperties ,
26+ ComponentWithoutProperties ,
2627 ComponentWithUnregistered ,
2728 ComponentWithImperativeEvent ,
2829 ComponentWithDeclarativeEvent
@@ -110,6 +111,16 @@ describe("basic support", function() {
110111 expect ( data ) . to . eql ( "Solid" ) ;
111112 } ) ;
112113
114+ it ( "will not overwrite unwriteable properties" , function ( ) {
115+ this . weight = 3 ;
116+ let wc ;
117+ render ( ( ) => wc = < ComponentWithoutProperties /> , document . body ) ;
118+ expect ( wc . getAttribute ( 'amethod' ) ) . to . eql ( 'method' ) ;
119+ expect ( wc . getAttribute ( 'agetter' ) ) . to . eql ( 'getter' ) ;
120+ expect ( wc . getAttribute ( 'areadonly' ) ) . to . eql ( 'readonly' ) ;
121+ expect ( wc . innerHTML ) . to . eql ( 'Success' ) ;
122+ } ) ;
123+
113124 // TODO: Is it the framework's responsibility to check if the underlying
114125 // property is defined? Or should it just always assume it is and do its
115126 // usual default behavior? Preact will actually check if it's defined and
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import { createStore } from "solid-js/store";
2020import "ce-without-children" ;
2121import "ce-with-children" ;
2222import "ce-with-properties" ;
23+ import "ce-without-properties" ;
2324import "ce-with-event" ;
2425
2526export const ComponentWithoutChildren = ( ) => < ce-without-children /> ;
@@ -63,6 +64,21 @@ export const ComponentWithProperties = () => {
6364 ) ;
6465} ;
6566
67+ export const ComponentWithoutProperties = ( ) => {
68+ const data = {
69+ getter : 'getter' ,
70+ method : 'method' ,
71+ readonly : 'readonly' ,
72+ }
73+ return (
74+ < ce-without-properties
75+ attr :agetter = { data . getter }
76+ attr :amethod = { data . method }
77+ attr :areadonly = { data . readonly }
78+ />
79+ )
80+ }
81+
6682export const ComponentWithUnregistered = ( ) => {
6783 const data = {
6884 bool : true ,
You can’t perform that action at this time.
0 commit comments