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 {
2727 ComponentWithDifferentViews ,
2828 ComponentWithProperties ,
2929 ComponentWithImperativeEvent ,
30+ ComponentWithoutProperties ,
3031 ComponentWithDeclarativeEvent
3132} from "./components" ;
3233
@@ -127,6 +128,16 @@ describe("basic support", function() {
127128 let data = wc . str || wc . getAttribute ( "str" ) ;
128129 expect ( data ) . to . eql ( "Mithril" ) ;
129130 } ) ;
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+ } ) ;
130141 } ) ;
131142
132143 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 m from 'mithril'
2425
@@ -86,6 +87,17 @@ export const ComponentWithProperties = () => ({
8687 )
8788} )
8889
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+
89101export const ComponentWithImperativeEvent = ( ) => {
90102 let eventHandled = false
91103
Original file line number Diff line number Diff line change @@ -149,6 +149,7 @@ describe("basic support", function() {
149149 } ) ;
150150
151151 it ( "will not overwrite unwriteable properties" , function ( ) {
152+ this . weight = 3 ;
152153 const app = createApp ( ComponentWithoutProperties ) ;
153154 app . mount ( scratch ) ;
154155 const wc = scratch . querySelector ( '#wc' ) ;
You can’t perform that action at this time.
0 commit comments