mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
add tests for inherited constructor and method
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////class Foo {
|
||||
//// /*a*/constructor/*b*/(t: string, s: string) { }
|
||||
////}
|
||||
////class Bar extends Foo { }
|
||||
////var bar = new Bar("a", "b");
|
||||
////var foo = new Foo("c", "d");
|
||||
|
||||
goTo.select("a", "b");
|
||||
edit.applyRefactor({
|
||||
refactorName: "Convert to named parameters",
|
||||
actionName: "Convert to named parameters",
|
||||
actionDescription: "Convert to named parameters",
|
||||
newContent: `class Foo {
|
||||
constructor({ t, s }: { t: string; s: string; }) { }
|
||||
}
|
||||
class Bar extends Foo { }
|
||||
var bar = new Bar({ t: "a", s: "b" });
|
||||
var foo = new Foo({ t: "c", s: "d" })`
|
||||
});
|
||||
@@ -0,0 +1,25 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////class Foo {
|
||||
//// /*a*/bar/*b*/(t: string, s: string): string {
|
||||
//// return s + t;
|
||||
//// }
|
||||
////}
|
||||
////class Bar extends Foo { }
|
||||
////var bar = new Bar();
|
||||
////bar.bar("a", "b");
|
||||
|
||||
goTo.select("a", "b");
|
||||
edit.applyRefactor({
|
||||
refactorName: "Convert to named parameters",
|
||||
actionName: "Convert to named parameters",
|
||||
actionDescription: "Convert to named parameters",
|
||||
newContent: `class Foo {
|
||||
bar({ t, s }: { t: string; s: string; }): string {
|
||||
return s + t;
|
||||
}
|
||||
}
|
||||
class Bar extends Foo { }
|
||||
var bar = new Bar();
|
||||
bar.bar({ t: "a", s: "b" });`
|
||||
});
|
||||
Reference in New Issue
Block a user