Skip to content

Commit

Permalink
test: update fragment test casess
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunqing committed Aug 1, 2022
1 parent a9bd474 commit 79ff627
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/plugin-react/src/jsx-runtime/restore-jsx.spec.ts
Expand Up @@ -122,4 +122,26 @@ describe('restore-jsx', () => {
React__default.createElement(Foo, {hi: there})`)
).toMatch(`<Foo hi={there} />;`)
})

it('should handle Fragment', async () => {
expect(
await jsx(`import R, { Fragment } from 'react';
R.createElement(F1)

This comment has been minimized.

Copy link
@aleclarson

aleclarson Aug 1, 2022

Member

This should be R.createElement(Fragment), no?

`)
).toMatchInlineSnapshot(`
"import R, { Fragment } from 'react';
<F1 />;"
`)
})

it('should handle Fragment alias', async () => {
expect(
await jsx(`import RA, { Fragment as F } from 'react';
RA.createElement(F, null, RA.createElement(RA.Fragment))
`)
).toMatchInlineSnapshot(`
"import RA, { Fragment as F } from 'react';
<F><></></F>;"
`)
})
})

0 comments on commit 79ff627

Please sign in to comment.