Fourslash tests for JSX and As

This commit is contained in:
Ryan Cavanaugh 2015-06-18 14:02:47 -07:00
parent e34d8cdccb
commit fa198a5cef
11 changed files with 173 additions and 0 deletions

View 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;");

View 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(">");

View 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');

View 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');

View 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');

View 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');

View 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(">");

View file

@ -0,0 +1,5 @@
//// var x = <div id="foo" master="bar"></div>;
//// var y = /**/x;
goTo.marker();
verify.quickInfoExists();

View 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);

View 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);

View 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);