mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-19 10:41:56 -05:00
add tests
This commit is contained in:
17
tests/cases/fourslash/refactorConvertToNamedParameters18.ts
Normal file
17
tests/cases/fourslash/refactorConvertToNamedParameters18.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////function foo(this: void, /*a*/t: string, s: string/*b*/) {
|
||||
//// return s;
|
||||
////}
|
||||
////foo("a", "b");
|
||||
|
||||
goTo.select("a", "b");
|
||||
edit.applyRefactor({
|
||||
refactorName: "Convert to named parameters",
|
||||
actionName: "Convert to named parameters",
|
||||
actionDescription: "Convert to named parameters",
|
||||
newContent: `function foo(this: void, { t, s }: { t: string; s: string; }) {
|
||||
return s;
|
||||
}
|
||||
foo({ t: "a", s: "b" });`
|
||||
});
|
||||
24
tests/cases/fourslash/refactorConvertToNamedParameters19.ts
Normal file
24
tests/cases/fourslash/refactorConvertToNamedParameters19.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////class Foo {
|
||||
//// /*a*/bar/*b*/(t: string, s: string): string {
|
||||
//// return s + t;
|
||||
//// }
|
||||
////}
|
||||
////var foo = {};
|
||||
////foo['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;
|
||||
}
|
||||
}
|
||||
var foo = {};
|
||||
foo['bar']("a", "b");`
|
||||
});
|
||||
Reference in New Issue
Block a user