diff --git a/test/parser/samples/slot-binding/Inner.svelte b/test/parser/samples/slot-binding/Inner.svelte deleted file mode 100644 index a8cda6b4af..0000000000 --- a/test/parser/samples/slot-binding/Inner.svelte +++ /dev/null @@ -1,6 +0,0 @@ - - \ No newline at end of file diff --git a/test/parser/samples/slot-binding/TestButton.svelte b/test/parser/samples/slot-binding/TestButton.svelte deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/parser/samples/slot-binding/input.svelte b/test/parser/samples/slot-binding/input.svelte deleted file mode 100644 index bc20f61de8..0000000000 --- a/test/parser/samples/slot-binding/input.svelte +++ /dev/null @@ -1,7 +0,0 @@ - - - - - \ No newline at end of file diff --git a/test/parser/samples/slot-binding/output.json b/test/parser/samples/slot-binding/output.json deleted file mode 100644 index 7d5663087e..0000000000 --- a/test/parser/samples/slot-binding/output.json +++ /dev/null @@ -1,177 +0,0 @@ -{ - "html": { - "start": 67, - "end": 153, - "type": "Fragment", - "children": [ - { - "start": 65, - "end": 67, - "type": "Text", - "raw": "\n\n", - "data": "\n\n" - }, - { - "start": 67, - "end": 153, - "type": "InlineComponent", - "name": "TestButton", - "attributes": [ - { - "start": 79, - "end": 92, - "type": "Let", - "name": "outerCall", - "modifiers": [], - "expression": null - } - ], - "children": [ - { - "start": 93, - "end": 96, - "type": "Text", - "raw": "\n ", - "data": "\n " - }, - { - "start": 96, - "end": 139, - "type": "Element", - "name": "button", - "attributes": [ - { - "start": 104, - "end": 124, - "type": "EventHandler", - "name": "click", - "modifiers": [], - "expression": { - "type": "Identifier", - "start": 114, - "end": 123, - "loc": { - "start": { - "line": 6, - "column": 20 - }, - "end": { - "line": 6, - "column": 29 - } - }, - "name": "outerCall" - } - } - ], - "children": [ - { - "start": 125, - "end": 130, - "type": "Text", - "raw": "Click", - "data": "Click" - } - ] - }, - { - "start": 139, - "end": 140, - "type": "Text", - "raw": "\n", - "data": "\n" - } - ] - } - ] - }, - "instance": { - "type": "Script", - "start": 0, - "end": 65, - "context": "default", - "content": { - "type": "Program", - "start": 8, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 0 - } - }, - "body": [ - { - "type": "ImportDeclaration", - "start": 11, - "end": 55, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 46 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 18, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 19 - } - }, - "local": { - "type": "Identifier", - "start": 18, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 19 - } - }, - "name": "TestButton" - } - } - ], - "source": { - "type": "Literal", - "start": 34, - "end": 55, - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 46 - } - }, - "value": "./TestButton.svelte", - "raw": "'./TestButton.svelte'" - } - } - ], - "sourceType": "module" - } - } -} \ No newline at end of file diff --git a/test/runtime/samples/component-slot-let-inline-function/Inner.svelte b/test/runtime/samples/component-slot-let-inline-function/Inner.svelte new file mode 100644 index 0000000000..5a30e1855b --- /dev/null +++ b/test/runtime/samples/component-slot-let-inline-function/Inner.svelte @@ -0,0 +1,8 @@ + + \ No newline at end of file diff --git a/test/parser/samples/slot-binding/Outter.svelte b/test/runtime/samples/component-slot-let-inline-function/Outer.svelte similarity index 52% rename from test/parser/samples/slot-binding/Outter.svelte rename to test/runtime/samples/component-slot-let-inline-function/Outer.svelte index 64913ce62d..40ed99ca63 100644 --- a/test/parser/samples/slot-binding/Outter.svelte +++ b/test/runtime/samples/component-slot-let-inline-function/Outer.svelte @@ -1,9 +1,12 @@ - + - innerCall()} /> + innerCall(a)} /> \ No newline at end of file diff --git a/test/runtime/samples/component-slot-let-inline-function/_config.js b/test/runtime/samples/component-slot-let-inline-function/_config.js new file mode 100644 index 0000000000..cb175f4766 --- /dev/null +++ b/test/runtime/samples/component-slot-let-inline-function/_config.js @@ -0,0 +1,27 @@ +let logs; +function log(value) { + logs.push(value); +} + +export default { + html: "", + props: { + a: 'a', + b: 'b', + log, + }, + before_test() { + logs = []; + }, + async test({ assert, component, target, window }) { + const button = target.querySelector("button"); + await button.dispatchEvent(new window.MouseEvent("click")); + + assert.deepEqual(logs, ["a: a, b: b"]); + + component.a = '1'; + component.b = '2'; + await button.dispatchEvent(new window.MouseEvent("click")); + assert.deepEqual(logs, ["a: a, b: b", "a: 1, b: 2"]); + }, +}; diff --git a/test/runtime/samples/component-slot-let-inline-function/main.svelte b/test/runtime/samples/component-slot-let-inline-function/main.svelte new file mode 100644 index 0000000000..6ea417d0f2 --- /dev/null +++ b/test/runtime/samples/component-slot-let-inline-function/main.svelte @@ -0,0 +1,12 @@ + + + + +