Fourslash tests for JSX and As
This commit is contained in:
parent
e34d8cdccb
commit
fa198a5cef
7
tests/cases/fourslash/asOperatorFormatting.ts
Normal file
7
tests/cases/fourslash/asOperatorFormatting.ts
Normal file
|
@ -0,0 +1,7 @@
|
|||
/// <reference path="fourslash.ts" />
|
||||
|
||||
//// /**/var x = 3 as number;
|
||||
|
||||
goTo.marker();
|
||||
format.document();
|
||||
verify.currentLineContentIs("var x = 3 as number;");
|
13
tests/cases/fourslash/server/tsxIncrementalServer.ts
Normal file
13
tests/cases/fourslash/server/tsxIncrementalServer.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
/// <reference path='../fourslash.ts' />
|
||||
|
||||
//// /**/
|
||||
|
||||
goTo.marker();
|
||||
edit.insert("<");
|
||||
edit.insert("div");
|
||||
edit.insert(" ");
|
||||
edit.insert(" id");
|
||||
edit.insert("=");
|
||||
edit.insert("\"foo");
|
||||
edit.insert("\"");
|
||||
edit.insert(">");
|
14
tests/cases/fourslash/tsxCompletion1.ts
Normal file
14
tests/cases/fourslash/tsxCompletion1.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//@Filename: file.tsx
|
||||
//// declare module JSX {
|
||||
//// interface Element { }
|
||||
//// interface IntrinsicElements {
|
||||
//// div: { ONE: string; TWO: number; }
|
||||
//// }
|
||||
//// }
|
||||
//// var x = <div /**//>;
|
||||
|
||||
goTo.marker();
|
||||
verify.completionListContains('ONE');
|
||||
verify.completionListContains('TWO');
|
15
tests/cases/fourslash/tsxCompletion2.ts
Normal file
15
tests/cases/fourslash/tsxCompletion2.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//@Filename: file.tsx
|
||||
//// declare module JSX {
|
||||
//// interface Element { }
|
||||
//// interface IntrinsicElements {
|
||||
//// }
|
||||
//// interface ElementAttributesProperty { props; }
|
||||
//// }
|
||||
//// class MyComp { props: { ONE: string; TWO: number } }
|
||||
//// var x = <MyComp /**//>;
|
||||
|
||||
goTo.marker();
|
||||
verify.completionListContains('ONE');
|
||||
verify.completionListContains('TWO');
|
23
tests/cases/fourslash/tsxGoToDefinitionClasses.ts
Normal file
23
tests/cases/fourslash/tsxGoToDefinitionClasses.ts
Normal file
|
@ -0,0 +1,23 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//@Filename: file.tsx
|
||||
//// declare module JSX {
|
||||
//// interface Element { }
|
||||
//// interface IntrinsicElements { }
|
||||
//// interface ElementAttributesProperty { props; }
|
||||
//// }
|
||||
//// /*ct*/class MyClass {
|
||||
//// props: {
|
||||
//// /*pt*/foo: string;
|
||||
//// }
|
||||
//// }
|
||||
//// var x = <My/*c*/Class />;
|
||||
//// var y = <MyClass f/*p*/oo= 'hello' />;
|
||||
|
||||
goTo.marker('c');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('ct');
|
||||
|
||||
goTo.marker('p');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('pt');
|
29
tests/cases/fourslash/tsxGoToDefinitionIntrinsics.ts
Normal file
29
tests/cases/fourslash/tsxGoToDefinitionIntrinsics.ts
Normal file
|
@ -0,0 +1,29 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//@Filename: file.tsx
|
||||
//// declare module JSX {
|
||||
//// interface Element { }
|
||||
//// interface IntrinsicElements {
|
||||
//// /*dt*/div: {
|
||||
//// /*pt*/name?: string;
|
||||
//// isOpen?: boolean;
|
||||
//// };
|
||||
//// /*st*/span: { n: string; };
|
||||
//// }
|
||||
//// }
|
||||
//// var x = <di/*ds*/v />;
|
||||
//// var y = <s/*ss*/pan />;
|
||||
//// var z = <div na/*ps*/me='hello' />;
|
||||
|
||||
goTo.marker('ds');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('dt');
|
||||
|
||||
goTo.marker('ss');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('st');
|
||||
|
||||
goTo.marker('ps');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('pt');
|
||||
|
13
tests/cases/fourslash/tsxIncremental.ts
Normal file
13
tests/cases/fourslash/tsxIncremental.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// /**/
|
||||
|
||||
goTo.marker();
|
||||
edit.insert("<");
|
||||
edit.insert("div");
|
||||
edit.insert(" ");
|
||||
edit.insert(" id");
|
||||
edit.insert("=");
|
||||
edit.insert("\"foo");
|
||||
edit.insert("\"");
|
||||
edit.insert(">");
|
5
tests/cases/fourslash/tsxParsing.ts
Normal file
5
tests/cases/fourslash/tsxParsing.ts
Normal file
|
@ -0,0 +1,5 @@
|
|||
//// var x = <div id="foo" master="bar"></div>;
|
||||
//// var y = /**/x;
|
||||
|
||||
goTo.marker();
|
||||
verify.quickInfoExists();
|
17
tests/cases/fourslash/tsxRename1.ts
Normal file
17
tests/cases/fourslash/tsxRename1.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//@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);
|
17
tests/cases/fourslash/tsxRename2.ts
Normal file
17
tests/cases/fourslash/tsxRename2.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//@Filename: file.tsx
|
||||
//// declare module JSX {
|
||||
//// interface Element { }
|
||||
//// interface IntrinsicElements {
|
||||
//// div: {
|
||||
//// [|name|]?: string;
|
||||
//// isOpen?: boolean;
|
||||
//// };
|
||||
//// span: { n: string; };
|
||||
//// }
|
||||
//// }
|
||||
//// var x = <div [|na/**/me|]="hello" />;
|
||||
|
||||
goTo.marker();
|
||||
verify.renameLocations(false, false);
|
20
tests/cases/fourslash/tsxRename3.ts
Normal file
20
tests/cases/fourslash/tsxRename3.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//@Filename: file.tsx
|
||||
//// declare module JSX {
|
||||
//// interface Element { }
|
||||
//// interface IntrinsicElements {
|
||||
//// }
|
||||
//// interface ElementAttributesProperty { props }
|
||||
//// }
|
||||
//// class MyClass {
|
||||
//// props: {
|
||||
//// [|name|]?: string;
|
||||
//// size?: number;
|
||||
//// }
|
||||
////
|
||||
////
|
||||
//// var x = <MyClass [|n/**/ame|]='hello'/>;
|
||||
|
||||
goTo.marker();
|
||||
verify.renameLocations(false, false);
|
Loading…
Reference in a new issue