Files
kjol/tools/tsgo/internal/fourslash/tests/gen/tsxGoToDefinitionStatelessFunction2_test.go
2026-07-09 16:50:43 -04:00

49 lines
1.7 KiB
Go

// Code generated by convertFourslash; DO NOT EDIT.
// To modify this test, run "npm run makemanual tsxGoToDefinitionStatelessFunction2"
package fourslash_test
import (
"testing"
"github.com/microsoft/typescript-go/internal/fourslash"
"github.com/microsoft/typescript-go/internal/testutil"
)
func TestTsxGoToDefinitionStatelessFunction2(t *testing.T) {
fourslash.SkipIfFailing(t)
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `//@Filename: file.tsx
// @jsx: preserve
// @noLib: true
declare namespace JSX {
interface Element { }
interface IntrinsicElements {
}
interface ElementAttributesProperty { props; }
}
interface ClickableProps {
children?: string;
className?: string;
}
interface ButtonProps extends ClickableProps {
onClick(event?: React.MouseEvent<HTMLButtonElement>): void;
}
interface LinkProps extends ClickableProps {
goTo: string;
}
declare function /*firstSource*/MainButton(buttonProps: ButtonProps): JSX.Element;
declare function /*secondSource*/MainButton(linkProps: LinkProps): JSX.Element;
declare function /*thirdSource*/MainButton(props: ButtonProps | LinkProps): JSX.Element;
let opt = <[|Main/*firstTarget*/Button|] />;
let opt = <[|Main/*secondTarget*/Button|] children="chidlren" />;
let opt = <[|Main/*thirdTarget*/Button|] onClick={()=>{}} />;
let opt = <[|Main/*fourthTarget*/Button|] onClick={()=>{}} ignore-prop />;
let opt = <[|Main/*fifthTarget*/Button|] goTo="goTo" />;
let opt = <[|Main/*sixthTarget*/Button|] wrong />;`
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
defer done()
f.VerifyBaselineGoToDefinition(t, true, "firstTarget", "secondTarget", "thirdTarget", "fourthTarget", "fifthTarget", "sixthTarget")
}