File tree 2 files changed +10
-0
lines changed 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,11 @@ var domToReact = require('./lib/dom-to-react');
2
2
var attributesToProps = require ( './lib/attributes-to-props' ) ;
3
3
var htmlToDOM = require ( 'html-dom-parser' ) ;
4
4
5
+ // support backwards compatibility for ES Module
6
+ htmlToDOM =
7
+ /* istanbul ignore next */
8
+ typeof htmlToDOM . default === 'function' ? htmlToDOM . default : htmlToDOM ;
9
+
5
10
var domParserOptions = { lowerCaseAttributeNames : false } ;
6
11
7
12
/**
Original file line number Diff line number Diff line change @@ -6,18 +6,23 @@ const { render } = require('./helpers');
6
6
describe ( 'module' , ( ) => {
7
7
it ( 'exports default' , ( ) => {
8
8
expect ( parse . default ) . toBe ( parse ) ;
9
+ expect ( parse . default ) . toBeInstanceOf ( Function ) ;
9
10
} ) ;
10
11
11
12
it ( 'exports domToReact' , ( ) => {
12
13
expect ( parse . domToReact ) . toBe ( require ( '../lib/dom-to-react' ) ) ;
14
+ expect ( parse . domToReact ) . toBeInstanceOf ( Function ) ;
13
15
} ) ;
14
16
15
17
it ( 'exports htmlToDOM' , ( ) => {
16
18
expect ( parse . htmlToDOM ) . toBe ( require ( 'html-dom-parser' ) ) ;
19
+ expect ( parse . htmlToDOM ) . toBeInstanceOf ( Function ) ;
20
+ expect ( parse . htmlToDOM . default ) . toBe ( undefined ) ;
17
21
} ) ;
18
22
19
23
it ( 'exports attributesToProps' , ( ) => {
20
24
expect ( parse . attributesToProps ) . toBe ( require ( '../lib/attributes-to-props' ) ) ;
25
+ expect ( parse . attributesToProps ) . toBeInstanceOf ( Function ) ;
21
26
} ) ;
22
27
} ) ;
23
28
You can’t perform that action at this time.
0 commit comments