From 1b19c96c43344a0f610de288dd0289b12e8b2149 Mon Sep 17 00:00:00 2001 From: Nguyen Tran Date: Mon, 18 Dec 2023 23:09:03 -0500 Subject: [PATCH] Add some tests to avoid regression --- .../destructure-store-non-store-2/_config.js | 12 +++++ .../destructure-store-non-store-2/main.svelte | 21 ++++++++ .../destructure-store-non-store-3/_config.js | 5 ++ .../destructure-store-non-store-3/main.svelte | 11 +++++ .../destructure-store-non-store-4/_config.js | 12 +++++ .../destructure-store-non-store-4/main.svelte | 14 ++++++ .../destructure-store-non-store-5/_config.js | 12 +++++ .../destructure-store-non-store-5/main.svelte | 29 +++++++++++ .../destructure-store-non-store-6/_config.js | 12 +++++ .../destructure-store-non-store-6/main.svelte | 22 +++++++++ .../destructure-store-non-store-7/_config.js | 44 +++++++++++++++++ .../destructure-store-non-store-7/main.svelte | 48 +++++++++++++++++++ .../destructure-store-non-store-8/_config.js | 44 +++++++++++++++++ .../destructure-store-non-store-8/main.svelte | 42 ++++++++++++++++ .../destructure-store-non-store/_config.js | 5 ++ .../destructure-store-non-store/main.svelte | 13 +++++ 16 files changed, 346 insertions(+) create mode 100644 packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-2/_config.js create mode 100644 packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-2/main.svelte create mode 100644 packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-3/_config.js create mode 100644 packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-3/main.svelte create mode 100644 packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-4/_config.js create mode 100644 packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-4/main.svelte create mode 100644 packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-5/_config.js create mode 100644 packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-5/main.svelte create mode 100644 packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-6/_config.js create mode 100644 packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-6/main.svelte create mode 100644 packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-7/_config.js create mode 100644 packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-7/main.svelte create mode 100644 packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-8/_config.js create mode 100644 packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-8/main.svelte create mode 100644 packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store/_config.js create mode 100644 packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store/main.svelte diff --git a/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-2/_config.js b/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-2/_config.js new file mode 100644 index 0000000000..eac4aed306 --- /dev/null +++ b/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-2/_config.js @@ -0,0 +1,12 @@ +import { test } from '../../test'; + +export default test({ + html: ` +

1

+

2

+

3

+

4

+

5

+

6

+ ` +}); diff --git a/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-2/main.svelte b/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-2/main.svelte new file mode 100644 index 0000000000..d63224e7bd --- /dev/null +++ b/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-2/main.svelte @@ -0,0 +1,21 @@ + + +

{firstNonStore}

+

{secondNonStore}

+

{thirdNonStore}

+

{$firstStore}

+

{fourthNonStore}

+

{$secondStore}

