Skip to content

Commit

Permalink
FIX more advanced test
Browse files Browse the repository at this point in the history
  • Loading branch information
kikonen committed Nov 10, 2019
1 parent e29ce2c commit 3ce2300
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
3 changes: 2 additions & 1 deletion app/javascript/app.svelte
@@ -1,5 +1,6 @@
<script>
export let name;
export let message;
</script>

<style>
Expand All @@ -8,4 +9,4 @@
}
</style>

<h1>Hello {name}!</h1>
<h1>Hello me too {name} via {message}!</h1>
19 changes: 10 additions & 9 deletions app/javascript/packs/hello_svelte.js
Expand Up @@ -8,13 +8,14 @@
import App from '../app.svelte'

document.addEventListener('DOMContentLoaded', () => {
const app = new App({
target: document.body,
props: {
name: 'Svelte'
}
_.each(document.querySelectorAll('.svelte-hello'), function(el) {
const app = new App({
target: el,
props: {
name: 'Svelte',
message: el.dataset.msg
}
});
// window.app = app;
});

window.app = app;
})

});
8 changes: 7 additions & 1 deletion app/views/svelte_test/hello.haml
@@ -1,4 +1,10 @@
= javascript_pack_tag 'hello_svelte'
= stylesheet_pack_tag 'hello_svelte'

hello
<h1>hello</h2>

Svelte hello appears here
.svelte-hello{ data: { msg: 'hello 1' } }

and this is below it
.svelte-hello{ data: { msg: 'hello 2' } }

0 comments on commit 3ce2300

Please sign in to comment.