diff --git a/test/runtime/index.js b/test/runtime/index.js
index 778f47c0cc..8ec4c5194a 100644
--- a/test/runtime/index.js
+++ b/test/runtime/index.js
@@ -66,6 +66,7 @@ describe("runtime", () => {
compileOptions.hydratable = hydrate;
compileOptions.dev = config.dev;
compileOptions.store = !!config.store;
+ compileOptions.immutable = config.immutable;
// check that no ES2015+ syntax slipped in
if (!config.allowES2015) {
@@ -160,7 +161,8 @@ describe("runtime", () => {
target,
hydrate,
data: config.data,
- store: (config.store !== true && config.store)
+ store: (config.store !== true && config.store),
+ immutable: config.immutable
}, config.options || {});
const component = new SvelteComponent(options);
diff --git a/test/runtime/samples/immutable-mutable/Nested.html b/test/runtime/samples/immutable-mutable/Nested.html
new file mode 100644
index 0000000000..02278e385e
--- /dev/null
+++ b/test/runtime/samples/immutable-mutable/Nested.html
@@ -0,0 +1,13 @@
+
Called {{count}} times.
+
+
\ No newline at end of file
diff --git a/test/runtime/samples/immutable-mutable/_config.js b/test/runtime/samples/immutable-mutable/_config.js
new file mode 100644
index 0000000000..5dab0f239b
--- /dev/null
+++ b/test/runtime/samples/immutable-mutable/_config.js
@@ -0,0 +1,16 @@
+export default {
+ immutable: true,
+ html: `Called 0 times.
`,
+
+ test(assert, component, target, window) {
+ var nested = component.refs.nested;
+ nested.observe('foo', foo => {
+ nested.set({ count: nested.get('count') + 1 });
+ });
+
+ assert.htmlEqual(target.innerHTML, `Called 1 times.
`);
+
+ nested.set({ foo: nested.get('foo') });
+ assert.htmlEqual(target.innerHTML, `Called 2 times.
`);
+ }
+};
diff --git a/test/runtime/samples/immutable-mutable/main.html b/test/runtime/samples/immutable-mutable/main.html
new file mode 100644
index 0000000000..4e36143361
--- /dev/null
+++ b/test/runtime/samples/immutable-mutable/main.html
@@ -0,0 +1,13 @@
+
+
+
+
+
diff --git a/test/runtime/samples/immutable-nested/Nested.html b/test/runtime/samples/immutable-nested/Nested.html
new file mode 100644
index 0000000000..05eb9f3fdf
--- /dev/null
+++ b/test/runtime/samples/immutable-nested/Nested.html
@@ -0,0 +1,12 @@
+Called {{count}} times.
+
+
\ No newline at end of file
diff --git a/test/runtime/samples/immutable-nested/_config.js b/test/runtime/samples/immutable-nested/_config.js
new file mode 100644
index 0000000000..541566ce4d
--- /dev/null
+++ b/test/runtime/samples/immutable-nested/_config.js
@@ -0,0 +1,16 @@
+export default {
+ immutable: true,
+ html: `Called 0 times.
`,
+
+ test(assert, component, target, window) {
+ var nested = component.refs.nested;
+ nested.observe('foo', foo => {
+ nested.set({ count: nested.get('count') + 1 });
+ });
+
+ assert.htmlEqual(target.innerHTML, `Called 1 times.
`);
+
+ nested.set({ foo: nested.get('foo') });
+ assert.htmlEqual(target.innerHTML, `Called 1 times.
`);
+ }
+};
diff --git a/test/runtime/samples/immutable-nested/main.html b/test/runtime/samples/immutable-nested/main.html
new file mode 100644
index 0000000000..4e36143361
--- /dev/null
+++ b/test/runtime/samples/immutable-nested/main.html
@@ -0,0 +1,13 @@
+
+
+
+
+
diff --git a/test/runtime/samples/immutable-root/_config.js b/test/runtime/samples/immutable-root/_config.js
new file mode 100644
index 0000000000..a862008d7d
--- /dev/null
+++ b/test/runtime/samples/immutable-root/_config.js
@@ -0,0 +1,15 @@
+export default {
+ immutable: true,
+ html: `Called 0 times.
`,
+
+ test(assert, component, target, window) {
+ component.observe('foo', foo => {
+ component.set({ count: component.get('count') + 1 });
+ });
+
+ assert.htmlEqual(target.innerHTML, `Called 1 times.
`);
+
+ component.set({ foo: component.get('foo') });
+ assert.htmlEqual(target.innerHTML, `Called 1 times.
`);
+ }
+};
diff --git a/test/runtime/samples/immutable-root/main.html b/test/runtime/samples/immutable-root/main.html
new file mode 100644
index 0000000000..087f561caf
--- /dev/null
+++ b/test/runtime/samples/immutable-root/main.html
@@ -0,0 +1,14 @@
+
+
Called {{count}} times.
+
+
+
\ No newline at end of file