2018-02-07 21:33:16 +01:00
|
|
|
/// <reference path="fourslash.ts" />
|
|
|
|
|
|
|
|
// @jsx: react
|
|
|
|
|
2018-03-26 23:05:03 +02:00
|
|
|
// @Filename: /node_modules/react/index.d.ts
|
|
|
|
////export const React: any;
|
|
|
|
|
2018-02-07 21:33:16 +01:00
|
|
|
// @Filename: /a.tsx
|
|
|
|
////[|<this>|]</this>
|
|
|
|
|
2018-03-26 23:05:03 +02:00
|
|
|
// @Filename: /Foo.tsx
|
|
|
|
////export const Foo = 0;
|
|
|
|
|
|
|
|
// @Filename: /c.tsx
|
|
|
|
////import { React } from "react";
|
2018-05-03 21:58:42 +02:00
|
|
|
////<Foo />;
|
2018-03-26 23:05:03 +02:00
|
|
|
|
|
|
|
// @Filename: /d.tsx
|
2018-05-03 21:58:42 +02:00
|
|
|
////import { Foo } from "./Foo";
|
|
|
|
////<Foo />;
|
2018-02-07 21:33:16 +01:00
|
|
|
|
2018-03-26 23:05:03 +02:00
|
|
|
// Tests that we don't crash at non-identifier location.
|
|
|
|
goTo.file("/a.tsx");
|
2018-02-07 21:33:16 +01:00
|
|
|
verify.importFixAtPosition([]);
|
2018-03-26 23:05:03 +02:00
|
|
|
|
|
|
|
// When constructor is missing, provide fix for that
|
|
|
|
goTo.file("/c.tsx");
|
|
|
|
verify.importFixAtPosition([
|
2018-05-03 21:58:42 +02:00
|
|
|
`import { React } from "react";
|
|
|
|
import { Foo } from "./Foo";
|
2018-03-26 23:05:03 +02:00
|
|
|
<Foo />;`]);
|
|
|
|
|
|
|
|
// When JSX namespace is missing, provide fix for that
|
|
|
|
goTo.file("/d.tsx");
|
|
|
|
verify.importFixAtPosition([
|
|
|
|
`import { Foo } from "./Foo";
|
|
|
|
import { React } from "react";
|
|
|
|
<Foo />;`]);
|