diff --git a/client/components/accordion/Makefile b/client/components/accordion/Makefile
deleted file mode 100644
index 5fb42bb5b03d5..0000000000000
--- a/client/components/accordion/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-REPORTER ?= spec
-MOCHA ?= ../../../node_modules/.bin/mocha
-
-test:
- @NODE_ENV=test NODE_PATH=test:../../ $(MOCHA) --compilers jsx:babel/register --reporter $(REPORTER)
-
-.PHONY: test
diff --git a/client/components/accordion/test/index.jsx b/client/components/accordion/test/index.jsx
index 4bcad49f4b6cd..8892d5c537894 100644
--- a/client/components/accordion/test/index.jsx
+++ b/client/components/accordion/test/index.jsx
@@ -1,6 +1,3 @@
-/* eslint-disable vars-on-top */
-require( 'lib/react-test-env-setup' )();
-
/**
* External dependencies
*/
@@ -9,14 +6,15 @@ var expect = require( 'chai' ).expect,
React = require( 'react' ),
TestUtils = require( 'react-addons-test-utils' );
-require( 'react-tap-event-plugin' )();
-
/**
* Internal dependencies
*/
var Accordion = require( '../' );
-describe( 'Accordion', function() {
+describe( 'index', function() {
+ require( 'react-tap-event-plugin' )();
+ require( 'test/helpers/use-fake-dom' )();
+
afterEach( function() {
ReactDom.unmountComponentAtNode( document.body );
} );
diff --git a/client/components/bulk-select/Makefile b/client/components/bulk-select/Makefile
deleted file mode 100644
index e4d7be5fa9312..0000000000000
--- a/client/components/bulk-select/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-REPORTER ?= spec
-NODE_BIN := $(shell npm bin)
-MOCHA ?= ../../../node_modules/.bin/mocha
-BASE_DIR := $(NODE_BIN)/../..
-NODE_PATH := test:$(BASE_DIR)/client
-
-test:
- @NODE_ENV=test NODE_PATH=$(NODE_PATH) $(MOCHA) --compilers jsx:babel/register --reporter $(REPORTER)
-
-.PHONY: test
diff --git a/client/components/bulk-select/test/index.js b/client/components/bulk-select/test/index.js
index 6e2023bc2ed77..ba53b7328d470 100644
--- a/client/components/bulk-select/test/index.js
+++ b/client/components/bulk-select/test/index.js
@@ -1,6 +1,3 @@
-
-require( 'lib/react-test-env-setup' )();
-
/**
* External dependencies
*/
@@ -14,7 +11,8 @@ import noop from 'lodash/noop';
*/
import BulkSelect from '../index';
-describe( 'BulkSelect', function() {
+describe( 'index', function() {
+ require( 'test/helpers/use-fake-dom' )();
it( 'should have BulkSelect class', function() {
const bulkSelect = shallow( );
assert.equal( 1, bulkSelect.find( '.bulk-select' ).length );
diff --git a/client/components/data/media-list-data/Makefile b/client/components/data/media-list-data/Makefile
deleted file mode 100644
index a2fc5e4007dd3..0000000000000
--- a/client/components/data/media-list-data/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-REPORTER ?= spec
-MOCHA ?= ../../../../node_modules/.bin/mocha
-
-# In order to simply stub modules, add test to the NODE_PATH
-test:
- @NODE_ENV=test NODE_PATH=test:../../../../client $(MOCHA) --reporter $(REPORTER)
-
-.PHONY: test
diff --git a/client/components/data/media-list-data/test/index.js b/client/components/data/media-list-data/test/index.js
deleted file mode 100644
index 6233b44e874a7..0000000000000
--- a/client/components/data/media-list-data/test/index.js
+++ /dev/null
@@ -1,3 +0,0 @@
-describe( 'media-list', function() {
- require( './specs/utils' );
-} );
diff --git a/client/components/data/media-list-data/test/specs/utils.js b/client/components/data/media-list-data/test/utils.js
similarity index 96%
rename from client/components/data/media-list-data/test/specs/utils.js
rename to client/components/data/media-list-data/test/utils.js
index 3727caaa2687b..721b65d86d765 100644
--- a/client/components/data/media-list-data/test/specs/utils.js
+++ b/client/components/data/media-list-data/test/utils.js
@@ -6,7 +6,7 @@ var expect = require( 'chai' ).expect;
/**
* Internal dependencies
*/
-var utils = require( '../../utils' );
+var utils = require( '../utils' );
describe( 'utils', function() {
describe( '#getMimeBaseTypeFromFilter()', function() {
diff --git a/client/components/drop-zone/Makefile b/client/components/drop-zone/Makefile
deleted file mode 100644
index 5fb42bb5b03d5..0000000000000
--- a/client/components/drop-zone/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-REPORTER ?= spec
-MOCHA ?= ../../../node_modules/.bin/mocha
-
-test:
- @NODE_ENV=test NODE_PATH=test:../../ $(MOCHA) --compilers jsx:babel/register --reporter $(REPORTER)
-
-.PHONY: test
diff --git a/client/components/drop-zone/test/index.jsx b/client/components/drop-zone/test/index.jsx
index 958d40e3a87a8..dab718cdb2e6e 100644
--- a/client/components/drop-zone/test/index.jsx
+++ b/client/components/drop-zone/test/index.jsx
@@ -1,31 +1,18 @@
-/* eslint-disable vars-on-top */
-require( 'lib/react-test-env-setup' )( '
' );
-
-/**
- * External dependencies
- */
var expect = require( 'chai' ).expect,
ReactDom = require( 'react-dom' ),
React = require( 'react' ),
TestUtils = require( 'react-addons-test-utils' ),
- sinon = require( 'sinon' );
-
-/**
- * Internal dependencies
- */
-var DropZone = require( '../' );
-
-/**
- * Module variables
- */
-var Wrapper = React.createClass( {
- render: function() {
- return { this.props.children }
;
- }
-} );
+ sinon = require( 'sinon' ),
+ DropZone = require( '../' ),
+ Wrapper = React.createClass( {
+ render: function() {
+ return { this.props.children }
;
+ }
+ } );
-describe( 'DropZone', function() {
+describe( 'index', function() {
var container, sandbox;
+ require( 'test/helpers/use-fake-dom' )( '' );
before( function() {
DropZone.prototype.__reactAutoBindMap.translate = sinon.stub().returnsArg( 0 );
@@ -37,7 +24,9 @@ describe( 'DropZone', function() {
} );
after( function() {
- delete window.MutationObserver;
+ if ( global.window && global.window.MutationObserver ) {
+ delete global.window.MutationObserver;
+ }
delete DropZone.prototype.__reactAutoBindMap.translate;
} );
diff --git a/client/components/forms/counted-textarea/Makefile b/client/components/forms/counted-textarea/Makefile
deleted file mode 100644
index dd8832a8c94c4..0000000000000
--- a/client/components/forms/counted-textarea/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-UI ?= bdd
-REPORTER ?= spec
-COMPILERS ?= jsx:babel/register
-NODE_BIN := $(shell npm bin)
-MOCHA ?= $(NODE_BIN)/mocha
-BASE_DIR := $(NODE_BIN)/../..
-NODE_PATH := test:$(BASE_DIR)/client
-
-# In order to simply stub modules, add test to the NODE_PATH
-test:
- @NODE_ENV=test NODE_PATH=$(NODE_PATH) $(MOCHA) --compilers $(COMPILERS) --reporter $(REPORTER) --ui $(UI)
-
-.PHONY: test
diff --git a/client/components/forms/counted-textarea/test/index.jsx b/client/components/forms/counted-textarea/test/index.jsx
index 99f4f2cbef76f..4d4ef73f664b0 100644
--- a/client/components/forms/counted-textarea/test/index.jsx
+++ b/client/components/forms/counted-textarea/test/index.jsx
@@ -11,7 +11,7 @@ var React = require( 'react' ),
*/
var i18n = require( 'lib/mixins/i18n' );
-describe( 'CountedTextarea', function() {
+describe( 'index', function() {
var CountedTextarea, renderer;
before( function() {
diff --git a/client/components/forms/form-toggle/Makefile b/client/components/forms/form-toggle/Makefile
deleted file mode 100644
index bc38f1cff4a73..0000000000000
--- a/client/components/forms/form-toggle/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-REPORTER ?= spec
-MOCHA ?= ../../../../node_modules/.bin/mocha
-
-test:
- @NODE_ENV=test NODE_PATH=test:../../../ $(MOCHA) --compilers jsx:babel/register --reporter $(REPORTER)
-
-.PHONY: test
diff --git a/client/components/forms/form-toggle/test/index.jsx b/client/components/forms/form-toggle/test/index.jsx
index 39b4d148a496b..f5d006ee6cf79 100644
--- a/client/components/forms/form-toggle/test/index.jsx
+++ b/client/components/forms/form-toggle/test/index.jsx
@@ -18,13 +18,12 @@ var FormToggle = require( 'components/forms/form-toggle' ),
*/
var Wrapper = React.createClass( {
render: function() {
- return {this.props.children}
;
+ return { this.props.children }
;
}
} );
-require( 'lib/react-test-env-setup' )();
-
-describe( 'CompactFormToggle', function() {
+describe( 'index', function() {
+ require( 'test/helpers/use-fake-dom' )();
describe( 'rendering', function() {
it( 'should have is-compact class', function() {
var toggle = TestUtils.renderIntoDocument( ),
@@ -37,6 +36,7 @@ describe( 'CompactFormToggle', function() {
} );
describe( 'FormToggle', function() {
+ require( 'test/helpers/use-fake-dom' )();
afterEach( function() {
ReactDom.unmountComponentAtNode( document.body );
} );
diff --git a/client/components/forms/multi-checkbox/Makefile b/client/components/forms/multi-checkbox/Makefile
deleted file mode 100644
index bc38f1cff4a73..0000000000000
--- a/client/components/forms/multi-checkbox/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-REPORTER ?= spec
-MOCHA ?= ../../../../node_modules/.bin/mocha
-
-test:
- @NODE_ENV=test NODE_PATH=test:../../../ $(MOCHA) --compilers jsx:babel/register --reporter $(REPORTER)
-
-.PHONY: test
diff --git a/client/components/forms/multi-checkbox/test/index.jsx b/client/components/forms/multi-checkbox/test/index.jsx
index 1ec3593450b36..45405d7926e66 100644
--- a/client/components/forms/multi-checkbox/test/index.jsx
+++ b/client/components/forms/multi-checkbox/test/index.jsx
@@ -1,23 +1,15 @@
-require( 'lib/react-test-env-setup' )();
-
-/**
- * External dependencies
- */
var assert = require( 'assert' ),
ReactDom = require( 'react-dom' ),
React = require( 'react' ),
- TestUtils = require( 'react-addons-test-utils' );
-
-/**
- * Internal dependencies
- */
-var MultiCheckbox = require( '../' );
+ TestUtils = require( 'react-addons-test-utils' ),
+ MultiCheckbox = require( '../' );
-describe( 'MultiCheckbox', function() {
+describe( 'index', function() {
var options = [
{ value: 1, label: 'One' },
{ value: 2, label: 'Two' }
];
+ require( 'test/helpers/use-fake-dom' )();
afterEach( function() {
ReactDom.unmountComponentAtNode( document.body );
diff --git a/client/components/forms/range/Makefile b/client/components/forms/range/Makefile
deleted file mode 100644
index bc38f1cff4a73..0000000000000
--- a/client/components/forms/range/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-REPORTER ?= spec
-MOCHA ?= ../../../../node_modules/.bin/mocha
-
-test:
- @NODE_ENV=test NODE_PATH=test:../../../ $(MOCHA) --compilers jsx:babel/register --reporter $(REPORTER)
-
-.PHONY: test
diff --git a/client/components/forms/range/test/index.jsx b/client/components/forms/range/test/index.jsx
index 680a0744aee8a..5e2f1f3f444a8 100644
--- a/client/components/forms/range/test/index.jsx
+++ b/client/components/forms/range/test/index.jsx
@@ -1,5 +1,3 @@
-require( 'lib/react-test-env-setup' )();
-
/**
* External dependencies
*/
@@ -13,7 +11,8 @@ var expect = require( 'chai' ).expect,
*/
var FormRange = require( '../' );
-describe( 'Range', function() {
+describe( 'index', function() {
+ require( 'test/helpers/use-fake-dom' )();
afterEach( function() {
ReactDom.unmountComponentAtNode( document.body );
} );
@@ -28,7 +27,7 @@ describe( 'Range', function() {
content = TestUtils.scryRenderedDOMComponentsWithClass( range, 'range__content' );
expect( content ).to.have.length( 1 );
- expect( content[0].props.className ).to.contain( 'is-min' );
+ expect( content[0].getAttribute( 'class' ) ).to.contain( 'is-min' );
} );
it( 'should render ending content if passed a `maxContent` prop', function() {
@@ -41,7 +40,7 @@ describe( 'Range', function() {
content = TestUtils.scryRenderedDOMComponentsWithClass( range, 'range__content' );
expect( content ).to.have.length( 1 );
- expect( content[0].props.className ).to.contain( 'is-max' );
+ expect( content[0].getAttribute( 'class' ) ).to.contain( 'is-max' );
} );
it( 'should render a value label if passed a truthy `showValueLabel` prop', function() {
diff --git a/client/tests.json b/client/tests.json
index 89ae51e1433e4..6f12c7a7ba020 100644
--- a/client/tests.json
+++ b/client/tests.json
@@ -7,6 +7,34 @@
"domain-suggestion": {
"test": [ "index" ]
}
+ },
+ "accordion": {
+ "test": [ "index" ]
+ },
+ "bulk-select": {
+ "test": [ "index" ]
+ },
+ "data": {
+ "media-list-data": {
+ "test": [ "utils" ]
+ }
+ },
+ "drop-zone": {
+ "test": [ "index" ]
+ },
+ "forms": {
+ "counted-textarea": {
+ "test": [ "index" ]
+ },
+ "form-toggle": {
+ "test": [ "index" ]
+ },
+ "multi-checkbox": {
+ "test": [ "index" ]
+ },
+ "range": {
+ "test": [ "index" ]
+ }
}
},
"lib": {