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 {
25
25
ComponentWithDifferentViews ,
26
26
ComponentWithProperties ,
27
27
ComponentWithImperativeEvent ,
28
- ComponentWithDeclarativeEvent
28
+ ComponentWithDeclarativeEvent ,
29
+ ComponentWithoutProperties
29
30
} from "./components" ;
30
31
31
32
// Setup the test harness. This will get cleaned out with every test.
@@ -130,6 +131,17 @@ describe("basic support", function () {
130
131
let data = wc . str || wc . getAttribute ( "str" ) ;
131
132
expect ( data ) . to . eql ( "Hyperapp" ) ;
132
133
} ) ;
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
+ } )
133
145
} ) ;
134
146
135
147
describe ( "events" , function ( ) {
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import "ce-without-children"
19
19
import "ce-with-children"
20
20
import "ce-with-properties"
21
21
import "ce-with-event"
22
+ import "ce-without-properties"
22
23
23
24
import { app , h , text } from "hyperapp"
24
25
@@ -81,6 +82,20 @@ export const ComponentWithProperties = node =>
81
82
] ) ,
82
83
} )
83
84
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
+
84
99
export const ComponentWithImperativeEvent = node => {
85
100
const _withElem = ( _ , opts ) =>
86
101
requestAnimationFrame ( _ => {
You can’t perform that action at this time.
0 commit comments