diff --git a/assets/views/layouts/svelte_layout.html b/assets/views/layouts/svelte_layout.html index caf13b9..599f6c6 100644 --- a/assets/views/layouts/svelte_layout.html +++ b/assets/views/layouts/svelte_layout.html @@ -11,9 +11,11 @@ const locals = %locals%; localStore.set((key, args) => { - return locals[args ? + const localKey = args ? `'${key}', \`${args}\`` - : `'${key}'`]; + : `'${key}'`; + // console.debug(localKey + '=' + locals[localKey]) + return locals[localKey]; }); new View({ diff --git a/test/assets/views/AllTests.svelte b/test/assets/views/AllTests.svelte new file mode 100644 index 0000000..caafcaf --- /dev/null +++ b/test/assets/views/AllTests.svelte @@ -0,0 +1,34 @@ + + + + +
{$locals.isPreRender ? 'SSR' : 'CSR'}
+ + + + + + + + + + + + + +
NameExpected valueActual value
diff --git a/test/assets/views/LocalsTest.svelte b/test/assets/views/LocalsTest.svelte new file mode 100644 index 0000000..37a8003 --- /dev/null +++ b/test/assets/views/LocalsTest.svelte @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/test/assets/views/Test.svelte b/test/assets/views/Test.svelte new file mode 100644 index 0000000..aaa1b8f --- /dev/null +++ b/test/assets/views/Test.svelte @@ -0,0 +1,42 @@ + + + + + + {name} + {#if not}!{/if}{expectedValue} + {actualValue} + diff --git a/test/assets/views/home_dep.svelte b/test/assets/views/home_dep.svelte deleted file mode 100644 index fc506de..0000000 --- a/test/assets/views/home_dep.svelte +++ /dev/null @@ -1,26 +0,0 @@ - - - - - -

Simple dep test

-

\$locals.

-

\$locals.

- -

$locals: {$locals}

-

\$locals.route: {$locals.route}
{$locals.dump(typeof $locals.route)}

-

\$locals.dump: {$locals.dump('bonjour')}

-

\$locals.dump: {$locals.dump($locals.app)}

-

\$locals.dump: {$locals.dump(NaN)}

-

\$locals.route: {$locals.route('auth')}

-

\$locals.route: {$locals.route('home')}

diff --git a/test/assets/views/home_test.svelte b/test/assets/views/home_test.svelte deleted file mode 100644 index b54040a..0000000 --- a/test/assets/views/home_test.svelte +++ /dev/null @@ -1,61 +0,0 @@ - - - - -

{mode}

- - - -

BONJOUR lol

-
-
- -

Hello {count}!

- - - -

Direct access: {$locals.direct}

- -{#if $locals.route('auth') === '/'} - We're home! -{:else} - We're somewhere else... {$locals.route('auth')} -{/if} - -

The route to auth is {$locals.route('auth')}

- -

\$locals.notcode

- -

{`{\\$locals.escaped}`}

- -
-

Blue!

-
- - - -

Dependency test: {depTest}