Skip to content

Commit

Permalink
Merge pull request #4132 from Automattic/update/components-single-tes…
Browse files Browse the repository at this point in the history
…t-runner

Update: Move some components to single test runner
  • Loading branch information
gziolo committed Mar 18, 2016
2 parents 7412894 + 3591eec commit 4ccdb6f
Show file tree
Hide file tree
Showing 18 changed files with 60 additions and 125 deletions.
7 changes: 0 additions & 7 deletions client/components/accordion/Makefile

This file was deleted.

10 changes: 4 additions & 6 deletions client/components/accordion/test/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/* eslint-disable vars-on-top */
require( 'lib/react-test-env-setup' )();

/**
* External dependencies
*/
Expand All @@ -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 );
} );
Expand Down
10 changes: 0 additions & 10 deletions client/components/bulk-select/Makefile

This file was deleted.

6 changes: 2 additions & 4 deletions client/components/bulk-select/test/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@

require( 'lib/react-test-env-setup' )();

/**
* External dependencies
*/
Expand All @@ -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( <BulkSelect selectedElements={ 0 } totalElements={ 3 } onToggle={ noop } /> );
assert.equal( 1, bulkSelect.find( '.bulk-select' ).length );
Expand Down
8 changes: 0 additions & 8 deletions client/components/data/media-list-data/Makefile

This file was deleted.

3 changes: 0 additions & 3 deletions client/components/data/media-list-data/test/index.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
7 changes: 0 additions & 7 deletions client/components/drop-zone/Makefile

This file was deleted.

35 changes: 12 additions & 23 deletions client/components/drop-zone/test/index.jsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,18 @@
/* eslint-disable vars-on-top */
require( 'lib/react-test-env-setup' )( '<html><body><div id="container"></div></body></html>' );

/**
* 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 <div>{ this.props.children }</div>;
}
} );
sinon = require( 'sinon' ),
DropZone = require( '../' ),
Wrapper = React.createClass( {
render: function() {
return <div>{ this.props.children }</div>;
}
} );

describe( 'DropZone', function() {
describe( 'index', function() {
var container, sandbox;
require( 'test/helpers/use-fake-dom' )( '<html><body><div id="container"></div></body></html>' );

before( function() {
DropZone.prototype.__reactAutoBindMap.translate = sinon.stub().returnsArg( 0 );
Expand All @@ -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;
} );

Expand Down
13 changes: 0 additions & 13 deletions client/components/forms/counted-textarea/Makefile

This file was deleted.

2 changes: 1 addition & 1 deletion client/components/forms/counted-textarea/test/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
7 changes: 0 additions & 7 deletions client/components/forms/form-toggle/Makefile

This file was deleted.

8 changes: 4 additions & 4 deletions client/components/forms/form-toggle/test/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ var FormToggle = require( 'components/forms/form-toggle' ),
*/
var Wrapper = React.createClass( {
render: function() {
return <div>{this.props.children}</div>;
return <div>{ this.props.children }</div>;
}
} );

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( <CompactFormToggle /> ),
Expand All @@ -37,6 +36,7 @@ describe( 'CompactFormToggle', function() {
} );

describe( 'FormToggle', function() {
require( 'test/helpers/use-fake-dom' )();
afterEach( function() {
ReactDom.unmountComponentAtNode( document.body );
} );
Expand Down
7 changes: 0 additions & 7 deletions client/components/forms/multi-checkbox/Makefile

This file was deleted.

16 changes: 4 additions & 12 deletions client/components/forms/multi-checkbox/test/index.jsx
Original file line number Diff line number Diff line change
@@ -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 );
Expand Down
7 changes: 0 additions & 7 deletions client/components/forms/range/Makefile

This file was deleted.

9 changes: 4 additions & 5 deletions client/components/forms/range/test/index.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require( 'lib/react-test-env-setup' )();

/**
* External dependencies
*/
Expand All @@ -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 );
} );
Expand All @@ -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() {
Expand All @@ -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() {
Expand Down
28 changes: 28 additions & 0 deletions client/tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down

0 comments on commit 4ccdb6f

Please sign in to comment.