From 8ca6df376be9e95825a13b4e721ea273229eeb59 Mon Sep 17 00:00:00 2001 From: Umang Galaiya Date: Sun, 14 Jul 2019 20:49:27 +0530 Subject: [PATCH] [Test] Add test for class directive with spread attributes --- .../_config.js | 21 +++++++++++++++++++ .../main.svelte | 6 ++++++ 2 files changed, 27 insertions(+) create mode 100644 test/runtime/samples/class-with-dynamic-attribute-and-spread/_config.js create mode 100644 test/runtime/samples/class-with-dynamic-attribute-and-spread/main.svelte diff --git a/test/runtime/samples/class-with-dynamic-attribute-and-spread/_config.js b/test/runtime/samples/class-with-dynamic-attribute-and-spread/_config.js new file mode 100644 index 0000000000..58ccc76497 --- /dev/null +++ b/test/runtime/samples/class-with-dynamic-attribute-and-spread/_config.js @@ -0,0 +1,21 @@ +export default { + props: { + myClass: 'one two', + attributes: { + role: 'button' + } + }, + + html: `
`, + + test({ assert, component, target, window }) { + component.myClass = 'one'; + component.attributes = { + 'aria-label': 'Test' + }; + + assert.htmlEqual(target.innerHTML, ` +
+ `); + } +}; diff --git a/test/runtime/samples/class-with-dynamic-attribute-and-spread/main.svelte b/test/runtime/samples/class-with-dynamic-attribute-and-spread/main.svelte new file mode 100644 index 0000000000..95825c777b --- /dev/null +++ b/test/runtime/samples/class-with-dynamic-attribute-and-spread/main.svelte @@ -0,0 +1,6 @@ + + +