Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Commit

Permalink
test: allow users to set additional babylon plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
muzea authored and KnisterPeter committed Sep 26, 2018
1 parent 9798c08 commit 5fab99e
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/babylon-plugin.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
declare module 'Component' {
import * as React from 'react';

export interface ComponentProps {
}

export default class Component extends React.Component<ComponentProps, any> {
render(): JSX.Element;

}

}
16 changes: 16 additions & 0 deletions tests/babylon-plugin.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import * as React from 'react';

export default class Component extends React.PureComponent {

render() {
return <p onClick={() => {
import('./fake-dialog-box.js')
.then(dialogBox => {
dialogBox.open();
})
.catch(error => {
/* Error handling */
})
}} />;
}
}
9 changes: 9 additions & 0 deletions tests/parsing-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,12 @@ test('Parsing should suppport custom eol style', t => {
fs.readFileSync(path.join(basedir, 'pure-component.d.ts')).toString().replace('\r\n', '\n')
);
});
test('Parsing should suppport users to set additional babylon plugins', t => {
compare(
t,
'Component',
'babylon-plugin.jsx',
'babylon-plugin.d.ts',
{ babylonPlugins: ['dynamicImport'] }
);
});

0 comments on commit 5fab99e

Please sign in to comment.