diff --git a/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-3/_config.js b/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-3/_config.js new file mode 100644 index 0000000000..3c6f8dc037 --- /dev/null +++ b/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-3/_config.js @@ -0,0 +1,5 @@ +import { test } from '../../test'; + +export default test({ + html: 'true' +}); diff --git a/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-3/main.svelte b/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-3/main.svelte new file mode 100644 index 0000000000..66ceaaacf7 --- /dev/null +++ b/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-3/main.svelte @@ -0,0 +1,11 @@ + + +{#if $store} + {nonStore} +{/if} diff --git a/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-4/_config.js b/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-4/_config.js new file mode 100644 index 0000000000..eac4aed306 --- /dev/null +++ b/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-4/_config.js @@ -0,0 +1,12 @@ +import { test } from '../../test'; + +export default test({ + html: ` +

1

+

2

+

3

+

4

+

5

+

6

+ ` +}); diff --git a/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-4/main.svelte b/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-4/main.svelte new file mode 100644 index 0000000000..7ae892a723 --- /dev/null +++ b/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-4/main.svelte @@ -0,0 +1,14 @@ + + +

{firstNonStore}

+

{secondNonStore}

+

{thirdNonStore}

+

{$firstStore}

+

{fourthNonStore}

+

{$secondStore}

diff --git a/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-5/_config.js b/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-5/_config.js new file mode 100644 index 0000000000..e5a274ef09 --- /dev/null +++ b/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-5/_config.js @@ -0,0 +1,12 @@ +import { test } from '../../test'; + +export default test({ + html: ` +

7

+

8

+

9

+

10

+

11

+

12

+ ` +}); diff --git a/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-5/main.svelte b/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-5/main.svelte new file mode 100644 index 0000000000..1e8f84f96c --- /dev/null +++ b/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-5/main.svelte @@ -0,0 +1,29 @@ + + +

{firstNonStore}

+

{secondNonStore}

+

{thirdNonStore}

+

{$firstStore}

+

{fourthNonStore}

+

{$secondStore}

+ diff --git a/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-6/_config.js b/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-6/_config.js new file mode 100644 index 0000000000..e5a274ef09 --- /dev/null +++ b/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-6/_config.js @@ -0,0 +1,12 @@ +import { test } from '../../test'; + +export default test({ + html: ` +

7

+

8

+

9

+

10

+

11

+

12

+ ` +}); diff --git a/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-6/main.svelte b/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-6/main.svelte new file mode 100644 index 0000000000..f23b9f41bb --- /dev/null +++ b/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-6/main.svelte @@ -0,0 +1,22 @@ + + +

{firstNonStore}

+

{secondNonStore}

+

{thirdNonStore}

+

{$firstStore}

+

{fourthNonStore}

+

{$secondStore}

+ diff --git a/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-7/_config.js b/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-7/_config.js new file mode 100644 index 0000000000..021f851197 --- /dev/null +++ b/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-7/_config.js @@ -0,0 +1,44 @@ +import { test } from '../../test'; + +export default test({ + html: ` +

1

+

2

+

3

+

4

+

5

+

6

+ +

Bag'ol stores

+

4

+

5

+

6

+ + + `, + + async test({ assert, target, window }) { + const button = target.querySelector('button'); + const clickEvent = new window.Event('click', { bubbles: true }); + await button?.dispatchEvent(clickEvent); + + assert.htmlEqual( + target.innerHTML, + ` +

7

+

8

+

9

+

10

+

11

+

12

+ +

Bag'ol stores

+

14

+

13

+

12

+ + + ` + ); + } +}); diff --git a/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-7/main.svelte b/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-7/main.svelte new file mode 100644 index 0000000000..57d0f46faf --- /dev/null +++ b/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-7/main.svelte @@ -0,0 +1,48 @@ + + +

{firstNonStore}

+

{secondNonStore}

+

{thirdNonStore}

+

{$firstStore}

+

{$secondStore}

+

{$thirdStore}

+ +

Bag'ol stores

+

{get($bagOlStores.firstStore)}

+

{get($bagOlStores.secondStore)}

+

{get($bagOlStores.thirdStore)}

+ + diff --git a/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-8/_config.js b/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-8/_config.js new file mode 100644 index 0000000000..9e41e8074e --- /dev/null +++ b/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-8/_config.js @@ -0,0 +1,44 @@ +import { test } from '../../test'; + +export default test({ + html: ` +

1

+

2

+

3

+

4

+

5

+

6

+ +

Bag'ol stores

+

6

+

+

+ + + `, + + async test({ assert, target, window }) { + const button = target.querySelector('button'); + const clickEvent = new window.Event('click', { bubbles: true }); + await button?.dispatchEvent(clickEvent); + + assert.htmlEqual( + target.innerHTML, + ` +

7

+

8

+

9

+

10

+

11

+

12

+ +

Bag'ol stores

+

12

+

14

+

15

+ + + ` + ); + } +}); diff --git a/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-8/main.svelte b/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-8/main.svelte new file mode 100644 index 0000000000..5dc3d50cc2 --- /dev/null +++ b/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store-8/main.svelte @@ -0,0 +1,42 @@ + + +

{firstNonStore}

+

{secondNonStore}

+

{thirdNonStore}

+

{$firstStore}

+

{$secondStore}

+

{$thirdStore}

+ +

Bag'ol stores

+

{get($bagOlStores[5])}

+

{get($bagOlStores[6])}

+

{get($bagOlStores[7])}

+ + diff --git a/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store/_config.js b/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store/_config.js new file mode 100644 index 0000000000..3c6f8dc037 --- /dev/null +++ b/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store/_config.js @@ -0,0 +1,5 @@ +import { test } from '../../test'; + +export default test({ + html: 'true' +}); diff --git a/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store/main.svelte b/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store/main.svelte new file mode 100644 index 0000000000..603be5909f --- /dev/null +++ b/packages/svelte/tests/runtime-legacy/samples/destructure-store-non-store/main.svelte @@ -0,0 +1,13 @@ + + +{#if $store} + {nonStore} +{/if}