mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-16 07:13:45 -05:00
Rename "getScriptLexicalStructureList" to "navigationBar" in fourslash test helpers and remove unnecessary duplicate helpers
This commit is contained in:
@@ -5,4 +5,4 @@
|
||||
|
||||
goTo.marker();
|
||||
edit.deleteAtCaret('class Bar { }'.length);
|
||||
verify.getScriptLexicalStructureListContains('Foo', 'enum', 'tests/cases/fourslash/deleteClassWithEnumPresent.ts', '');
|
||||
verify.navigationBarContains('Foo', 'enum', 'tests/cases/fourslash/deleteClassWithEnumPresent.ts', '');
|
||||
@@ -175,10 +175,8 @@ declare namespace FourSlashInterface {
|
||||
DocCommentTemplate(expectedText: string, expectedOffset: number, empty?: boolean): void;
|
||||
noDocCommentTemplate(): void;
|
||||
|
||||
getScriptLexicalStructureListCount(count: number): void;
|
||||
getScriptLexicalStructureListContains(name: string, kind: string, fileName?: string, parentName?: string, isAdditionalSpan?: boolean, markerPosition?: number): void;
|
||||
navigationBarCount(count: number);
|
||||
navigationBarItem(text: string, kind: string): void;
|
||||
navigationBarCount(count: number): void;
|
||||
navigationBarContains(name: string, kind: string, fileName?: string, parentName?: string, isAdditionalSpan?: boolean, markerPosition?: number): void;
|
||||
navigationBarChildItem(parent: string, text: string, kind: string): void;
|
||||
navigationItemsListCount(count: number, searchValue: string, matchKind?: string): void;
|
||||
navigationItemsListContains(name: string, kind: string, searchValue: string, matchKind: string, fileName?: string, parentName?: string): void;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
//// ["bar"]: string;
|
||||
////}
|
||||
|
||||
verify.navigationBarCount(1);
|
||||
verify.navigationBarItem("C", "class");
|
||||
verify.navigationBarCount(3);
|
||||
verify.navigationBarContains("C", "class");
|
||||
verify.navigationBarChildItem("C", "[\"bar\"]", "property");
|
||||
verify.navigationBarChildItem("C", "foo", "property");
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//// {| "itemName": "c", "kind": "const", "parentName": "" |}const c = 0;
|
||||
|
||||
test.markers().forEach(marker => {
|
||||
verify.getScriptLexicalStructureListContains(
|
||||
verify.navigationBarContains(
|
||||
marker.data.itemName,
|
||||
marker.data.kind,
|
||||
marker.fileName,
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
test.markers().forEach(marker => {
|
||||
if (marker.data) {
|
||||
verify.getScriptLexicalStructureListContains(
|
||||
verify.navigationBarContains(
|
||||
marker.data.itemName,
|
||||
marker.data.kind,
|
||||
marker.fileName,
|
||||
@@ -38,4 +38,4 @@ test.markers().forEach(marker => {
|
||||
marker.position);
|
||||
}
|
||||
});
|
||||
verify.getScriptLexicalStructureListCount(12);
|
||||
verify.navigationBarCount(12);
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
test.markers().forEach(marker => {
|
||||
goTo.file(marker.fileName);
|
||||
verify.getScriptLexicalStructureListContains(
|
||||
verify.navigationBarContains(
|
||||
marker.data.itemName,
|
||||
marker.data.kind,
|
||||
marker.fileName,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//// {| "itemName": "c", "kind": "let", "parentName": "" |}let c = 0;
|
||||
|
||||
test.markers().forEach(marker => {
|
||||
verify.getScriptLexicalStructureListContains(
|
||||
verify.navigationBarContains(
|
||||
marker.data.itemName,
|
||||
marker.data.kind,
|
||||
marker.fileName,
|
||||
|
||||
@@ -6,16 +6,16 @@
|
||||
////const bar1, [c, d]
|
||||
////var {e, x: [f, g]} = {a:1, x:[]};
|
||||
|
||||
verify.getScriptLexicalStructureListCount(12); // global (1) + variable declarations (4) + binding patterns (7)
|
||||
verify.getScriptLexicalStructureListContains("foo", "var");
|
||||
verify.getScriptLexicalStructureListContains("bar", "var");
|
||||
verify.getScriptLexicalStructureListContains("foo1", "let")
|
||||
verify.getScriptLexicalStructureListContains("a", "let");
|
||||
verify.getScriptLexicalStructureListContains("b", "let");
|
||||
verify.getScriptLexicalStructureListContains("bar1", "const");
|
||||
verify.getScriptLexicalStructureListContains("c", "const");
|
||||
verify.getScriptLexicalStructureListContains("d", "const");
|
||||
verify.getScriptLexicalStructureListContains("e", "var");
|
||||
verify.getScriptLexicalStructureListContains("f", "var");
|
||||
verify.getScriptLexicalStructureListContains("g", "var");
|
||||
verify.navigationBarCount(12); // global (1) + variable declarations (4) + binding patterns (7)
|
||||
verify.navigationBarContains("foo", "var");
|
||||
verify.navigationBarContains("bar", "var");
|
||||
verify.navigationBarContains("foo1", "let")
|
||||
verify.navigationBarContains("a", "let");
|
||||
verify.navigationBarContains("b", "let");
|
||||
verify.navigationBarContains("bar1", "const");
|
||||
verify.navigationBarContains("c", "const");
|
||||
verify.navigationBarContains("d", "const");
|
||||
verify.navigationBarContains("e", "var");
|
||||
verify.navigationBarContains("f", "var");
|
||||
verify.navigationBarContains("g", "var");
|
||||
|
||||
|
||||
@@ -11,4 +11,4 @@
|
||||
//// }
|
||||
////}
|
||||
|
||||
verify.getScriptLexicalStructureListCount(6); // 2x(class + field + constructor)
|
||||
verify.navigationBarCount(6); // 2x(class + field + constructor)
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
//// }
|
||||
////}
|
||||
|
||||
verify.getScriptLexicalStructureListContains("Test", "class");
|
||||
verify.getScriptLexicalStructureListContains("constructor", "constructor");
|
||||
verify.navigationBarContains("Test", "class");
|
||||
verify.navigationBarContains("constructor", "constructor");
|
||||
|
||||
// no other items
|
||||
verify.getScriptLexicalStructureListCount(2);
|
||||
verify.navigationBarCount(2);
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
test.markers().forEach((marker) => {
|
||||
if (marker.data) {
|
||||
verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
|
||||
verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
|
||||
}
|
||||
});
|
||||
|
||||
verify.getScriptLexicalStructureListCount(4);
|
||||
verify.navigationBarCount(4);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
////}
|
||||
|
||||
test.markers().forEach((marker) => {
|
||||
verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
|
||||
verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
|
||||
});
|
||||
|
||||
verify.getScriptLexicalStructureListCount(8); // 4 functions + global. Note: there are 8 because of the functions show up at the top level and as child items.
|
||||
verify.navigationBarCount(8); // 4 functions + global. Note: there are 8 because of the functions show up at the top level and as child items.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
////}
|
||||
|
||||
test.markers().forEach((marker) => {
|
||||
verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
|
||||
verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
|
||||
});
|
||||
|
||||
verify.getScriptLexicalStructureListCount(3); // <global> and 'f'.
|
||||
verify.navigationBarCount(3); // <global> and 'f'.
|
||||
@@ -7,7 +7,7 @@
|
||||
////}
|
||||
|
||||
test.markers().forEach((marker) => {
|
||||
verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
|
||||
verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
|
||||
});
|
||||
|
||||
verify.getScriptLexicalStructureListCount(3); // <global> and 'f'
|
||||
verify.navigationBarCount(3); // <global> and 'f'
|
||||
@@ -18,8 +18,8 @@
|
||||
|
||||
test.markers().forEach((marker) => {
|
||||
if (marker.data) {
|
||||
verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
|
||||
verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
|
||||
}
|
||||
});
|
||||
|
||||
verify.getScriptLexicalStructureListCount(9);
|
||||
verify.navigationBarCount(9);
|
||||
|
||||
@@ -35,8 +35,8 @@
|
||||
////}
|
||||
|
||||
test.markers().forEach((marker) => {
|
||||
verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
|
||||
verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
|
||||
});
|
||||
|
||||
// no other items
|
||||
verify.getScriptLexicalStructureListCount(17);
|
||||
verify.navigationBarCount(17);
|
||||
|
||||
@@ -45,8 +45,8 @@
|
||||
|
||||
test.markers().forEach((marker) => {
|
||||
if (marker.data) {
|
||||
verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
|
||||
verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
|
||||
}
|
||||
});
|
||||
|
||||
verify.getScriptLexicalStructureListCount(23);
|
||||
verify.navigationBarCount(23);
|
||||
|
||||
@@ -8,5 +8,5 @@ edit.insertLine("module A");
|
||||
edit.insert("export class ");
|
||||
|
||||
// should not crash
|
||||
verify.getScriptLexicalStructureListCount(2);
|
||||
verify.navigationBarCount(2);
|
||||
|
||||
|
||||
@@ -30,15 +30,15 @@
|
||||
////}
|
||||
|
||||
goTo.marker("file1");
|
||||
verify.getScriptLexicalStructureListCount(0);
|
||||
verify.navigationBarCount(0);
|
||||
|
||||
goTo.marker("file2");
|
||||
verify.getScriptLexicalStructureListContains("<global>", "module");
|
||||
verify.getScriptLexicalStructureListContains("x", "var");
|
||||
verify.getScriptLexicalStructureListCount(2);
|
||||
verify.navigationBarContains("<global>", "module");
|
||||
verify.navigationBarContains("x", "var");
|
||||
verify.navigationBarCount(2);
|
||||
|
||||
goTo.marker("file3");
|
||||
verify.getScriptLexicalStructureListContains("<global>", "module");
|
||||
verify.getScriptLexicalStructureListContains("foo", "function");
|
||||
verify.getScriptLexicalStructureListContains("bar", "function");
|
||||
verify.getScriptLexicalStructureListCount(5);
|
||||
verify.navigationBarContains("<global>", "module");
|
||||
verify.navigationBarContains("foo", "function");
|
||||
verify.navigationBarContains("bar", "function");
|
||||
verify.navigationBarCount(5);
|
||||
@@ -5,7 +5,7 @@
|
||||
////}
|
||||
|
||||
test.markers().forEach((marker) => {
|
||||
verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
|
||||
verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
|
||||
});
|
||||
|
||||
verify.getScriptLexicalStructureListCount(2); // external module node + class + property
|
||||
verify.navigationBarCount(2); // external module node + class + property
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
////export var x: number;
|
||||
|
||||
test.markers().forEach((marker) => {
|
||||
verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
|
||||
verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
|
||||
});
|
||||
|
||||
verify.getScriptLexicalStructureListCount(4); // external module node + variable in module + class + property
|
||||
verify.navigationBarCount(4); // external module node + variable in module + class + property
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
////export var x: number;
|
||||
|
||||
test.markers().forEach((marker) => {
|
||||
verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
|
||||
verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
|
||||
});
|
||||
|
||||
verify.getScriptLexicalStructureListCount(4); // external module node + variable in module + class + property
|
||||
verify.navigationBarCount(4); // external module node + variable in module + class + property
|
||||
|
||||
@@ -19,12 +19,12 @@
|
||||
//// export var z = 0;
|
||||
////}
|
||||
goTo.marker("file1");
|
||||
verify.getScriptLexicalStructureListContains("Module1", "module");
|
||||
verify.getScriptLexicalStructureListContains("x", "var");
|
||||
verify.navigationBarContains("Module1", "module");
|
||||
verify.navigationBarContains("x", "var");
|
||||
// nothing else should show up
|
||||
verify.getScriptLexicalStructureListCount(2);
|
||||
verify.navigationBarCount(2);
|
||||
|
||||
goTo.marker("file2");
|
||||
verify.getScriptLexicalStructureListContains("Module1.SubModule", "module");
|
||||
verify.getScriptLexicalStructureListContains("y", "var");
|
||||
verify.getScriptLexicalStructureListCount(2);
|
||||
verify.navigationBarContains("Module1.SubModule", "module");
|
||||
verify.navigationBarContains("y", "var");
|
||||
verify.navigationBarCount(2);
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
|
||||
test.markers().forEach((marker) => {
|
||||
verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
|
||||
verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
|
||||
});
|
||||
|
||||
/// Only have two named elements.
|
||||
verify.getScriptLexicalStructureListCount(2);
|
||||
verify.navigationBarCount(2);
|
||||
|
||||
@@ -8,4 +8,4 @@
|
||||
|
||||
|
||||
// The class is unnamed, so its method is not included either.
|
||||
verify.getScriptLexicalStructureListCount(2);
|
||||
verify.navigationBarCount(2);
|
||||
|
||||
@@ -39,10 +39,10 @@
|
||||
|
||||
|
||||
test.markers().forEach((marker) => {
|
||||
verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
|
||||
verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
|
||||
});
|
||||
|
||||
/// We have 8 module keywords, and 4 var keywords.
|
||||
/// The declarations of A.B.C.x do not get merged, so the 4 vars are independent.
|
||||
/// The two 'A' modules, however, do get merged, so in reality we have 7 modules.
|
||||
verify.getScriptLexicalStructureListCount(11);
|
||||
verify.navigationBarCount(11);
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
|
||||
test.markers().forEach((marker) => {
|
||||
verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
|
||||
verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
|
||||
});
|
||||
|
||||
verify.getScriptLexicalStructureListCount(9); // interface w/ 2 properties, class w/ 2 properties, 3 modules
|
||||
verify.navigationBarCount(9); // interface w/ 2 properties, class w/ 2 properties, 3 modules
|
||||
@@ -6,10 +6,10 @@
|
||||
//// }
|
||||
////}
|
||||
|
||||
verify.getScriptLexicalStructureListContains("List", "class");
|
||||
verify.getScriptLexicalStructureListContains("constructor", "constructor");
|
||||
verify.getScriptLexicalStructureListContains("a", "property");
|
||||
verify.getScriptLexicalStructureListContains("b", "property");
|
||||
verify.navigationBarContains("List", "class");
|
||||
verify.navigationBarContains("constructor", "constructor");
|
||||
verify.navigationBarContains("a", "property");
|
||||
verify.navigationBarContains("b", "property");
|
||||
|
||||
// no other items
|
||||
verify.getScriptLexicalStructureListCount(4);
|
||||
verify.navigationBarCount(4);
|
||||
@@ -11,7 +11,7 @@
|
||||
////}
|
||||
|
||||
test.markers().forEach(marker => {
|
||||
verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
|
||||
verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
|
||||
});
|
||||
|
||||
verify.getScriptLexicalStructureListCount(test.markers().length);
|
||||
verify.navigationBarCount(test.markers().length);
|
||||
@@ -9,7 +9,7 @@
|
||||
////}
|
||||
|
||||
test.markers().forEach(marker => {
|
||||
verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
|
||||
verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
|
||||
});
|
||||
|
||||
verify.getScriptLexicalStructureListCount(test.markers().length);
|
||||
verify.navigationBarCount(test.markers().length);
|
||||
@@ -7,7 +7,7 @@
|
||||
////}
|
||||
|
||||
test.markers().forEach(marker => {
|
||||
verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
|
||||
verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
|
||||
});
|
||||
|
||||
verify.getScriptLexicalStructureListCount(test.markers().length);
|
||||
verify.navigationBarCount(test.markers().length);
|
||||
@@ -45,8 +45,8 @@
|
||||
|
||||
test.markers().forEach((marker) => {
|
||||
if (marker.data) {
|
||||
verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
|
||||
verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
|
||||
}
|
||||
});
|
||||
|
||||
verify.getScriptLexicalStructureListCount(23);
|
||||
verify.navigationBarCount(23);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//// {| "itemName": "c", "kind": "const", "parentName": "" |}const c = 0;
|
||||
|
||||
test.markers().forEach(marker => {
|
||||
verify.getScriptLexicalStructureListContains(
|
||||
verify.navigationBarContains(
|
||||
marker.data.itemName,
|
||||
marker.data.kind,
|
||||
marker.fileName,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//// {| "itemName": "c", "kind": "const", "parentName": "" |}const c = 0;
|
||||
|
||||
test.markers().forEach(marker => {
|
||||
verify.getScriptLexicalStructureListContains(
|
||||
verify.navigationBarContains(
|
||||
marker.data.itemName,
|
||||
marker.data.kind,
|
||||
marker.fileName,
|
||||
|
||||
Reference in New Issue
Block a user