Skip to content

Commit

Permalink
add jsxFragmentFactory compiler option tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nojvek committed May 22, 2020
1 parent 577da2f commit 975e7b8
Show file tree
Hide file tree
Showing 19 changed files with 211 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/baselines/reference/jsxFactoryAndFragment.errors.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
tests/cases/compiler/jsxFactoryAndFragment.tsx(3,1): error TS17016: JSX fragment is not supported when using --jsxFactory
tests/cases/compiler/jsxFactoryAndFragment.tsx(4,1): error TS17016: JSX fragment is not supported when using --jsxFactory
tests/cases/compiler/jsxFactoryAndFragment.tsx(4,17): error TS17016: JSX fragment is not supported when using --jsxFactory
tests/cases/compiler/jsxFactoryAndFragment.tsx(3,1): error TS17016: The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option.
tests/cases/compiler/jsxFactoryAndFragment.tsx(4,1): error TS17016: The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option.
tests/cases/compiler/jsxFactoryAndFragment.tsx(4,17): error TS17016: The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option.


==== tests/cases/compiler/jsxFactoryAndFragment.tsx (3 errors) ====
declare var h: any;

<></>;
~~~~~
!!! error TS17016: JSX fragment is not supported when using --jsxFactory
!!! error TS17016: The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option.
<><span>1</span><><span>2.1</span><span>2.2</span></></>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS17016: JSX fragment is not supported when using --jsxFactory
!!! error TS17016: The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS17016: JSX fragment is not supported when using --jsxFactory
!!! error TS17016: The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option.
13 changes: 13 additions & 0 deletions tests/baselines/reference/jsxFactoryAndJsxFragmentFactory.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//// [jsxFactoryAndJsxFragmentFactory.tsx]
declare var h: any;

<></>;
<><span>1</span><><span>2.1</span><span>2.2</span></></>;

//// [jsxFactoryAndJsxFragmentFactory.js]
h(Frag, null);
h(Frag, null,
h("span", null, "1"),
h(Frag, null,
h("span", null, "2.1"),
h("span", null, "2.2")));
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
=== tests/cases/compiler/jsxFactoryAndJsxFragmentFactory.tsx ===
declare var h: any;
>h : Symbol(h, Decl(jsxFactoryAndJsxFragmentFactory.tsx, 0, 11))

<></>;
<><span>1</span><><span>2.1</span><span>2.2</span></></>;
20 changes: 20 additions & 0 deletions tests/baselines/reference/jsxFactoryAndJsxFragmentFactory.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
=== tests/cases/compiler/jsxFactoryAndJsxFragmentFactory.tsx ===
declare var h: any;
>h : any

<></>;
><></> : error

<><span>1</span><><span>2.1</span><span>2.2</span></></>;
><><span>1</span><><span>2.1</span><span>2.2</span></></> : error
><span>1</span> : error
>span : any
>span : any
><><span>2.1</span><span>2.2</span></> : error
><span>2.1</span> : error
>span : any
>span : any
><span>2.2</span> : error
>span : any
>span : any

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error TS18035: Invalid value for 'jsxFragmentFactory'. '234' is not a valid identifier or qualified-name.


!!! error TS18035: Invalid value for 'jsxFragmentFactory'. '234' is not a valid identifier or qualified-name.
==== tests/cases/compiler/jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.tsx (0 errors) ====
declare var h: any;

<></>;
<><span>1</span><><span>2.1</span><span>2.2</span></></>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//// [jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.tsx]
declare var h: any;

<></>;
<><span>1</span><><span>2.1</span><span>2.2</span></></>;

//// [jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.js]
h(React.Fragment, null);
h(React.Fragment, null,
h("span", null, "1"),
h(React.Fragment, null,
h("span", null, "2.1"),
h("span", null, "2.2")));
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
=== tests/cases/compiler/jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.tsx ===
declare var h: any;
>h : Symbol(h, Decl(jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.tsx, 0, 11))

<></>;
<><span>1</span><><span>2.1</span><span>2.2</span></></>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
=== tests/cases/compiler/jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.tsx ===
declare var h: any;
>h : any

<></>;
><></> : any

<><span>1</span><><span>2.1</span><span>2.2</span></></>;
><><span>1</span><><span>2.1</span><span>2.2</span></></> : any
><span>1</span> : any
>span : any
>span : any
><><span>2.1</span><span>2.2</span></> : any
><span>2.1</span> : any
>span : any
>span : any
><span>2.2</span> : any
>span : any
>span : any

