mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 21:36:50 -05:00
add fourslash tests for codefix
This commit is contained in:
27
tests/cases/fourslash/codeFixPropertyOverrideAccess.ts
Normal file
27
tests/cases/fourslash/codeFixPropertyOverrideAccess.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @strict: true
|
||||
|
||||
//// class A {
|
||||
//// get x() { return 1 }
|
||||
//// }
|
||||
//// class B extends A {
|
||||
//// x = 2
|
||||
//// }
|
||||
|
||||
verify.codeFix({
|
||||
description: `Generate 'get' and 'set' accessors`,
|
||||
newFileContent: `class A {
|
||||
get x() { return 1 }
|
||||
}
|
||||
class B extends A {
|
||||
private _x = 2
|
||||
public get x() {
|
||||
return this._x
|
||||
}
|
||||
public set x(value) {
|
||||
this._x = value
|
||||
}
|
||||
}`,
|
||||
index: 0
|
||||
})
|
||||
27
tests/cases/fourslash/codeFixPropertyOverrideAccess2.ts
Normal file
27
tests/cases/fourslash/codeFixPropertyOverrideAccess2.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @strict: true
|
||||
|
||||
//// class A {
|
||||
//// x = 1
|
||||
//// }
|
||||
//// class B extends A {
|
||||
//// get x() { return 2 }
|
||||
//// }
|
||||
|
||||
verify.codeFix({
|
||||
description: `Generate 'get' and 'set' accessors`,
|
||||
newFileContent: `class A {
|
||||
private _x = 1
|
||||
public get x() {
|
||||
return this._x
|
||||
}
|
||||
public set x(value) {
|
||||
this._x = value
|
||||
}
|
||||
}
|
||||
class B extends A {
|
||||
get x() { return 2 }
|
||||
}`,
|
||||
index: 0
|
||||
})
|
||||
Reference in New Issue
Block a user