diff --git a/components/higher-order/with-state/test/index.js b/components/higher-order/with-state/test/index.js
index b9187614a26cb..89c36403b51f8 100644
--- a/components/higher-order/with-state/test/index.js
+++ b/components/higher-order/with-state/test/index.js
@@ -1,13 +1,29 @@
/**
* External dependencies
*/
-import { mount } from 'enzyme';
+import TestUtils from 'react-dom/test-utils';
/**
* Internal dependencies
*/
import withState from '../';
+/**
+ * WordPress dependencies
+ */
+import { Component } from '@wordpress/element';
+
+// this is needed because TestUtils does not accept a stateless component.
+// anything run through a HOC ends up as a stateless component.
+const getTestComponent = ( WrappedComponent ) => {
+ class TestComponent extends Component {
+ render() {
+ return ;
+ }
+ }
+ return ;
+};
+
describe( 'withState', () => {
it( 'should pass initial state and allow updates', () => {
const EnhancedComponent = withState( { count: 0 } )( ( { count, setState } ) => (
@@ -16,10 +32,11 @@ describe( 'withState', () => {
) );
- const wrapper = mount( );
+ const wrapper = TestUtils.renderIntoDocument( getTestComponent( EnhancedComponent ) );
+ const buttonElement = () => TestUtils.findRenderedDOMComponentWithTag( wrapper, 'button' );
- expect( wrapper.html() ).toBe( '' );
- wrapper.find( 'button' ).simulate( 'click' );
- expect( wrapper.html() ).toBe( '' );
+ expect( buttonElement().outerHTML ).toBe( '' );
+ TestUtils.Simulate.click( buttonElement() );
+ expect( buttonElement().outerHTML ).toBe( '' );
} );
} );