Skip to content

Commit 71b7695

Browse files
committed
add fourslash tests for codefix
1 parent 3ffe253 commit 71b7695

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
// @strict: true
4+
5+
//// class A {
6+
//// get x() { return 1 }
7+
//// }
8+
//// class B extends A {
9+
//// x = 2
10+
//// }
11+
12+
verify.codeFix({
13+
description: `Generate 'get' and 'set' accessors`,
14+
newFileContent: `class A {
15+
get x() { return 1 }
16+
}
17+
class B extends A {
18+
private _x = 2
19+
public get x() {
20+
return this._x
21+
}
22+
public set x(value) {
23+
this._x = value
24+
}
25+
}`,
26+
index: 0
27+
})
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
// @strict: true
4+
5+
//// class A {
6+
//// x = 1
7+
//// }
8+
//// class B extends A {
9+
//// get x() { return 2 }
10+
//// }
11+
12+
verify.codeFix({
13+
description: `Generate 'get' and 'set' accessors`,
14+
newFileContent: `class A {
15+
private _x = 1
16+
public get x() {
17+
return this._x
18+
}
19+
public set x(value) {
20+
this._x = value
21+
}
22+
}
23+
class B extends A {
24+
get x() { return 2 }
25+
}`,
26+
index: 0
27+
})

0 commit comments

Comments
 (0)