File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,8 @@ import {
2525 ComponentWithDifferentViews ,
2626 ComponentWithProperties ,
2727 ComponentWithImperativeEvent ,
28- ComponentWithDeclarativeEvent
28+ ComponentWithDeclarativeEvent ,
29+ ComponentWithoutProperties
2930} from "./components" ;
3031
3132// Setup the test harness. This will get cleaned out with every test.
@@ -130,6 +131,17 @@ describe("basic support", function () {
130131 let data = wc . str || wc . getAttribute ( "str" ) ;
131132 expect ( data ) . to . eql ( "Hyperapp" ) ;
132133 } ) ;
134+
135+ it ( 'will not overwrite unwritable properties' , async function ( ) {
136+ this . weight = 3 ;
137+ ComponentWithoutProperties ( root ) ;
138+ await new Promise ( requestAnimationFrame ) ;
139+ let wc = testContainer . 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+ } )
133145 } ) ;
134146
135147 describe ( "events" , function ( ) {
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import "ce-without-children"
1919import "ce-with-children"
2020import "ce-with-properties"
2121import "ce-with-event"
22+ import "ce-without-properties"
2223
2324import { app , h , text } from "hyperapp"
2425
@@ -81,6 +82,20 @@ export const ComponentWithProperties = node =>
8182 ] ) ,
8283 } )
8384
85+ export const ComponentWithoutProperties = node =>
86+ app ( {
87+ node,
88+ init : { } ,
89+ view : ( ) =>
90+ h ( 'div' , { } , [
91+ h ( 'ce-without-properties' , {
92+ amethod : 'method' ,
93+ agetter : 'getter' ,
94+ areadonly : 'readonly'
95+ } ) ,
96+ ] ) ,
97+ } )
98+
8499export const ComponentWithImperativeEvent = node => {
85100 const _withElem = ( _ , opts ) =>
86101 requestAnimationFrame ( _ => {
You can’t perform that action at this time.
0 commit comments