Skip to content

Commit 083f7eb

Browse files
committed
Mithril
1 parent 8b15eb1 commit 083f7eb

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

libraries/mithril/src/basic-tests.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff 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() {

libraries/mithril/src/components.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import 'ce-without-children'
1919
import 'ce-with-children'
2020
import 'ce-with-properties'
2121
import 'ce-with-event'
22+
import 'ce-without-properties'
2223

2324
import 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+
89101
export const ComponentWithImperativeEvent = () => {
90102
let eventHandled = false
91103

libraries/vue/src/basic-tests.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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');

0 commit comments

Comments
 (0)