60 lines
1.7 KiB
Go
60 lines
1.7 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 TestProtoPropertyInObjectLiteral(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
|
const content = `var o1 = {
|
|
"__proto__": 10
|
|
};
|
|
var o2 = {
|
|
__proto__: 10
|
|
};
|
|
o1./*1*/
|
|
o2./*2*/`
|
|
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
|
f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{
|
|
IsIncomplete: false,
|
|
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
|
|
CommitCharacters: &DefaultCommitCharacters,
|
|
EditRange: Ignored,
|
|
},
|
|
Items: &fourslash.CompletionsExpectedItems{
|
|
Exact: []fourslash.CompletionsExpectedItem{
|
|
&lsproto.CompletionItem{
|
|
Label: "__proto__",
|
|
Detail: PtrTo("(property) \"__proto__\": number"),
|
|
},
|
|
},
|
|
},
|
|
})
|
|
f.Insert(t, "__proto__ = 10;")
|
|
f.VerifyQuickInfoAt(t, "1", "(property) \"__proto__\": number", "")
|
|
f.VerifyCompletions(t, "2", &fourslash.CompletionsExpectedList{
|
|
IsIncomplete: false,
|
|
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
|
|
CommitCharacters: &DefaultCommitCharacters,
|
|
EditRange: Ignored,
|
|
},
|
|
Items: &fourslash.CompletionsExpectedItems{
|
|
Exact: []fourslash.CompletionsExpectedItem{
|
|
&lsproto.CompletionItem{
|
|
Label: "__proto__",
|
|
Detail: PtrTo("(property) __proto__: number"),
|
|
},
|
|
},
|
|
},
|
|
})
|
|
f.Insert(t, "__proto__ = 10;")
|
|
f.VerifyQuickInfoAt(t, "2", "(property) __proto__: number", "")
|
|
}
|