2017-08-05 01:10:33 +02:00
|
|
|
/// <reference path='fourslash.ts' />
|
|
|
|
|
|
|
|
// Extracting from a static method should create a static method
|
|
|
|
|
|
|
|
//// class Foo {
|
|
|
|
//// static method() {
|
|
|
|
//// /*start*/return 1;/*end*/
|
|
|
|
//// }
|
|
|
|
//// }
|
|
|
|
|
|
|
|
goTo.select('start', 'end')
|
|
|
|
|
2017-09-15 01:04:44 +02:00
|
|
|
verify.refactorAvailable('Extract Symbol', 'function_scope_1');
|
2017-08-05 01:10:33 +02:00
|
|
|
|
2017-08-25 18:53:28 +02:00
|
|
|
edit.applyRefactor({
|
2017-09-15 01:04:44 +02:00
|
|
|
refactorName: "Extract Symbol",
|
|
|
|
actionName: "function_scope_1",
|
2017-09-09 14:52:52 +02:00
|
|
|
actionDescription: "Extract to method in class 'Foo'",
|
2017-09-13 18:02:10 +02:00
|
|
|
newContent:
|
|
|
|
`class Foo {
|
2017-08-05 01:10:33 +02:00
|
|
|
static method() {
|
2017-09-15 01:04:44 +02:00
|
|
|
return Foo./*RENAME*/newMethod();
|
2017-08-05 01:10:33 +02:00
|
|
|
}
|
|
|
|
|
2017-09-15 01:04:44 +02:00
|
|
|
private static newMethod() {
|
2017-08-05 01:10:33 +02:00
|
|
|
return 1;
|
|
|
|
}
|
2017-09-13 18:02:10 +02:00
|
|
|
}`
|
|
|
|
});
|