13 changes: 13 additions & 0 deletions tests/baselines/reference/jsxFactoryAndJsxFragmentFactoryNull.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//// [jsxFactoryAndJsxFragmentFactoryNull.tsx]
declare var h: any;

<></>;
<><span>1</span><><span>2.1</span><span>2.2</span></></>;

//// [jsxFactoryAndJsxFragmentFactoryNull.js]
h(null, null);
h(null, null,
h("span", null, "1"),
h(null, null,
h("span", null, "2.1"),
h("span", null, "2.2")));
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
=== tests/cases/compiler/jsxFactoryAndJsxFragmentFactoryNull.tsx ===
declare var h: any;
>h : Symbol(h, Decl(jsxFactoryAndJsxFragmentFactoryNull.tsx, 0, 11))

<></>;
<><span>1</span><><span>2.1</span><span>2.2</span></></>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
=== tests/cases/compiler/jsxFactoryAndJsxFragmentFactoryNull.tsx ===
declare var h: any;
>h : any

<></>;
><></> : error

<><span>1</span><><span>2.1</span><span>2.2</span></></>;
><><span>1</span><><span>2.1</span><span>2.2</span></></> : error
><span>1</span> : error
>span : any
>span : any
><><span>2.1</span><span>2.2</span></> : error
><span>2.1</span> : error
>span : any
>span : any
><span>2.2</span> : error
>span : any
>span : any

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
tests/cases/compiler/jsxFactoryButNoJsxFragmentFactory.tsx(3,1): error TS17016: The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option.
tests/cases/compiler/jsxFactoryButNoJsxFragmentFactory.tsx(4,1): error TS17016: The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option.
tests/cases/compiler/jsxFactoryButNoJsxFragmentFactory.tsx(4,17): error TS17016: The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option.


==== tests/cases/compiler/jsxFactoryButNoJsxFragmentFactory.tsx (3 errors) ====
declare var h: any;

<></>;
~~~~~
!!! error TS17016: The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option.
<><span>1</span><><span>2.1</span><span>2.2</span></></>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS17016: The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS17016: The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option.
13 changes: 13 additions & 0 deletions tests/baselines/reference/jsxFactoryButNoJsxFragmentFactory.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//// [jsxFactoryButNoJsxFragmentFactory.tsx]
declare var h: any;

<></>;
<><span>1</span><><span>2.1</span><span>2.2</span></></>;

//// [jsxFactoryButNoJsxFragmentFactory.js]
h(React.Fragment, null);
h(React.Fragment, null,
h("span", null, "1"),
h(React.Fragment, null,
h("span", null, "2.1"),
h("span", null, "2.2")));
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
=== tests/cases/compiler/jsxFactoryButNoJsxFragmentFactory.tsx ===
declare var h: any;
>h : Symbol(h, Decl(jsxFactoryButNoJsxFragmentFactory.tsx, 0, 11))

<></>;
<><span>1</span><><span>2.1</span><span>2.2</span></></>;
20 changes: 20 additions & 0 deletions tests/baselines/reference/jsxFactoryButNoJsxFragmentFactory.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
=== tests/cases/compiler/jsxFactoryButNoJsxFragmentFactory.tsx ===
declare var h: any;
>h : any

<></>;
><></> : any

<><span>1</span><><span>2.1</span><span>2.2</span></></>;
><><span>1</span><><span>2.1</span><span>2.2</span></></> : any
><span>1</span> : any
>span : any
>span : any
><><span>2.1</span><span>2.2</span></> : any
><span>2.1</span> : any
>span : any
>span : any
><span>2.2</span> : any
>span : any
>span : any

8 changes: 8 additions & 0 deletions tests/cases/compiler/jsxFactoryAndJsxFragmentFactory.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//@jsx: react
//@jsxFactory: h
//@jsxFragmentFactory: Frag

declare var h: any;

<></>;
<><span>1</span><><span>2.1</span><span>2.2</span></></>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//@jsx: react
//@jsxFactory: h
//@jsxFragmentFactory: 234

declare var h: any;

<></>;
<><span>1</span><><span>2.1</span><span>2.2</span></></>;
8 changes: 8 additions & 0 deletions tests/cases/compiler/jsxFactoryAndJsxFragmentFactoryNull.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//@jsx: react
//@jsxFactory: h
//@jsxFragmentFactory: null

declare var h: any;

<></>;
<><span>1</span><><span>2.1</span><span>2.2</span></></>;

0 comments on commit 975e7b8

Please sign in to comment.