File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change
1
+ import ReactDOM from "react-dom" ;
2
+ import sinon from "sinon" ;
3
+ import {
4
+ mcontent ,
5
+ renderModal ,
6
+ emptyDOM
7
+ } from "./helper" ;
8
+
9
+ export default ( ) => {
10
+ afterEach ( "cleaned up all rendered modals" , emptyDOM ) ;
11
+
12
+ it ( "renders as expected, initially" , ( ) => {
13
+ const modal = renderModal ( { isOpen : true } , "hello" ) ;
14
+ mcontent ( modal ) . should . be . ok ( ) ;
15
+ } ) ;
16
+
17
+ it ( "allows ReactDOM.createPortal to be overridden in real-time" , ( ) => {
18
+ const createPortalSpy = sinon . spy ( ReactDOM , "createPortal" ) ;
19
+ renderModal ( { isOpen : true } , "hello" ) ;
20
+ createPortalSpy . called . should . be . ok ( ) ;
21
+ ReactDOM . createPortal . restore ( ) ;
22
+ } ) ;
23
+ } ;
Original file line number Diff line number Diff line change @@ -4,8 +4,10 @@ import ModalState from "./Modal.spec";
4
4
import ModalEvents from "./Modal.events.spec" ;
5
5
import ModalStyle from "./Modal.style.spec" ;
6
6
import ModalHelpers from "./Modal.helpers.spec" ;
7
+ import ModalTestability from "./Modal.testability.spec" ;
7
8
8
9
describe ( "State" , ModalState ) ;
9
10
describe ( "Style" , ModalStyle ) ;
10
11
describe ( "Events" , ModalEvents ) ;
11
12
describe ( "Helpers" , ModalHelpers ) ;
13
+ describe ( "Testability" , ModalTestability ) ;
You can’t perform that action at this time.
0 commit comments