-
-
Save jkimbo/872f42732e6c772bf8e1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import assert from 'assert'; | |
import jsdom from 'mocha-jsdom'; | |
let React; | |
let TestUtils; | |
describe('Modal test', () => { | |
jsdom(); | |
beforeEach(() => { | |
React = require('react'); | |
TestUtils = require('react-addons-test-utils'); | |
}); | |
it('should be able to use TestUtils', () => { | |
const Modal = require('react-modal'); | |
const renderedModal = TestUtils.renderIntoDocument( | |
<Modal isOpen={true}> | |
<div className="my-modal-class"> | |
<h1>Hi!</h1> | |
</div> | |
</Modal> | |
); | |
const divs = TestUtils.scryRenderedDOMComponentsWithClass(renderedModal.portal, "my-modal-class"); | |
assert.equal(divs.length, 1); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment