diff --git a/package.json b/package.json index 75f972bf8839a..b17d950e443e5 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "babel-code-frame": "^6.26.0", "babel-core": "^6.0.0", "babel-eslint": "^7.1.0", - "babel-jest": "^21.3.0-beta.4", + "babel-jest": "^22.0.4", "babel-plugin-check-es2015-constants": "^6.5.0", "babel-plugin-external-helpers": "^6.22.0", "babel-plugin-syntax-trailing-function-commas": "^6.5.0", @@ -67,10 +67,7 @@ "gzip-js": "~0.3.2", "gzip-size": "^3.0.0", "jasmine-check": "^1.0.0-rc.0", - "jest": "^21.3.0-beta.4", - "jest-config": "^21.3.0-beta.4", - "jest-jasmine2": "^21.3.0-beta.4", - "jest-runtime": "^21.3.0-beta.4", + "jest": "^22.0.4", "merge-stream": "^1.0.0", "minimatch": "^3.0.4", "minimist": "^1.2.0", diff --git a/packages/react-art/src/__tests__/ReactART-test.js b/packages/react-art/src/__tests__/ReactART-test.js index 22d4892b314d2..fbce04a9a2dac 100644 --- a/packages/react-art/src/__tests__/ReactART-test.js +++ b/packages/react-art/src/__tests__/ReactART-test.js @@ -54,7 +54,12 @@ function testDOMNodeStructure(domNode, expectedStructure) { } describe('ReactART', () => { + let container; + beforeEach(() => { + container = document.createElement('div'); + document.body.appendChild(container); + ARTCurrentMode.setCurrent(ARTSVGMode); Group = ReactART.Group; @@ -104,6 +109,11 @@ describe('ReactART', () => { }; }); + afterEach(() => { + document.body.removeChild(container); + container = null; + }); + it('should have the correct lifecycle state', () => { let instance = ; instance = ReactTestUtils.renderIntoDocument(instance); @@ -142,7 +152,6 @@ describe('ReactART', () => { }); it('should be able to reorder components', () => { - const container = document.createElement('div'); const instance = ReactDOM.render( , container, @@ -189,8 +198,6 @@ describe('ReactART', () => { }); it('should be able to reorder many components', () => { - const container = document.createElement('div'); - class Component extends React.Component { render() { const chars = this.props.chars.split(''); @@ -296,8 +303,6 @@ describe('ReactART', () => { ); } } - - const container = document.createElement('div'); ReactDOM.render(, container); expect(ref).not.toBeDefined(); ReactDOM.render(, container); @@ -305,8 +310,6 @@ describe('ReactART', () => { }); it('adds and updates event handlers', () => { - const container = document.createElement('div'); - function render(onClick) { return ReactDOM.render( @@ -319,8 +322,11 @@ describe('ReactART', () => { function doClick(instance) { const path = ReactDOM.findDOMNode(instance).querySelector('path'); - // ReactTestUtils.Simulate.click doesn't work with SVG elements - path.click(); + path.dispatchEvent( + new MouseEvent('click', { + bubbles: true, + }), + ); } const onClick1 = jest.fn(); diff --git a/packages/react-art/src/__tests__/__snapshots__/ReactART-test.js.snap b/packages/react-art/src/__tests__/__snapshots__/ReactART-test.js.snap index 6ee55d2081f7e..2cd1229069530 100644 --- a/packages/react-art/src/__tests__/__snapshots__/ReactART-test.js.snap +++ b/packages/react-art/src/__tests__/__snapshots__/ReactART-test.js.snap @@ -3,7 +3,7 @@ exports[`ReactARTComponents should generate a with props for drawing the Circle 1`] = ` with props for drawing the exports[`ReactARTComponents should generate a with props for drawing the Rectangle 1`] = ` with props for drawing the exports[`ReactARTComponents should generate a with props for drawing the Wedge 1`] = ` { }); it('should set values as namespace attributes if necessary', () => { - const container = document.createElement('svg'); + const container = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'svg', + ); ReactDOM.render(, container); expect( container.firstChild.getAttributeNS( @@ -113,22 +116,6 @@ describe('DOMPropertyOperations', () => { ReactDOM.render(