From 5343883edfa092fb7702259d8706e73df3a54255 Mon Sep 17 00:00:00 2001 From: rster20002 Date: Fri, 6 Aug 2021 12:48:05 +0200 Subject: [PATCH] Add more test cases --- .../error-handling-action-destroy/_config.js | 9 ++++++++ .../error-handling-action-destroy/main.svelte | 22 +++++++++++++++++++ .../_config.js | 5 +++++ .../main.svelte | 15 +++++++++++++ .../samples/error-handling-action/_config.js | 5 +++++ .../samples/error-handling-action/main.svelte | 15 +++++++++++++ .../error-handling-anonymous-event/_config.js | 10 +++++++++ .../main.svelte | 12 ++++++++++ .../error-handling-attribute/_config.js | 5 +++++ .../error-handling-attribute/main.svelte | 12 ++++++++++ .../_config.js | 10 +++++++++ .../main.svelte | 21 ++++++++++++++++++ .../samples/error-handling-binding/_config.js | 5 +++++ .../error-handling-binding/main.svelte | 12 ++++++++++ 14 files changed, 158 insertions(+) create mode 100644 test/runtime/samples/error-handling-action-destroy/_config.js create mode 100644 test/runtime/samples/error-handling-action-destroy/main.svelte create mode 100644 test/runtime/samples/error-handling-action-with-arguments/_config.js create mode 100644 test/runtime/samples/error-handling-action-with-arguments/main.svelte create mode 100644 test/runtime/samples/error-handling-action/_config.js create mode 100644 test/runtime/samples/error-handling-action/main.svelte create mode 100644 test/runtime/samples/error-handling-anonymous-event/_config.js create mode 100644 test/runtime/samples/error-handling-anonymous-event/main.svelte create mode 100644 test/runtime/samples/error-handling-attribute/_config.js create mode 100644 test/runtime/samples/error-handling-attribute/main.svelte create mode 100644 test/runtime/samples/error-handling-binding-reactive/_config.js create mode 100644 test/runtime/samples/error-handling-binding-reactive/main.svelte create mode 100644 test/runtime/samples/error-handling-binding/_config.js create mode 100644 test/runtime/samples/error-handling-binding/main.svelte diff --git a/test/runtime/samples/error-handling-action-destroy/_config.js b/test/runtime/samples/error-handling-action-destroy/_config.js new file mode 100644 index 0000000000..c43b64736d --- /dev/null +++ b/test/runtime/samples/error-handling-action-destroy/_config.js @@ -0,0 +1,9 @@ +export default { + test({ assert, component }) { + assert.equal(component.error, false); + + component.visible = false; + + assert.equal(component.error, true); + } +}; diff --git a/test/runtime/samples/error-handling-action-destroy/main.svelte b/test/runtime/samples/error-handling-action-destroy/main.svelte new file mode 100644 index 0000000000..f9496ca8a2 --- /dev/null +++ b/test/runtime/samples/error-handling-action-destroy/main.svelte @@ -0,0 +1,22 @@ + + +{#if visible} +
+{/if} \ No newline at end of file diff --git a/test/runtime/samples/error-handling-action-with-arguments/_config.js b/test/runtime/samples/error-handling-action-with-arguments/_config.js new file mode 100644 index 0000000000..fab5d76ee6 --- /dev/null +++ b/test/runtime/samples/error-handling-action-with-arguments/_config.js @@ -0,0 +1,5 @@ +export default { + test({ assert, component }) { + assert.equal(component.error, true); + } +}; diff --git a/test/runtime/samples/error-handling-action-with-arguments/main.svelte b/test/runtime/samples/error-handling-action-with-arguments/main.svelte new file mode 100644 index 0000000000..f15ebcbac6 --- /dev/null +++ b/test/runtime/samples/error-handling-action-with-arguments/main.svelte @@ -0,0 +1,15 @@ + + +
\ No newline at end of file diff --git a/test/runtime/samples/error-handling-action/_config.js b/test/runtime/samples/error-handling-action/_config.js new file mode 100644 index 0000000000..fab5d76ee6 --- /dev/null +++ b/test/runtime/samples/error-handling-action/_config.js @@ -0,0 +1,5 @@ +export default { + test({ assert, component }) { + assert.equal(component.error, true); + } +}; diff --git a/test/runtime/samples/error-handling-action/main.svelte b/test/runtime/samples/error-handling-action/main.svelte new file mode 100644 index 0000000000..14bdae809f --- /dev/null +++ b/test/runtime/samples/error-handling-action/main.svelte @@ -0,0 +1,15 @@ + + +
\ No newline at end of file diff --git a/test/runtime/samples/error-handling-anonymous-event/_config.js b/test/runtime/samples/error-handling-anonymous-event/_config.js new file mode 100644 index 0000000000..773299e415 --- /dev/null +++ b/test/runtime/samples/error-handling-anonymous-event/_config.js @@ -0,0 +1,10 @@ +export default { + async test({ assert, component, target, window }) { + const button = target.querySelector('button'); + const event = new window.MouseEvent('click'); + + await button.dispatchEvent(event); + + assert.equal(component.error, true); + } +}; diff --git a/test/runtime/samples/error-handling-anonymous-event/main.svelte b/test/runtime/samples/error-handling-anonymous-event/main.svelte new file mode 100644 index 0000000000..f8b206e5bb --- /dev/null +++ b/test/runtime/samples/error-handling-anonymous-event/main.svelte @@ -0,0 +1,12 @@ + + + \ No newline at end of file diff --git a/test/runtime/samples/error-handling-attribute/_config.js b/test/runtime/samples/error-handling-attribute/_config.js new file mode 100644 index 0000000000..fab5d76ee6 --- /dev/null +++ b/test/runtime/samples/error-handling-attribute/_config.js @@ -0,0 +1,5 @@ +export default { + test({ assert, component }) { + assert.equal(component.error, true); + } +}; diff --git a/test/runtime/samples/error-handling-attribute/main.svelte b/test/runtime/samples/error-handling-attribute/main.svelte new file mode 100644 index 0000000000..ad5e332482 --- /dev/null +++ b/test/runtime/samples/error-handling-attribute/main.svelte @@ -0,0 +1,12 @@ + + + \ No newline at end of file diff --git a/test/runtime/samples/error-handling-binding-reactive/_config.js b/test/runtime/samples/error-handling-binding-reactive/_config.js new file mode 100644 index 0000000000..773299e415 --- /dev/null +++ b/test/runtime/samples/error-handling-binding-reactive/_config.js @@ -0,0 +1,10 @@ +export default { + async test({ assert, component, target, window }) { + const button = target.querySelector('button'); + const event = new window.MouseEvent('click'); + + await button.dispatchEvent(event); + + assert.equal(component.error, true); + } +}; diff --git a/test/runtime/samples/error-handling-binding-reactive/main.svelte b/test/runtime/samples/error-handling-binding-reactive/main.svelte new file mode 100644 index 0000000000..59881d2699 --- /dev/null +++ b/test/runtime/samples/error-handling-binding-reactive/main.svelte @@ -0,0 +1,21 @@ + + + + \ No newline at end of file diff --git a/test/runtime/samples/error-handling-binding/_config.js b/test/runtime/samples/error-handling-binding/_config.js new file mode 100644 index 0000000000..fab5d76ee6 --- /dev/null +++ b/test/runtime/samples/error-handling-binding/_config.js @@ -0,0 +1,5 @@ +export default { + test({ assert, component }) { + assert.equal(component.error, true); + } +}; diff --git a/test/runtime/samples/error-handling-binding/main.svelte b/test/runtime/samples/error-handling-binding/main.svelte new file mode 100644 index 0000000000..917b1b4625 --- /dev/null +++ b/test/runtime/samples/error-handling-binding/main.svelte @@ -0,0 +1,12 @@ + + + \ No newline at end of file