|
| 1 | +/// <reference path="fourslash.ts" /> |
| 2 | + |
| 3 | +// @Filename: foo.tsx |
| 4 | +//// declare namespace JSX { |
| 5 | +//// interface Element { } |
| 6 | +//// interface SignalLike<T> { |
| 7 | +//// value: T; |
| 8 | +//// peek(): T; |
| 9 | +//// subscribe(fn: (value: T) => void): () => void; |
| 10 | +//// } |
| 11 | +//// type Signalish<T> = T | SignalLike<T>; |
| 12 | +//// interface IntrinsicElements { |
| 13 | +//// div: { |
| 14 | +//// class?: Signalish<string | undefined>; |
| 15 | +//// id?: Signalish<string | undefined>; |
| 16 | +//// title?: Signalish<string | undefined>; |
| 17 | +//// disabled?: Signalish<boolean | undefined>; |
| 18 | +//// 'data-testid'?: Signalish<string | undefined>; |
| 19 | +//// role?: Signalish<string | undefined>; |
| 20 | +//// // For comparison - pure string type should still work |
| 21 | +//// pureString?: string; |
| 22 | +//// // Boolean-like should not get quotes |
| 23 | +//// booleanProp?: boolean; |
| 24 | +//// } |
| 25 | +//// } |
| 26 | +//// } |
| 27 | +//// |
| 28 | +//// <div [|prop_/**/|] /> |
| 29 | + |
| 30 | +// Test that string-like Signalish types prefer quotes over braces |
| 31 | +verify.completions({ |
| 32 | + marker: "", |
| 33 | + includes: [ |
| 34 | + { |
| 35 | + name: "class", |
| 36 | + insertText: "class=\"$1\"", |
| 37 | + isSnippet: true, |
| 38 | + sortText: completion.SortText.OptionalMember, |
| 39 | + }, |
| 40 | + { |
| 41 | + name: "id", |
| 42 | + insertText: "id=\"$1\"", |
| 43 | + isSnippet: true, |
| 44 | + sortText: completion.SortText.OptionalMember, |
| 45 | + }, |
| 46 | + ], |
| 47 | + preferences: { |
| 48 | + jsxAttributeCompletionStyle: "auto", |
| 49 | + includeCompletionsWithSnippetText: true, |
| 50 | + includeCompletionsWithInsertText: true, |
| 51 | + } |
| 52 | +}); |
0 commit comments