Skip to content

Commit

Permalink
add with-string test and skip_if_ssr to snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
paoloricciuti committed Nov 15, 2023
1 parent 565c7f6 commit 5cf47d1
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { test } from '../../test';

export default test({});
export default test({
skip_if_ssr: true
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
import "svelte/internal/disclose-version";
import * as $ from "svelte/internal";

var frag = $.template(`<div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div>`, true);
var frag = $.template(`<div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div>`, true);

export default function Directives_with_member_access($$anchor, $$props) {
$.push($$props, false);

const one = () => {};
const nested = { one };
const nested = { one, "with-string": one };
const evenmore = { nested };

/* Init */
Expand Down Expand Up @@ -64,9 +64,45 @@ export default function Directives_with_member_access($$anchor, $$props) {
var div_14 = $.sibling($.sibling(div_13));

$.out(div_14, evenmore['nested']['one'], null, false);

var div_15 = $.sibling($.sibling(div_14));
var div_16 = $.sibling($.sibling(div_15));
var div_17 = $.sibling($.sibling(div_16));

$.transition(div_17, nested['with-string'], null, false);

var div_18 = $.sibling($.sibling(div_17));

$.transition(div_18, evenmore['nested']['with-string'], null, false);

var div_19 = $.sibling($.sibling(div_18));

$.animate(div_19, nested['with-string'], null);

var div_20 = $.sibling($.sibling(div_19));

$.animate(div_20, evenmore['nested']['with-string'], null);

var div_21 = $.sibling($.sibling(div_20));

$.in(div_21, nested['with-string'], null, false);

var div_22 = $.sibling($.sibling(div_21));

$.in(div_22, evenmore['nested']['with-string'], null, false);

var div_23 = $.sibling($.sibling(div_22));

$.out(div_23, nested['with-string'], null, false);

var div_24 = $.sibling($.sibling(div_23));

$.out(div_24, evenmore['nested']['with-string'], null, false);
$.action(div, $$node => one($$node));
$.action(div_1, $$node => nested['one']($$node));
$.action(div_2, $$node => evenmore['nested']['one']($$node));
$.action(div_15, $$node => nested['with-string']($$node));
$.action(div_16, $$node => evenmore['nested']['with-string']($$node));
$.close_frag($$anchor, fragment);
$.pop();
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script>
const one = ()=>{};
const nested = {one};
const nested = {one, "with-string": one};
const evenmore = {nested};
</script>

Expand All @@ -22,4 +22,19 @@

<div out:one />
<div out:nested.one />
<div out:evenmore.nested.one />
<div out:evenmore.nested.one />

<div use:nested.with-string />
<div use:evenmore.nested.with-string />

<div transition:nested.with-string />
<div transition:evenmore.nested.with-string />

<div animate:nested.with-string />
<div animate:evenmore.nested.with-string />

<div in:nested.with-string />
<div in:evenmore.nested.with-string />

<div out:nested.with-string />
<div out:evenmore.nested.with-string />
5 changes: 4 additions & 1 deletion packages/svelte/tests/snapshot/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ import { VERSION } from 'svelte/compiler';

interface SnapshotTest extends BaseTest {
compileOptions?: Partial<import('#compiler').CompileOptions>;
skip_if_ssr?: boolean;
}

const { test, run } = suite<SnapshotTest>(async (config, cwd) => {
compile_directory(cwd, 'client', config.compileOptions);
compile_directory(cwd, 'server', config.compileOptions);
if (!config.skip_if_ssr) {
compile_directory(cwd, 'server', config.compileOptions);
}

// run `UPDATE_SNAPSHOTS=true pnpm test snapshot` to update snapshot tests
if (process.env.UPDATE_SNAPSHOTS) {
Expand Down

0 comments on commit 5cf47d1

Please sign in to comment.