Skip to content

Commit

Permalink
added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Zins committed Feb 1, 2018
1 parent 10bc4cb commit 5ae54a5
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/baselines/reference/tsxSfcReturnArray.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//// [file.tsx]
import React = require('react');

const Foo = (props: any) => [<span />, <span />];

function Greet(x: { name?: string }) {
return [<span />, <span />];
}

const foo = <Foo />;
const G = <Greet />;


//// [file.jsx]
define(["require", "exports", "react"], function (require, exports, React) {
"use strict";
exports.__esModule = true;
var Foo = function (props) { return [<span />, <span />]; };
function Greet(x) {
return [<span />, <span />];
}
var foo = <Foo />;
var G = <Greet />;
});
28 changes: 28 additions & 0 deletions tests/baselines/reference/tsxSfcReturnArray.symbols
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
=== tests/cases/conformance/jsx/file.tsx ===
import React = require('react');
>React : Symbol(React, Decl(file.tsx, 0, 0))

const Foo = (props: any) => [<span />, <span />];
>Foo : Symbol(Foo, Decl(file.tsx, 2, 5))
>props : Symbol(props, Decl(file.tsx, 2, 13))
>span : Symbol(JSX.IntrinsicElements.span, Decl(react.d.ts, 2461, 51))
>span : Symbol(JSX.IntrinsicElements.span, Decl(react.d.ts, 2461, 51))

function Greet(x: { name?: string }) {
>Greet : Symbol(Greet, Decl(file.tsx, 2, 49))
>x : Symbol(x, Decl(file.tsx, 4, 15))
>name : Symbol(name, Decl(file.tsx, 4, 19))

return [<span />, <span />];
>span : Symbol(JSX.IntrinsicElements.span, Decl(react.d.ts, 2461, 51))
>span : Symbol(JSX.IntrinsicElements.span, Decl(react.d.ts, 2461, 51))
}

const foo = <Foo />;
>foo : Symbol(foo, Decl(file.tsx, 8, 5))
>Foo : Symbol(Foo, Decl(file.tsx, 2, 5))

const G = <Greet />;
>G : Symbol(G, Decl(file.tsx, 9, 5))
>Greet : Symbol(Greet, Decl(file.tsx, 2, 49))

37 changes: 37 additions & 0 deletions tests/baselines/reference/tsxSfcReturnArray.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
=== tests/cases/conformance/jsx/file.tsx ===
import React = require('react');
>React : typeof React

const Foo = (props: any) => [<span />, <span />];
>Foo : (props: any) => JSX.Element[]
>(props: any) => [<span />, <span />] : (props: any) => JSX.Element[]
>props : any
>[<span />, <span />] : JSX.Element[]
><span /> : JSX.Element
>span : any
><span /> : JSX.Element
>span : any

function Greet(x: { name?: string }) {
>Greet : (x: { name?: string; }) => JSX.Element[]
>x : { name?: string; }
>name : string

return [<span />, <span />];
>[<span />, <span />] : JSX.Element[]
><span /> : JSX.Element
>span : any
><span /> : JSX.Element
>span : any
}

const foo = <Foo />;
>foo : JSX.Element
><Foo /> : JSX.Element
>Foo : (props: any) => JSX.Element[]

const G = <Greet />;
>G : JSX.Element
><Greet /> : JSX.Element
>Greet : (x: { name?: string; }) => JSX.Element[]

17 changes: 17 additions & 0 deletions tests/cases/conformance/jsx/tsxSfcReturnArray.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// @filename: file.tsx
// @jsx: preserve
// @module: amd
// @noLib: true
// @skipLibCheck: true
// @libFiles: react.d.ts,lib.d.ts

import React = require('react');

const Foo = (props: any) => [<span />, <span />];

function Greet(x: { name?: string }) {
return [<span />, <span />];
}

const foo = <Foo />;
const G = <Greet />;

0 comments on commit 5ae54a5

Please sign in to comment.