mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
Add tests for binding pattern in parameter property declaration
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @Filename: file1.ts
|
||||
//// class Foo {
|
||||
//// constructor(private {/*0*/privateParam}: number,
|
||||
//// public {/*1*/publicParam}: string,
|
||||
//// protected {/*2*/protectedParam}: boolean) {
|
||||
////
|
||||
//// let localPrivate = /*3*/privateParam;
|
||||
//// this.privateParam += 10; // this is not valid syntax
|
||||
////
|
||||
//// let localPublic = /*4*/publicParam;
|
||||
//// this.publicParam += " Hello!"; // this is not valid syntax
|
||||
////
|
||||
//// let localProtected = /*5*/protectedParam;
|
||||
//// this.protectedParam = false; // this is not valid syntax
|
||||
//// }
|
||||
//// }
|
||||
|
||||
let markers = test.markers()
|
||||
for (let marker of markers) {
|
||||
goTo.position(marker.position);
|
||||
verify.documentHighlightsAtPositionCount(3, ["file1.ts"]);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @Filename: file1.ts
|
||||
//// class Foo {
|
||||
//// constructor(private [/*0*/privateParam]: number,
|
||||
//// public [/*1*/publicParam]: string,
|
||||
//// protected [/*2*/protectedParam]: boolean) {
|
||||
////
|
||||
//// let localPrivate = /*3*/privateParam;
|
||||
//// this.privateParam += 10; // this is not valid syntax
|
||||
////
|
||||
//// let localPublic = /*4*/publicParam;
|
||||
//// this.publicParam += " Hello!"; // this is not valid syntax
|
||||
////
|
||||
//// let localProtected = /*5*/protectedParam;
|
||||
//// this.protectedParam = false; // this is not valid syntax
|
||||
//// }
|
||||
//// }
|
||||
|
||||
let markers = test.markers()
|
||||
for (let marker of markers) {
|
||||
goTo.position(marker.position);
|
||||
verify.documentHighlightsAtPositionCount(2, ["file1.ts"]);
|
||||
}
|
||||
13
tests/cases/fourslash/renameParameterPropertyDeclaration4.ts
Normal file
13
tests/cases/fourslash/renameParameterPropertyDeclaration4.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
//// class Foo {
|
||||
//// constructor(protected { |protectedParam| }) {
|
||||
//// let myProtectedParam = |protectedParam|;
|
||||
//// }
|
||||
//// }
|
||||
|
||||
let ranges = test.ranges()
|
||||
for (let range of ranges) {
|
||||
goTo.position(range.start);
|
||||
verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false);
|
||||
}
|
||||
13
tests/cases/fourslash/renameParameterPropertyDeclaration5.ts
Normal file
13
tests/cases/fourslash/renameParameterPropertyDeclaration5.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
//// class Foo {
|
||||
//// constructor(protected [ |protectedParam| ]) {
|
||||
//// let myProtectedParam = |protectedParam|;
|
||||
//// }
|
||||
//// }
|
||||
|
||||
let ranges = test.ranges()
|
||||
for (let range of ranges) {
|
||||
goTo.position(range.start);
|
||||
verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false);
|
||||
}
|
||||
Reference in New Issue
Block a user