File tree Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ import {
27
27
ComponentWithDifferentViews ,
28
28
ComponentWithProperties ,
29
29
ComponentWithImperativeEvent ,
30
+ ComponentWithoutProperties ,
30
31
ComponentWithDeclarativeEvent
31
32
} from "./components" ;
32
33
@@ -127,6 +128,16 @@ describe("basic support", function() {
127
128
let data = wc . str || wc . getAttribute ( "str" ) ;
128
129
expect ( data ) . to . eql ( "Mithril" ) ;
129
130
} ) ;
131
+
132
+ it ( "will not overwrite unwriteable properties" , function ( ) {
133
+ this . weight = 3 ;
134
+ m . mount ( root , ComponentWithoutProperties ( ) ) ;
135
+ let wc = root . querySelector ( "#wc" ) ;
136
+ expect ( wc . getAttribute ( 'amethod' ) ) . to . eql ( 'method' ) ;
137
+ expect ( wc . getAttribute ( 'agetter' ) ) . to . eql ( 'getter' ) ;
138
+ expect ( wc . getAttribute ( 'areadonly' ) ) . to . eql ( 'readonly' ) ;
139
+ expect ( wc . innerHTML ) . to . eql ( 'Success' ) ;
140
+ } ) ;
130
141
} ) ;
131
142
132
143
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 m from 'mithril'
24
25
@@ -86,6 +87,17 @@ export const ComponentWithProperties = () => ({
86
87
)
87
88
} )
88
89
90
+ export const ComponentWithoutProperties = ( ) => ( {
91
+ view : ( ) =>
92
+ m ( 'div' ,
93
+ m ( 'ce-without-properties#wc' , {
94
+ amethod : 'method' ,
95
+ agetter : 'getter' ,
96
+ areadonly : 'readonly'
97
+ } )
98
+ )
99
+ } )
100
+
89
101
export const ComponentWithImperativeEvent = ( ) => {
90
102
let eventHandled = false
91
103
Original file line number Diff line number Diff line change @@ -149,6 +149,7 @@ describe("basic support", function() {
149
149
} ) ;
150
150
151
151
it ( "will not overwrite unwriteable properties" , function ( ) {
152
+ this . weight = 3 ;
152
153
const app = createApp ( ComponentWithoutProperties ) ;
153
154
app . mount ( scratch ) ;
154
155
const wc = scratch . querySelector ( '#wc' ) ;
You can’t perform that action at this time.
0 commit comments