kittenipc/kitcom/internal/tsgo/fourslash/tests/gen/completionsJsxAttributeInitializer2_test.go
2025-10-15 10:12:44 +03:00

64 lines
1.8 KiB
Go

package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionsJsxAttributeInitializer2(t *testing.T) {
t.Parallel()
t.Skip()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `// @Filename: /a.tsx
declare namespace JSX {
interface IntrinsicElements {
div: { a: string, b: string }
}
}
const foo = 0;
<div x=[|f/*0*/|] />;
<div a="1" b/*1*/ />
<div a /*2*/ />`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "0", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "foo",
InsertText: PtrTo("{foo}"),
Detail: PtrTo("const foo: 0"),
Kind: PtrTo(lsproto.CompletionItemKindVariable),
TextEdit: &lsproto.TextEditOrInsertReplaceEdit{
TextEdit: &lsproto.TextEdit{
NewText: "foo",
Range: f.Ranges()[0].LSRange,
},
},
},
},
},
})
f.VerifyCompletions(t, []string{"1", "2"}, &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: []fourslash.CompletionsExpectedItem{
"b",
},
},
})
}