Skip to content

Commit f75dfaf

Browse files
committed
add failing test for JSX wrapping
1 parent 0c43cf3 commit f75dfaf

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed

analysis/tests/src/CompletionJsxProps.res

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,11 @@
1919
// let _ = <div onMouseEnter= />
2020
// ^com
2121

22+
// Should wrap in {}
23+
// let _ = <CompletionSupport.TestComponent testArr=
24+
// ^com
25+
26+
// Should not wrap in {}
27+
// let _ = <CompletionSupport.TestComponent testArr={[]}
28+
// ^com
29+

analysis/tests/src/CompletionSupport.res

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ module TestComponent = {
1212
let make = (
1313
~on: bool,
1414
~test: testVariant,
15+
~testArr: array<testVariant>,
1516
~polyArg: option<[#one | #two | #two2 | #three(int, bool)]>=?,
1617
) => {
1718
ignore(on)
1819
ignore(test)
20+
ignore(testArr)
1921
ignore(polyArg)
2022
React.null
2123
}

analysis/tests/src/expected/CompletionJsxProps.res.txt

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,48 @@ Completable: Cexpression CJsxPropValue [div] onMouseEnter
165165
"insertTextFormat": 2
166166
}]
167167

168+
Complete src/CompletionJsxProps.res 22:52
169+
posCursor:[22:52] posNoWhite:[22:51] Found expr:[22:12->22:52]
170+
JSX <CompletionSupport.TestComponent:[22:12->22:43] testArr[22:44->22:51]=...__ghost__[0:-1->0:-1]> _children:None
171+
Completable: Cexpression CJsxPropValue [CompletionSupport, TestComponent] testArr
172+
[{
173+
"label": "[]",
174+
"kind": 12,
175+
"tags": [],
176+
"detail": "type testVariant = One | Two | Three(int)",
177+
"documentation": null,
178+
"sortText": "A",
179+
"insertText": "{[$0]}",
180+
"insertTextFormat": 2
181+
}]
182+
183+
Complete src/CompletionJsxProps.res 26:54
184+
posCursor:[26:54] posNoWhite:[26:53] Found expr:[26:12->26:56]
185+
JSX <CompletionSupport.TestComponent:[26:12->26:43] testArr[26:44->26:51]=...[26:53->26:55]> _children:None
186+
Completable: Cexpression CJsxPropValue [CompletionSupport, TestComponent] testArr->array
187+
[{
188+
"label": "One",
189+
"kind": 4,
190+
"tags": [],
191+
"detail": "One\n\ntype testVariant = One | Two | Three(int)",
192+
"documentation": null,
193+
"insertText": "{One}",
194+
"insertTextFormat": 2
195+
}, {
196+
"label": "Two",
197+
"kind": 4,
198+
"tags": [],
199+
"detail": "Two\n\ntype testVariant = One | Two | Three(int)",
200+
"documentation": null,
201+
"insertText": "{Two}",
202+
"insertTextFormat": 2
203+
}, {
204+
"label": "Three(_)",
205+
"kind": 4,
206+
"tags": [],
207+
"detail": "Three(int)\n\ntype testVariant = One | Two | Three(int)",
208+
"documentation": null,
209+
"insertText": "{Three(${1:_})}",
210+
"insertTextFormat": 2
211+
}]
212+

0 commit comments

Comments
 (0)