diff --git a/tests/cases/fourslash/asOperatorFormatting.ts b/tests/cases/fourslash/asOperatorFormatting.ts new file mode 100644 index 0000000000..f697ffd8bb --- /dev/null +++ b/tests/cases/fourslash/asOperatorFormatting.ts @@ -0,0 +1,7 @@ +/// + +//// /**/var x = 3 as number; + +goTo.marker(); +format.document(); +verify.currentLineContentIs("var x = 3 as number;"); diff --git a/tests/cases/fourslash/server/tsxIncrementalServer.ts b/tests/cases/fourslash/server/tsxIncrementalServer.ts new file mode 100644 index 0000000000..9ae51406c2 --- /dev/null +++ b/tests/cases/fourslash/server/tsxIncrementalServer.ts @@ -0,0 +1,13 @@ +/// + +//// /**/ + +goTo.marker(); +edit.insert("<"); +edit.insert("div"); +edit.insert(" "); +edit.insert(" id"); +edit.insert("="); +edit.insert("\"foo"); +edit.insert("\""); +edit.insert(">"); diff --git a/tests/cases/fourslash/tsxCompletion1.ts b/tests/cases/fourslash/tsxCompletion1.ts new file mode 100644 index 0000000000..f638b0b6e4 --- /dev/null +++ b/tests/cases/fourslash/tsxCompletion1.ts @@ -0,0 +1,14 @@ +/// + +//@Filename: file.tsx +//// declare module JSX { +//// interface Element { } +//// interface IntrinsicElements { +//// div: { ONE: string; TWO: number; } +//// } +//// } +//// var x =
; + +goTo.marker(); +verify.completionListContains('ONE'); +verify.completionListContains('TWO'); diff --git a/tests/cases/fourslash/tsxCompletion2.ts b/tests/cases/fourslash/tsxCompletion2.ts new file mode 100644 index 0000000000..d33f910687 --- /dev/null +++ b/tests/cases/fourslash/tsxCompletion2.ts @@ -0,0 +1,15 @@ +/// + +//@Filename: file.tsx +//// declare module JSX { +//// interface Element { } +//// interface IntrinsicElements { +//// } +//// interface ElementAttributesProperty { props; } +//// } +//// class MyComp { props: { ONE: string; TWO: number } } +//// var x = ; + +goTo.marker(); +verify.completionListContains('ONE'); +verify.completionListContains('TWO'); diff --git a/tests/cases/fourslash/tsxGoToDefinitionClasses.ts b/tests/cases/fourslash/tsxGoToDefinitionClasses.ts new file mode 100644 index 0000000000..11ff3afeb8 --- /dev/null +++ b/tests/cases/fourslash/tsxGoToDefinitionClasses.ts @@ -0,0 +1,23 @@ +/// + +//@Filename: file.tsx +//// declare module JSX { +//// interface Element { } +//// interface IntrinsicElements { } +//// interface ElementAttributesProperty { props; } +//// } +//// /*ct*/class MyClass { +//// props: { +//// /*pt*/foo: string; +//// } +//// } +//// var x = ; +//// var y = ; + +goTo.marker('c'); +goTo.definition(); +verify.caretAtMarker('ct'); + +goTo.marker('p'); +goTo.definition(); +verify.caretAtMarker('pt'); diff --git a/tests/cases/fourslash/tsxGoToDefinitionIntrinsics.ts b/tests/cases/fourslash/tsxGoToDefinitionIntrinsics.ts new file mode 100644 index 0000000000..bbdf395e47 --- /dev/null +++ b/tests/cases/fourslash/tsxGoToDefinitionIntrinsics.ts @@ -0,0 +1,29 @@ +/// + +//@Filename: file.tsx +//// declare module JSX { +//// interface Element { } +//// interface IntrinsicElements { +//// /*dt*/div: { +//// /*pt*/name?: string; +//// isOpen?: boolean; +//// }; +//// /*st*/span: { n: string; }; +//// } +//// } +//// var x = ; +//// var y = ; +//// var z =
; + +goTo.marker('ds'); +goTo.definition(); +verify.caretAtMarker('dt'); + +goTo.marker('ss'); +goTo.definition(); +verify.caretAtMarker('st'); + +goTo.marker('ps'); +goTo.definition(); +verify.caretAtMarker('pt'); + diff --git a/tests/cases/fourslash/tsxIncremental.ts b/tests/cases/fourslash/tsxIncremental.ts new file mode 100644 index 0000000000..c901401fff --- /dev/null +++ b/tests/cases/fourslash/tsxIncremental.ts @@ -0,0 +1,13 @@ +/// + +//// /**/ + +goTo.marker(); +edit.insert("<"); +edit.insert("div"); +edit.insert(" "); +edit.insert(" id"); +edit.insert("="); +edit.insert("\"foo"); +edit.insert("\""); +edit.insert(">"); diff --git a/tests/cases/fourslash/tsxParsing.ts b/tests/cases/fourslash/tsxParsing.ts new file mode 100644 index 0000000000..e5b2e7ea84 --- /dev/null +++ b/tests/cases/fourslash/tsxParsing.ts @@ -0,0 +1,5 @@ +//// var x =
; +//// var y = /**/x; + +goTo.marker(); +verify.quickInfoExists(); diff --git a/tests/cases/fourslash/tsxRename1.ts b/tests/cases/fourslash/tsxRename1.ts new file mode 100644 index 0000000000..3fb973ec99 --- /dev/null +++ b/tests/cases/fourslash/tsxRename1.ts @@ -0,0 +1,17 @@ +/// + +//@Filename: file.tsx +//// declare module JSX { +//// interface Element { } +//// interface IntrinsicElements { +//// [|div|]: { +//// name?: string; +//// isOpen?: boolean; +//// }; +//// span: { n: string; }; +//// } +//// } +//// var x = <[|di/*ds*/v|] />; + +goTo.marker('ds'); +verify.renameLocations(false, false); diff --git a/tests/cases/fourslash/tsxRename2.ts b/tests/cases/fourslash/tsxRename2.ts new file mode 100644 index 0000000000..d0f5737214 --- /dev/null +++ b/tests/cases/fourslash/tsxRename2.ts @@ -0,0 +1,17 @@ +/// + +//@Filename: file.tsx +//// declare module JSX { +//// interface Element { } +//// interface IntrinsicElements { +//// div: { +//// [|name|]?: string; +//// isOpen?: boolean; +//// }; +//// span: { n: string; }; +//// } +//// } +//// var x =
; + +goTo.marker(); +verify.renameLocations(false, false); diff --git a/tests/cases/fourslash/tsxRename3.ts b/tests/cases/fourslash/tsxRename3.ts new file mode 100644 index 0000000000..1ab9c8a591 --- /dev/null +++ b/tests/cases/fourslash/tsxRename3.ts @@ -0,0 +1,20 @@ +/// + +//@Filename: file.tsx +//// declare module JSX { +//// interface Element { } +//// interface IntrinsicElements { +//// } +//// interface ElementAttributesProperty { props } +//// } +//// class MyClass { +//// props: { +//// [|name|]?: string; +//// size?: number; +//// } +//// +//// +//// var x = ; + +goTo.marker(); +verify.renameLocations(false, false);