TypeScript/tests/cases/fourslash/extract-method26.ts

31 lines
622 B
TypeScript
Raw Normal View History

/// <reference path='fourslash.ts' />
// Handle having zero modifiers on a method.
// @allowNonTsExtensions: true
// @Filename: file1.js
//// class C {
//// M() {
//// const q = /*a*/1 + 2/*b*/;
//// q.toString();
//// }
//// }
goTo.select('a', 'b')
edit.applyRefactor({
refactorName: "Extract Symbol",
actionName: "function_scope_1",
actionDescription: "Extract to method in class 'C'",
newContent:
`class C {
M() {
const q = this./*RENAME*/newMethod();
q.toString();
}
newMethod() {
return 1 + 2;
}
}`
});