add tests for inherited constructor and method

This commit is contained in:
Gabriela Araujo Britto
2019-02-19 14:22:59 -08:00
parent 17b89653c2
commit edf0cec3dd
2 changed files with 46 additions and 0 deletions
@@ -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" });`
});