Add regression tests
This commit is contained in:
parent
ff58f1f2f9
commit
1e93967ec4
3 changed files with 43 additions and 0 deletions
|
@ -798,6 +798,7 @@ namespace ts.codefix {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (isExportSpecifier(declaration)) {
|
else if (isExportSpecifier(declaration)) {
|
||||||
|
Debug.assert(declaration.name.escapedText === InternalSymbolName.Default);
|
||||||
if (declaration.propertyName) {
|
if (declaration.propertyName) {
|
||||||
return declaration.propertyName.escapedText;
|
return declaration.propertyName.escapedText;
|
||||||
}
|
}
|
||||||
|
|
21
tests/cases/fourslash/importNameCodeFixDefaultExport2.ts
Normal file
21
tests/cases/fourslash/importNameCodeFixDefaultExport2.ts
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
/// <reference path="fourslash.ts" />
|
||||||
|
|
||||||
|
// @allowJs: true
|
||||||
|
// @checkJs: true
|
||||||
|
|
||||||
|
// @Filename: /lib.js
|
||||||
|
////class Base { }
|
||||||
|
////export default Base;
|
||||||
|
|
||||||
|
// @Filename: /test.js
|
||||||
|
////[|class Derived extends Base { }|]
|
||||||
|
|
||||||
|
goTo.file("/test.js");
|
||||||
|
verify.importFixAtPosition([
|
||||||
|
`// @ts-ignore
|
||||||
|
class Derived extends Base { }`,
|
||||||
|
`// @ts-nocheck
|
||||||
|
class Derived extends Base { }`,
|
||||||
|
`import Base from "./lib";
|
||||||
|
|
||||||
|
class Derived extends Base { }`,]);
|
21
tests/cases/fourslash/importNameCodeFixDefaultExport3.ts
Normal file
21
tests/cases/fourslash/importNameCodeFixDefaultExport3.ts
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
/// <reference path="fourslash.ts" />
|
||||||
|
|
||||||
|
// @allowJs: true
|
||||||
|
// @checkJs: true
|
||||||
|
|
||||||
|
// @Filename: /lib.js
|
||||||
|
////class Base { }
|
||||||
|
////export { Base as default };
|
||||||
|
|
||||||
|
// @Filename: /test.js
|
||||||
|
////[|class Derived extends Base { }|]
|
||||||
|
|
||||||
|
goTo.file("/test.js");
|
||||||
|
verify.importFixAtPosition([
|
||||||
|
`// @ts-ignore
|
||||||
|
class Derived extends Base { }`,
|
||||||
|
`// @ts-nocheck
|
||||||
|
class Derived extends Base { }`,
|
||||||
|
`import Base from "./lib";
|
||||||
|
|
||||||
|
class Derived extends Base { }`,]);
|
Loading…
Reference in a new issue