Skip to content

Commit 25edbd3

Browse files
committed
test: add tests for inline comment migration
1 parent 0a6fa8a commit 25edbd3

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

packages/svelte/tests/migrate/samples/jsdoc-with-comments/input.svelte

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,12 @@
2424
/**
2525
* This is optional
2626
*/
27-
export let optional = {stuff: true};
27+
export let optional = {stuff: true};
28+
29+
export let inline_commented; // this should stay a comment
30+
31+
/**
32+
* This comment should be merged
33+
*/
34+
export let inline_commented_merged; // with this inline comment
2835
</script>

packages/svelte/tests/migrate/samples/jsdoc-with-comments/output.svelte

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
1010
1111
12+
13+
14+
1215
/**
1316
* @typedef {Object} Props
1417
* @property {string} comment - My wonderful comment
@@ -17,6 +20,8 @@
1720
* @property {any} no_comment
1821
* @property {boolean} type_no_comment
1922
* @property {any} [optional] - This is optional
23+
* @property {any} inline_commented - this should stay a comment
24+
* @property {any} inline_commented_merged - This comment should be merged - with this inline comment
2025
*/
2126
2227
/** @type {Props} */
@@ -26,6 +31,8 @@
2631
one_line,
2732
no_comment,
2833
type_no_comment,
29-
optional = {stuff: true}
34+
optional = {stuff: true},
35+
inline_commented,
36+
inline_commented_merged
3037
} = $props();
3138
</script>

packages/svelte/tests/migrate/samples/props-ts/input.svelte

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
export let bindingOptional: string | undefined = 'bar';
77
/** this should stay a comment */
88
export let no_type_but_comment = 0;
9+
export let type_and_inline_comment:number; // this should also stay a comment
10+
export let no_type_and_inline_comment = 0; // this should stay as well
911
</script>
1012

1113
{readonly}

packages/svelte/tests/migrate/samples/props-ts/output.svelte

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,18 @@
99
bindingOptional?: string | undefined;
1010
/** this should stay a comment */
1111
no_type_but_comment?: number;
12+
type_and_inline_comment: number; // this should also stay a comment
13+
no_type_and_inline_comment?: number; // this should stay as well
1214
}
1315
1416
let {
1517
readonly,
1618
optional = 'foo',
1719
binding = $bindable(),
1820
bindingOptional = $bindable('bar'),
19-
no_type_but_comment = 0
21+
no_type_but_comment = 0,
22+
type_and_inline_comment,
23+
no_type_and_inline_comment = 0
2024
}: Props = $props();
2125
</script>
2226

0 commit comments

Comments
 (0)