diff --git a/test/specs/addons/Portal/Portal-test.js b/test/specs/addons/Portal/Portal-test.js index 1c87a3c8e5..8ee598cc97 100644 --- a/test/specs/addons/Portal/Portal-test.js +++ b/test/specs/addons/Portal/Portal-test.js @@ -188,7 +188,7 @@ describe('Portal', () => { }) it('maintains ref to DOM node with React component', () => { - const Component = (props) =>

+ const Component = () =>

wrapperMount() wrapper.instance().portalNode.tagName.should.equal('P') @@ -262,7 +262,7 @@ describe('Portal', () => { wrapperMount( } defaultOpen closeOnTriggerClick>

- + , ) wrapper.find('button').simulate('click') @@ -308,7 +308,7 @@ describe('Portal', () => { wrapperMount( } defaultOpen closeOnTriggerMouseLeave mouseLeaveDelay={0}>

- + , ) document.body.lastElementChild.should.equal(wrapper.instance().rootNode) @@ -337,7 +337,7 @@ describe('Portal', () => { wrapperMount( } defaultOpen closeOnPortalMouseLeave mouseLeaveDelay={0}>

- + , ) document.body.lastElementChild.should.equal(wrapper.instance().rootNode) @@ -354,7 +354,7 @@ describe('Portal', () => { it('closes the portal on trigger mouseleave even when portal receives mouseenter within limit', (done) => { const delay = 10 wrapperMount( - } defaultOpen closeOnTriggerMouseLeave mouseLeaveDelay={delay}>

+ } defaultOpen closeOnTriggerMouseLeave mouseLeaveDelay={delay}>

, ) wrapper.find('button').simulate('mouseleave') @@ -382,7 +382,7 @@ describe('Portal', () => { mouseLeaveDelay={delay} >

- + , ) wrapper.find('button').simulate('mouseleave') diff --git a/test/specs/addons/TextArea/TextArea-test.js b/test/specs/addons/TextArea/TextArea-test.js index 32453064fb..e16b778b7b 100644 --- a/test/specs/addons/TextArea/TextArea-test.js +++ b/test/specs/addons/TextArea/TextArea-test.js @@ -87,7 +87,7 @@ describe('TextArea', () => { autoHeight style={style} value={'line1\nline2\nline3\nline4'} - /> + />, ) assertHeight('40px') // 4 lines }) diff --git a/test/specs/behaviors/Visibility/Visibility-test.js b/test/specs/behaviors/Visibility/Visibility-test.js index 642b6a411e..cd2084af7e 100644 --- a/test/specs/behaviors/Visibility/Visibility-test.js +++ b/test/specs/behaviors/Visibility/Visibility-test.js @@ -104,7 +104,7 @@ describe('Visibility', () => { }) describe('calculations', () => { - expectations.forEach(expectation => { + expectations.forEach((expectation) => { it(`calculates ${expectation.name}`, () => { let calculations const onUpdate = (e, props) => (calculations = props.calculations) diff --git a/test/specs/collections/Form/FormField-test.js b/test/specs/collections/Form/FormField-test.js index 3da8963297..17a7f3dd6d 100644 --- a/test/specs/collections/Form/FormField-test.js +++ b/test/specs/collections/Form/FormField-test.js @@ -28,7 +28,7 @@ describe('FormField', () => { it('adds an HTML element child of the same type', () => { const controls = ['button', 'input', 'select', 'textarea'] - controls.forEach(control => { + controls.forEach((control) => { shallow() .should.have.descendants(control) }) diff --git a/test/specs/collections/Table/Table-test.js b/test/specs/collections/Table/Table-test.js index c30031d2db..deedad31e7 100644 --- a/test/specs/collections/Table/Table-test.js +++ b/test/specs/collections/Table/Table-test.js @@ -48,7 +48,7 @@ describe('Table', () => { common.propValueOnlyToClassName(Table, 'color', SUI.COLORS) common.propValueOnlyToClassName(Table, 'size', - _.without(SUI.SIZES, 'mini', 'tiny', 'medium', 'big', 'huge', 'massive') + _.without(SUI.SIZES, 'mini', 'tiny', 'medium', 'big', 'huge', 'massive'), ) it('renders as a table by default', () => { diff --git a/test/specs/commonTests/classNameHelpers.js b/test/specs/commonTests/classNameHelpers.js index 558c016f61..a987ce788d 100644 --- a/test/specs/commonTests/classNameHelpers.js +++ b/test/specs/commonTests/classNameHelpers.js @@ -6,7 +6,7 @@ import { consoleUtil } from 'test/utils' export const classNamePropValueBeforePropName = (Component, propKey, propValues, options = {}) => { const { className = propKey, requiredProps = {} } = options - propValues.forEach(propVal => { + propValues.forEach((propVal) => { it(`adds "${propVal} ${className}" to className`, () => { shallow(createElement(Component, { ...requiredProps, [propKey]: propVal })) .should.have.className(`${propVal} ${className}`) diff --git a/test/specs/commonTests/commonHelpers.js b/test/specs/commonTests/commonHelpers.js index 6ef57ac9f1..de1da76e47 100644 --- a/test/specs/commonTests/commonHelpers.js +++ b/test/specs/commonTests/commonHelpers.js @@ -1,11 +1,11 @@ export default (testName, Component) => { - const throwError = msg => { + const throwError = (msg) => { throw new Error(`${testName}: ${msg} \n Component: ${Component && Component.name}`) } - const assertRequired = (required, description) => { - return required || throwError(`Required ${description}, got: ${required} (${typeof required})`) - } + const assertRequired = (required, description) => ( + required || throwError(`Required ${description}, got: ${required} (${typeof required})`) + ) return { assertRequired, diff --git a/test/specs/commonTests/componentInfo.js b/test/specs/commonTests/componentInfo.js index 54101b0d50..df24a848a3 100644 --- a/test/specs/commonTests/componentInfo.js +++ b/test/specs/commonTests/componentInfo.js @@ -9,10 +9,10 @@ import helpers from './commonHelpers' const componentCtx = require.context( '../../../src/', true, - /(addons|behaviors|collections|elements|modules|views).\w+.(?!index)\w+.js/ + /(addons|behaviors|collections|elements|modules|views).\w+.(?!index)\w+.js/, ) -const componentInfo = componentCtx.keys().map(key => { +const componentInfo = componentCtx.keys().map((key) => { const Component = componentCtx(key).default const componentType = typeof Component const { throwError } = helpers('componentInfo', Component) diff --git a/test/specs/commonTests/hasSubComponents.js b/test/specs/commonTests/hasSubComponents.js index d564d70440..2b3170217b 100644 --- a/test/specs/commonTests/hasSubComponents.js +++ b/test/specs/commonTests/hasSubComponents.js @@ -8,7 +8,7 @@ import _ from 'lodash' export default (Component, subComponents) => { const staticValues = _.values(Component) - _.each(subComponents, subComponent => { + _.each(subComponents, (subComponent) => { it(`has sub component ${subComponent._meta.name}`, () => { staticValues.should.contain(subComponent) }) diff --git a/test/specs/commonTests/hasValidTypings.js b/test/specs/commonTests/hasValidTypings.js index aee45a3c7b..565058700b 100644 --- a/test/specs/commonTests/hasValidTypings.js +++ b/test/specs/commonTests/hasValidTypings.js @@ -1,6 +1,7 @@ import _ from 'lodash' import path from 'path' +import { customPropTypes } from 'src/lib' import componentInfo from './componentInfo' import { getNodes, @@ -8,7 +9,6 @@ import { hasAnySignature, requireTs, } from './tsHelpers' -import { customPropTypes } from 'src/lib' const isShorthand = propType => _.includes([ customPropTypes.collectionShorthand, @@ -38,7 +38,7 @@ export default (Component, extractedInfo, options = {}) => { } = extractedInfo || _.find(componentInfo, i => i.constructorName === Component.prototype.constructor.name) const { ignoredTypingsProps = [], requiredProps } = options - const tsFile = filenameWithoutExt + '.d.ts' + const tsFile = `${filenameWithoutExt}.d.ts` const tsContent = requireTs(path.join(path.dirname(filePath), tsFile)) describe('typings', () => { diff --git a/test/specs/commonTests/implementsClassNameProps.js b/test/specs/commonTests/implementsClassNameProps.js index d8ed9d8e71..9f199d6f5e 100644 --- a/test/specs/commonTests/implementsClassNameProps.js +++ b/test/specs/commonTests/implementsClassNameProps.js @@ -100,7 +100,7 @@ export const propKeyOrValueAndKeyToClassName = (Component, propKey, propValues, wrapper.should.not.have.className('true') wrapper.should.not.have.className('false') - _.each(propValues, propVal => { + _.each(propValues, (propVal) => { wrapper.should.not.have.className(propVal) }) }) @@ -128,7 +128,7 @@ export const propValueOnlyToClassName = (Component, propKey, propValues, options noDefaultClassNameFromProp(Component, propKey, propValues, options) it('adds prop value to className', () => { - propValues.forEach(propValue => { + propValues.forEach((propValue) => { shallow(createElement(Component, { ...requiredProps, [propKey]: propValue })) .should.have.className(propValue) }) @@ -137,7 +137,7 @@ export const propValueOnlyToClassName = (Component, propKey, propValues, options it('does not add prop name to className', () => { consoleUtil.disableOnce() - propValues.forEach(propValue => { + propValues.forEach((propValue) => { shallow(createElement(Component, { ...requiredProps, [propKey]: propValue })) .should.not.have.className(propKey) }) diff --git a/test/specs/commonTests/implementsCommonProps.js b/test/specs/commonTests/implementsCommonProps.js index da351ecd2a..c377152104 100644 --- a/test/specs/commonTests/implementsCommonProps.js +++ b/test/specs/commonTests/implementsCommonProps.js @@ -160,7 +160,7 @@ export const implementsLabelProp = (Component, options = {}) => { * Assert that a Component correctly implements the "only" prop. * @param {React.Component|Function} Component The component to test. */ -export const implementsOnlyProp = Component => { +export const implementsOnlyProp = (Component) => { const { assertRequired } = helpers('propKeyAndValueToClassName', Component) const propValues = SUI.VISIBILITY @@ -170,7 +170,7 @@ export const implementsOnlyProp = Component => { noDefaultClassNameFromProp(Component, 'only', propValues) noClassNameFromBoolProps(Component, 'only', propValues) - propValues.forEach(propVal => { + propValues.forEach((propVal) => { it(`adds "${propVal} only" to className`, () => { shallow(createElement(Component, { only: propVal })).should.have.className(`${propVal} only`) }) @@ -202,18 +202,18 @@ export const implementsTextAlignProp = (Component, alignments = SUI.TEXT_ALIGNME noClassNameFromBoolProps(Component, 'textAlign', alignments, options) noDefaultClassNameFromProp(Component, 'textAlign', alignments, options) - alignments.forEach(propVal => { + alignments.forEach((propVal) => { if (propVal === 'justified') { it('adds "justified" without "aligned" to className', () => { - shallow() + shallow() .should.have.className('justified') - shallow() + shallow() .should.not.have.className('aligned') }) } else { it(`adds "${propVal} aligned" to className`, () => { - shallow() + shallow() .should.have.className(`${propVal} ${'aligned'}`) }) } @@ -238,9 +238,9 @@ export const implementsVerticalAlignProp = (Component, alignments = SUI.VERTICAL noClassNameFromBoolProps(Component, 'verticalAlign', alignments, options) noDefaultClassNameFromProp(Component, 'verticalAlign', alignments, options) - alignments.forEach(propVal => { + alignments.forEach((propVal) => { it(`adds "${propVal} aligned" to className`, () => { - shallow() + shallow() .should.have.className(`${propVal} ${'aligned'}`) }) }) @@ -275,7 +275,7 @@ export const implementsWidthProp = (Component, widths = SUI.WIDTHS, options = {} noDefaultClassNameFromProp(Component, propKey, propValues, options) it('adds numberToWord value to className', () => { - widths.forEach(width => { + widths.forEach((width) => { const expectClass = widthClass ? `${numberToWord(width)} ${widthClass}` : numberToWord(width) shallow(createElement(Component, { ...requiredProps, [propKey]: width })) @@ -296,7 +296,7 @@ export const implementsWidthProp = (Component, widths = SUI.WIDTHS, options = {} * Assert that a Components with a label correctly implements the "id" and "htmlFor" props. * @param {React.Component|Function} Component The component to test. */ -export const labelImplementsHtmlForProp = Component => { +export const labelImplementsHtmlForProp = (Component) => { const { assertRequired } = helpers('labelImplementsHtmlForProp', Component) describe('htmlFor (common)', () => { diff --git a/test/specs/commonTests/implementsShorthandProp.js b/test/specs/commonTests/implementsShorthandProp.js index ed07edbdfd..28eac09618 100644 --- a/test/specs/commonTests/implementsShorthandProp.js +++ b/test/specs/commonTests/implementsShorthandProp.js @@ -6,7 +6,7 @@ import { consoleUtil } from 'test/utils' import { noDefaultClassNameFromProp } from './classNameHelpers' import helpers from './commonHelpers' -const shorthandComponentName = ShorthandComponent => { +const shorthandComponentName = (ShorthandComponent) => { if (typeof ShorthandComponent === 'string') return ShorthandComponent return _.get(ShorthandComponent, '_meta.name') || ShorthandComponent.displayName || ShorthandComponent.name } @@ -56,7 +56,7 @@ export default (Component, options = {}) => { shallow(element).should[assertMethod](shorthandElement) } - if (alwaysPresent || Component.defaultProps && Component.defaultProps[propKey]) { + if (alwaysPresent || (Component.defaultProps && Component.defaultProps[propKey])) { it(`has default ${name} when not defined`, () => { shallow() .should.have.descendants(name) diff --git a/test/specs/commonTests/isConformant.js b/test/specs/commonTests/isConformant.js index d97e5024e6..bdf4983d75 100644 --- a/test/specs/commonTests/isConformant.js +++ b/test/specs/commonTests/isConformant.js @@ -5,10 +5,10 @@ import ReactDOMServer from 'react-dom/server' import * as semanticUIReact from 'semantic-ui-react' import { META } from 'src/lib' +import { consoleUtil, sandbox, syntheticEvent } from 'test/utils' import helpers from './commonHelpers' import componentInfo from './componentInfo' import hasValidTypings from './hasValidTypings' -import { consoleUtil, sandbox, syntheticEvent } from 'test/utils' /** * Assert Component conforms to guidelines that are applicable to all components. @@ -76,13 +76,13 @@ export default (Component, options = {}) => { expect(isTopLevelAPIProp).to.equal( false, `"${constructorName}" is private (starts with "_").` + - ' It cannot be exposed on the top level API' + ' It cannot be exposed on the top level API', ) expect(isSubComponent).to.equal( false, `"${constructorName}" is private (starts with "_").` + - ' It cannot be a static prop of another component (sub-component)' + ' It cannot be a static prop of another component (sub-component)', ) }) } else { @@ -100,7 +100,7 @@ export default (Component, options = {}) => { expect(isSubComponent).to.equal( true, `\`${constructorName}\` is a child component (has a _meta.parent).` + - ` It must be a static prop of its parent \`${_meta.parent}\`` + ` It must be a static prop of its parent \`${_meta.parent}\``, ) }) } @@ -158,7 +158,7 @@ export default (Component, options = {}) => { }) it('renders as a ReactClass or passes "as" to the next component', () => { - class MyComponent extends React.Component { + class MyComponent extends React.Component { // eslint-disable-line react/prefer-stateless-function render() { return

} @@ -199,7 +199,7 @@ export default (Component, options = {}) => { Component.handledProps.should.to.deep.equal(expectedProps, 'It seems that not all props were defined in Component.handledProps, you need to check that they are equal ' + - 'to the union of Component.autoControlledProps and keys of Component.defaultProps and Component.propTypes' + 'to the union of Component.autoControlledProps and keys of Component.defaultProps and Component.propTypes', ) }) }) @@ -217,7 +217,7 @@ export default (Component, options = {}) => { // This test catches the case where a developer forgot to call the event prop // after handling it internally. It also catch cases where the synthetic event was not passed back. _.each(syntheticEvent.types, ({ eventShape, listeners }) => { - _.each(listeners, listenerName => { + _.each(listeners, (listenerName) => { // onKeyDown => keyDown const eventName = _.camelCase(listenerName.replace('on', '')) @@ -251,7 +251,7 @@ export default (Component, options = {}) => { handlerSpy.calledOnce.should.equal(true, `<${constructorName} ${listenerName}={${handlerName}} />\n` + `${leftPad} ^ was not called once on "${eventName}".` + - 'You may need to hoist your event handlers up to the root element.\n' + 'You may need to hoist your event handlers up to the root element.\n', ) let expectedArgs = [eventShape] @@ -263,12 +263,12 @@ export default (Component, options = {}) => { } // Components should return the event first, then any data - handlerSpy.calledWithMatch(...expectedArgs).should.equal(true, - `<${constructorName} ${listenerName}={${handlerName}} />\n` + - `${leftPad} ^ ${errorMessage}\n` + - 'It was called with args:\n' + - JSON.stringify(handlerSpy.args, null, 2) - ) + handlerSpy.calledWithMatch(...expectedArgs).should.equal(true, [ + `<${constructorName} ${listenerName}={${handlerName}} />\n`, + `${leftPad} ^ ${errorMessage}`, + 'It was called with args:', + JSON.stringify(handlerSpy.args, null, 2), + ].join('\n')) }) }) }) diff --git a/test/specs/commonTests/tsHelpers.js b/test/specs/commonTests/tsHelpers.js index dec378c808..95f7fa9647 100644 --- a/test/specs/commonTests/tsHelpers.js +++ b/test/specs/commonTests/tsHelpers.js @@ -12,7 +12,7 @@ const isInterface = ({ kind }) => kind === SyntaxKind.InterfaceDeclaration const isExportModifier = ({ kind }) => kind === SyntaxKind.ExportKeyword const isPropertySignature = ({ kind }) => kind === SyntaxKind.PropertySignature const isTypeReference = ({ kind }) => kind === SyntaxKind.TypeReference -const isShorthandProperty = node => { +const isShorthandProperty = (node) => { if (!isPropertySignature(node) || !isTypeReference(node.type)) return false return _.includes([ 'SemanticShorthandContent', @@ -22,7 +22,7 @@ const isShorthandProperty = node => { } const isStringKeyword = ({ kind }) => kind === SyntaxKind.StringKeyword -const getProps = members => { +const getProps = (members) => { const props = _.filter(members, isPropertySignature) return _.map(props, ({ name, questionToken }) => ({ @@ -31,7 +31,7 @@ const getProps = members => { })) } -const getShorthands = members => { +const getShorthands = (members) => { const shorthands = _.filter(members, isShorthandProperty) return _.map(shorthands, shorthand => ({ @@ -40,7 +40,7 @@ const getShorthands = members => { })) } -const walkNode = (node, nodes) => forEachChild(node, child => { +const walkNode = (node, nodes) => forEachChild(node, (child) => { nodes.push(child) walkNode(child, nodes) @@ -56,7 +56,7 @@ export const getNodes = (tsFile, tsContent) => { return nodes } -export const getInterfaces = nodes => { +export const getInterfaces = (nodes) => { const interfaces = _.filter(nodes, isInterface) return _.map(interfaces, ({ members, modifiers, name }) => ({ @@ -67,7 +67,7 @@ export const getInterfaces = nodes => { })) } -export const hasAnySignature = nodes => { +export const hasAnySignature = (nodes) => { const signatures = _.filter(nodes, isIndexSignature) return _.some(signatures, ({ parameters, type: rightType }) => { @@ -77,7 +77,7 @@ export const hasAnySignature = nodes => { }) } -export const requireTs = tsPath => { +export const requireTs = (tsPath) => { try { return require(`!raw-loader!../../../src/${tsPath}`) } catch (e) { diff --git a/test/specs/docs/examples-test.js b/test/specs/docs/examples-test.js index 5b96e4ae19..e01a5f62b0 100644 --- a/test/specs/docs/examples-test.js +++ b/test/specs/docs/examples-test.js @@ -19,7 +19,7 @@ describe('examples', () => { console.warn.restore() console.error.restore() }) - exampleContext.keys().forEach(path => { + exampleContext.keys().forEach((path) => { // don't test index files, they repeat errors of individual files if (/index\.js$/.test(path)) return const filename = path.replace(/^.*\/(\w+\.js)$/, '$1') diff --git a/test/specs/elements/Input/Input-test.js b/test/specs/elements/Input/Input-test.js index 456091a771..92624df39a 100644 --- a/test/specs/elements/Input/Input-test.js +++ b/test/specs/elements/Input/Input-test.js @@ -90,12 +90,12 @@ describe('Input', () => { it('renders with conditional children', () => { shallow( - {true && } - {false &&
} + {true && } + {false &&
} , ) - .should.contain() - .should.not.contain(
) + .should.contain() + .should.not.contain(
) }) it('renders a text by default', () => { @@ -105,7 +105,7 @@ describe('Input', () => { }) describe('input props', () => { - htmlInputProps.forEach(propName => { + htmlInputProps.forEach((propName) => { it(`passes \`${propName}\` to the `, () => { const propValue = propName === 'onChange' ? () => null : 'foo' const wrapper = shallow() diff --git a/test/specs/elements/Step/StepGroup-test.js b/test/specs/elements/Step/StepGroup-test.js index ec7cfd7a0d..4a452af8e6 100644 --- a/test/specs/elements/Step/StepGroup-test.js +++ b/test/specs/elements/Step/StepGroup-test.js @@ -24,7 +24,7 @@ describe('StepGroup', () => { {firstText} {secondText} - + , ) .find('Step') diff --git a/test/specs/lib/AutoControlledComponent-test.js b/test/specs/lib/AutoControlledComponent-test.js index 7cfe89eb11..04dfb797ba 100644 --- a/test/specs/lib/AutoControlledComponent-test.js +++ b/test/specs/lib/AutoControlledComponent-test.js @@ -19,7 +19,7 @@ const createTestClass = (options = {}) => class Test extends AutoControlledCompo } /* eslint-enable */ -const toDefaultName = (prop) => `default${prop.slice(0, 1).toUpperCase() + prop.slice(1)}` +const toDefaultName = prop => `default${prop.slice(0, 1).toUpperCase() + prop.slice(1)}` const makeProps = () => ({ computer: 'hardware', @@ -27,7 +27,7 @@ const makeProps = () => ({ ion: 'belt', }) -const makeDefaultProps = (props) => _.transform(props, (res, val, key) => { +const makeDefaultProps = props => _.transform(props, (res, val, key) => { res[toDefaultName(key)] = val }) @@ -118,7 +118,7 @@ describe('extending AutoControlledComponent', () => { props[randomProp] = undefined TestClass = createTestClass({ autoControlledProps, state: {} }) - const wrapper = shallow() + const wrapper = shallow() wrapper .instance() @@ -140,7 +140,7 @@ describe('extending AutoControlledComponent', () => { props[randomProp] = null TestClass = createTestClass({ autoControlledProps, state: {} }) - const wrapper = shallow() + const wrapper = shallow() wrapper .instance() diff --git a/test/specs/lib/factories-test.js b/test/specs/lib/factories-test.js index 923084e0b5..6fc2d28fd9 100644 --- a/test/specs/lib/factories-test.js +++ b/test/specs/lib/factories-test.js @@ -14,7 +14,7 @@ import { sandbox } from 'test/utils' const getShorthand = ({ Component = 'div', defaultProps, - mapValueToProps = val => ({}), + mapValueToProps = () => ({}), overrideProps, value, }) => createShorthand(Component, mapValueToProps, value, { defaultProps, overrideProps }) @@ -124,7 +124,7 @@ describe('factories', () => { it('throw if passed Component that is not a string nor function', () => { const badComponents = [undefined, null, true, false, [], {}, 123] - _.each(badComponents, badComponent => { + _.each(badComponents, (badComponent) => { const badUsage = () => createShorthandFactory(badComponent, () => ({})) expect(badUsage).to.throw() @@ -152,7 +152,7 @@ describe('factories', () => { it('throw if passed Component that is not a string nor function', () => { const badComponents = [undefined, null, true, false, [], {}, 123] - _.each(badComponents, badComponent => { + _.each(badComponents, (badComponent) => { const badUsage = () => createShorthand(badComponent, () => ({})) expect(badUsage).to.throw() @@ -324,7 +324,7 @@ describe('factories', () => { const defaultProps = { 'data-some': 'defaults' } const overrideProps = sandbox.spy(() => ({})) const value = 'foo' - const mapValueToProps = (val) => ({ 'data-mapped': val }) + const mapValueToProps = val => ({ 'data-mapped': val }) shallow(getShorthand({ defaultProps, mapValueToProps, overrideProps, value })) overrideProps.should.have.been.calledWith({ ...defaultProps, ...mapValueToProps(value) }) @@ -361,7 +361,7 @@ describe('factories', () => { 'element', { some: 'defaults', overridden: false }, { some: 'defaults', overridden: true }, - { value:
} + { value:
}, ) itOverridesDefaultPropsWithFalseyProps('element', { value:
, @@ -387,8 +387,8 @@ describe('factories', () => { { some: 'defaults', overridden: true }, { value: 'a string', - mapValueToProps: (val) => ({ overridden: true }), - } + mapValueToProps: () => ({ overridden: true }), + }, ) itOverridesDefaultPropsWithFalseyProps('mapValueToProps', { @@ -411,7 +411,7 @@ describe('factories', () => { { some: 'defaults', overridden: true }, { value: { overridden: true }, - } + }, ) itOverridesDefaultPropsWithFalseyProps('props object', { @@ -438,8 +438,8 @@ describe('factories', () => { { some: 'defaults', overridden: true }, { value: ['an array'], - mapValueToProps: (val) => ({ overridden: true }), - } + mapValueToProps: () => ({ overridden: true }), + }, ) itOverridesDefaultPropsWithFalseyProps('mapValueToProps', { diff --git a/test/specs/lib/isNil-test.js b/test/specs/lib/isNil-test.js index 3b8e050410..1dbceaac97 100644 --- a/test/specs/lib/isNil-test.js +++ b/test/specs/lib/isNil-test.js @@ -11,7 +11,7 @@ describe('isNil', () => { expect(isNil(null)).to.equal(true) }) it('should return true for void 0', () => { - expect(isNil(void 0)).to.equal(true) + expect(isNil(void 0)).to.equal(true) // eslint-disable-line no-void }) it('should return false for NaN', () => { expect(isNil(NaN)).to.equal(false) diff --git a/test/specs/lib/numberToWord-test.js b/test/specs/lib/numberToWord-test.js index d9298c44d8..2dccf9a7b4 100644 --- a/test/specs/lib/numberToWord-test.js +++ b/test/specs/lib/numberToWord-test.js @@ -26,7 +26,7 @@ describe('numberToWord', () => { }) it('returns word if input is word', () => { - words.forEach((word) => numberToWord(word).should.equal(word)) + words.forEach(word => numberToWord(word).should.equal(word)) }) it('returns an empty string for boolean inputs', () => { diff --git a/test/specs/lib/objectDiff-test.js b/test/specs/lib/objectDiff-test.js index f5715b1fbb..bcd410ba19 100644 --- a/test/specs/lib/objectDiff-test.js +++ b/test/specs/lib/objectDiff-test.js @@ -6,7 +6,7 @@ describe('objectDiff', () => { let a let b beforeEach(() => { - [a, b] = _.times(2, n => ({ + [a, b] = _.times(2, () => ({ undef: undefined, nil: null, bool: true, @@ -17,7 +17,7 @@ describe('objectDiff', () => { })) }) - const assertDiff = (diff) => objectDiff(a, b).should.deep.equal(diff) + const assertDiff = diff => objectDiff(a, b).should.deep.equal(diff) it('picks up undefined values', () => { b.nil = undefined diff --git a/test/specs/modules/Accordion/Accordion-test.js b/test/specs/modules/Accordion/Accordion-test.js index c3a9b5ec05..c494e6a2f7 100644 --- a/test/specs/modules/Accordion/Accordion-test.js +++ b/test/specs/modules/Accordion/Accordion-test.js @@ -28,7 +28,7 @@ describe('Accordion', () => { - + , ) const titles = wrapper.find('AccordionTitle') const contents = wrapper.find('AccordionContent') @@ -46,7 +46,7 @@ describe('Accordion', () => { - + , ) .find('AccordionContent') @@ -58,7 +58,7 @@ describe('Accordion', () => { - + , ) // open panel (activeIndex 0) @@ -86,7 +86,7 @@ describe('Accordion', () => { - + , ) wrapper.setProps({ activeIndex: 0 }) wrapper.childAt(0).should.have.prop('active', true) @@ -110,7 +110,7 @@ describe('Accordion', () => { - + , ) wrapper.setProps({ activeIndex: [0, 1] }) wrapper.childAt(0).should.have.prop('active', true) @@ -132,7 +132,7 @@ describe('Accordion', () => { - + , ) .find('AccordionTitle') @@ -147,7 +147,7 @@ describe('Accordion', () => { - + , ) .find('AccordionTitle') @@ -162,7 +162,7 @@ describe('Accordion', () => { - + , ) const titles = wrapper.find('AccordionTitle') const contents = wrapper.find('AccordionContent') @@ -186,7 +186,7 @@ describe('Accordion', () => { - + , ) const titles = wrapper.find('AccordionTitle') const contents = wrapper.find('AccordionContent') @@ -219,7 +219,7 @@ describe('Accordion', () => { - + , ) .find('AccordionTitle') @@ -237,7 +237,7 @@ describe('Accordion', () => { shallow(
- + , ) .should.not.have.descendants('#do-not-find-me') }) @@ -287,7 +287,7 @@ describe('Accordion', () => { expect(wrapper.childAt(1).key()).to.equal('panel-1-content') }) - const checkIfAllowsSettingTheActiveProp = panels => { + const checkIfAllowsSettingTheActiveProp = (panels) => { const wrapper = shallow() // first panel (active) diff --git a/test/specs/modules/Checkbox/Checkbox-test.js b/test/specs/modules/Checkbox/Checkbox-test.js index 8b518f4865..0ed80aab9b 100644 --- a/test/specs/modules/Checkbox/Checkbox-test.js +++ b/test/specs/modules/Checkbox/Checkbox-test.js @@ -22,7 +22,7 @@ describe('Checkbox', () => { }) describe('aria', () => { - ['aria-label', 'role'].forEach(propName => { + ['aria-label', 'role'].forEach((propName) => { it(`passes "${propName}" to the `, () => { shallow() .find('input') diff --git a/test/specs/modules/Dropdown/Dropdown-test.js b/test/specs/modules/Dropdown/Dropdown-test.js index 180895171e..7aa8674fac 100644 --- a/test/specs/modules/Dropdown/Dropdown-test.js +++ b/test/specs/modules/Dropdown/Dropdown-test.js @@ -33,7 +33,7 @@ const wrapperRender = (...args) => (wrapper = render(...args)) // ---------------------------------------- // Options // ---------------------------------------- -const getOptions = (count = 5) => _.times(count, n => { +const getOptions = (count = 5) => _.times(count, () => { const text = _.times(3, faker.hacker.noun).join(' ') const value = _.snakeCase(text) return { text, value } @@ -503,7 +503,7 @@ describe('Dropdown', () => { .should.have.prop('selected', true) }) it('is null when all options disabled', () => { - const disabledOptions = options.map((o) => ({ ...o, disabled: true })) + const disabledOptions = options.map(o => ({ ...o, disabled: true })) wrapperRender() .should.not.have.descendants('.selected') @@ -712,7 +712,7 @@ describe('Dropdown', () => { // menu should be completely scrolled to the bottom const isMenuScrolledToBottom = menu.scrollTop + menu.clientHeight === menu.scrollHeight isMenuScrolledToBottom.should.be.true( - 'When the last item in the list was selected, DropdownMenu did not scroll to bottom.' + 'When the last item in the list was selected, DropdownMenu did not scroll to bottom.', ) // @@ -732,7 +732,7 @@ describe('Dropdown', () => { const selectedItem = document.querySelector('.ui.dropdown .menu.visible .item.selected') const isMenuScrolledToTop = menu.scrollTop === selectedItem.offsetTop isMenuScrolledToTop.should.be.true( - 'When the first item in the list was selected, DropdownMenu did not scroll to top.' + 'When the first item in the list was selected, DropdownMenu did not scroll to top.', ) }) it('becomes active on enter when open', () => { @@ -1356,7 +1356,7 @@ describe('Dropdown', () => { const value = _.map(options, 'value') const expected = _.dropRight(value) wrapperMount( - + , ) // open @@ -1430,8 +1430,8 @@ describe('Dropdown', () => { it('is called with event and value when blurring', () => { const firstValue = options[0].value wrapperMount() - .simulate('focus') // open, highlights first item - .simulate('blur') // blur should activate selected item + .simulate('focus') // open, highlights first item + .simulate('blur') // blur should activate selected item spy.should.have.been.calledOnce() spy.should.have.been.calledWithMatch({}, { value: firstValue }) @@ -1611,7 +1611,7 @@ describe('Dropdown', () => { { text: 'bang', value: 'bang' }, ] wrapperMount( - + , ) .find('input.search') @@ -1677,7 +1677,7 @@ describe('Dropdown', () => { const activeElement = document.activeElement const searchIsFocused = activeElement === document.querySelector('input.search') searchIsFocused.should.be.true( - `Expected "input.search" to be the active element but found ${activeElement} instead.` + `Expected "input.search" to be the active element but found ${activeElement} instead.`, ) }) @@ -1689,7 +1689,7 @@ describe('Dropdown', () => { const activeElement = document.activeElement const searchIsFocused = activeElement === document.querySelector('input.search') searchIsFocused.should.be.true( - `Expected "input.search" to be the active element but found ${activeElement} instead.` + `Expected "input.search" to be the active element but found ${activeElement} instead.`, ) }) @@ -1974,7 +1974,7 @@ describe('Dropdown', () => { wrapperShallow( - + , ) .should.contain.descendants('DropdownMenu') @@ -1987,7 +1987,7 @@ describe('Dropdown', () => { wrapperMount( - + , ) dropdownMenuIsClosed() @@ -1999,7 +1999,7 @@ describe('Dropdown', () => { wrapperShallow( - + , ) .should.contain.descendants('DropdownMenu') @@ -2012,7 +2012,7 @@ describe('Dropdown', () => { wrapperShallow( - + , ) .should.contain.descendants('DropdownMenu') @@ -2096,7 +2096,7 @@ describe('Dropdown', () => { it('uses custom additionLabel string', () => { const search = wrapperMount( - + , ) .find('input.search') @@ -2121,7 +2121,7 @@ describe('Dropdown', () => { it('uses custom additionLabel element', () => { const search = wrapperMount( - New: } /> + New: } />, ) .find('input.search') @@ -2146,7 +2146,7 @@ describe('Dropdown', () => { it('uses no additionLabel', () => { const search = wrapperMount( - + , ) .find('input.search') @@ -2171,7 +2171,7 @@ describe('Dropdown', () => { it('keeps custom value option (bottom) when options change', () => { const search = wrapperMount( - + , ) .find('input.search') @@ -2200,7 +2200,7 @@ describe('Dropdown', () => { it('keeps custom value option (top) when options change', () => { const search = wrapperMount( - + , ) .find('input.search') @@ -2230,7 +2230,7 @@ describe('Dropdown', () => { it('calls onAddItem prop when clicking new value', () => { const spy = sandbox.spy() const search = wrapperMount( - + , ) .find('input.search') @@ -2248,7 +2248,7 @@ describe('Dropdown', () => { it('calls onAddItem prop when pressing enter on new value', () => { const spy = sandbox.spy() const search = wrapperMount( - + , ) .find('input.search') diff --git a/test/specs/modules/Embed/Embed-test.js b/test/specs/modules/Embed/Embed-test.js index cbccb46339..7e2304bba1 100644 --- a/test/specs/modules/Embed/Embed-test.js +++ b/test/specs/modules/Embed/Embed-test.js @@ -155,7 +155,7 @@ describe('Embed', () => { it('sets the iframe title', () => { const sources = ['youtube', 'vimeo'] - sources.forEach(source => { + sources.forEach((source) => { shallow() .find('iframe') .should.have.attr('title') diff --git a/test/specs/modules/Modal/Modal-test.js b/test/specs/modules/Modal/Modal-test.js index 227b27c3ee..d151f61b7f 100644 --- a/test/specs/modules/Modal/Modal-test.js +++ b/test/specs/modules/Modal/Modal-test.js @@ -23,7 +23,7 @@ const wrapperShallow = (...args) => (wrapper = shallow(...args)) const assertBodyClasses = (...rest) => { const hasClasses = typeof rest[rest.length - 1] === 'boolean' ? rest.pop() : true - rest.forEach(className => { + rest.forEach((className) => { const didFind = document.body.classList.contains(className) const message = [ `document.body ${didFind ? 'has' : 'does not have'} class "${className}".`, @@ -212,7 +212,7 @@ describe('Modal', () => { it('adds the size to the modal className', () => { const sizes = ['fullscreen', 'large', 'mini', 'small', 'tiny'] - sizes.forEach(size => { + sizes.forEach((size) => { wrapperMount() assertBodyContains(`.ui.${size}.modal`) }) diff --git a/test/specs/modules/Popup/Popup-test.js b/test/specs/modules/Popup/Popup-test.js index 3a63642066..91520a6144 100644 --- a/test/specs/modules/Popup/Popup-test.js +++ b/test/specs/modules/Popup/Popup-test.js @@ -86,7 +86,7 @@ describe('Popup', () => { position='bottom right' content='foo' trigger={} - /> + />, ) wrapper.find('button').simulate('click') @@ -99,7 +99,7 @@ describe('Popup', () => { position='bottom left' content='foo' trigger={} - /> + />, ) wrapper.find('button').simulate('click') @@ -108,7 +108,7 @@ describe('Popup', () => { }) describe('position', () => { - POSITIONS.forEach(position => { + POSITIONS.forEach((position) => { it('is always within the viewport', () => { wrapperMount( { position={position} trigger={} on='click' - /> + />, ) wrapper.find('button').simulate('click') @@ -136,7 +136,7 @@ describe('Popup', () => { trigger={} on='click' offset={999} - /> + />, ) wrapper.find('button').simulate('click') const selectedPosition = wrapper.state('position') @@ -280,7 +280,7 @@ describe('Popup', () => { describe('size', () => { const sizes = _.without(SUI.SIZES, 'medium', 'big', 'massive') - sizes.forEach(size => { + sizes.forEach((size) => { it(`adds the ${size} to the popup className`, () => { wrapperMount() assertInBody(`.ui.${size}.popup`) diff --git a/test/specs/modules/Rating/Rating-test.js b/test/specs/modules/Rating/Rating-test.js index e5fda5a68e..2db1a1f528 100644 --- a/test/specs/modules/Rating/Rating-test.js +++ b/test/specs/modules/Rating/Rating-test.js @@ -79,7 +79,7 @@ describe('Rating', () => { wrapper.should.not.have.className('selected') - icons.findWhere((i) => i.prop('selected', true)) + icons.findWhere(i => i.prop('selected', true)) .should.have.length(0, 'Some RatingIcons did not remove its "selected" prop') }) }) @@ -124,7 +124,7 @@ describe('Rating', () => { icons.last().simulate('click') - icons.findWhere((i) => i.prop('active', true)) + icons.findWhere(i => i.prop('active', true)) .should.have.length(5, 'Some RatingIcons did not retain its "active" prop') }) @@ -156,7 +156,7 @@ describe('Rating', () => { icons.at(3).simulate('click') - icons.findWhere((i) => i.prop('active', true)) + icons.findWhere(i => i.prop('active', true)) .should.have.length(0, 'Some RatingIcons did not remove its "active" prop') }) @@ -174,7 +174,7 @@ describe('Rating', () => { icons.last().simulate('click') - icons.findWhere((i) => i.prop('active', true)) + icons.findWhere(i => i.prop('active', true)) .should.have.length(5, 'Some RatingIcons did not retain its "active" prop') }) }) @@ -200,7 +200,7 @@ describe('Rating', () => { icons.last().simulate('click') - icons.findWhere((i) => i.prop('active', true)) + icons.findWhere(i => i.prop('active', true)) .should.have.length(3, 'Some RatingIcons lost its "active" prop') }) @@ -210,7 +210,7 @@ describe('Rating', () => { icons.last().simulate('mouseEnter') - icons.findWhere((i) => i.prop('selected', true)) + icons.findWhere(i => i.prop('selected', true)) .should.have.length(0, 'Some RatingIcons became "selected"') }) @@ -219,13 +219,13 @@ describe('Rating', () => { const icons = wrapper.find('RatingIcon') icons.last().simulate('mouseEnter') - icons.findWhere((i) => i.prop('selected', true)) + icons.findWhere(i => i.prop('selected', true)) .should.have.length(3, 'Not every RatingIcon was selected on mouseEnter') wrapper.setProps({ disabled: true }) wrapper.simulate('mouseLeave') - icons.findWhere((i) => i.prop('selected', true)) + icons.findWhere(i => i.prop('selected', true)) .should.have.length(3, 'Some RatingIcons lost its "selected" prop') }) @@ -235,7 +235,7 @@ describe('Rating', () => { icons.last().simulate('click') - icons.findWhere((i) => i.prop('active', true)) + icons.findWhere(i => i.prop('active', true)) .should.have.length(0, 'Some RatingIcons became "active"') }) }) @@ -272,7 +272,7 @@ describe('Rating', () => { // rating 0 - icons.findWhere((i) => i.prop('active', true)) + icons.findWhere(i => i.prop('active', true)) .should.have.length(0, 'Some RatingIcons have "active" prop') // rating 1 - 10 @@ -280,7 +280,7 @@ describe('Rating', () => { const rating = i + 1 wrapper.setProps({ rating }) - icons.findWhere((icon) => icon.prop('active', true)) + icons.findWhere(icon => icon.prop('active', true)) .should.have.length(rating, 'Some RatingIcons did not have "active" prop') }) }) diff --git a/test/specs/modules/Search/Search-test.js b/test/specs/modules/Search/Search-test.js index 629c3f4f54..f0e6334922 100644 --- a/test/specs/modules/Search/Search-test.js +++ b/test/specs/modules/Search/Search-test.js @@ -32,7 +32,7 @@ const wrapperRender = (...args) => (wrapper = render(...args)) // ---------------------------------------- // Options // ---------------------------------------- -const getOptions = (count = 5) => _.times(count, n => ({ +const getOptions = (count = 5) => _.times(count, () => ({ title: _.times(3, faker.hacker.noun).join(' '), description: _.times(3, faker.hacker.noun).join(' '), image: 'foo.png', @@ -214,7 +214,7 @@ describe('Search', () => { // menu should be completely scrolled to the bottom const isMenuScrolledToBottom = menu.scrollTop + menu.clientHeight === menu.scrollHeight isMenuScrolledToBottom.should.be.true( - 'When the last item in the list was selected, SearchResults did not scroll to bottom.' + 'When the last item in the list was selected, SearchResults did not scroll to bottom.', ) // @@ -234,7 +234,7 @@ describe('Search', () => { const selectedItem = document.querySelector('.ui.search .results.visible .result.active') const isMenuScrolledToTop = menu.scrollTop === selectedItem.offsetTop isMenuScrolledToTop.should.be.true( - 'When the first item in the list was selected, SearchResults did not scroll to top.' + 'When the first item in the list was selected, SearchResults did not scroll to top.', ) }) it('closes the menu', () => { @@ -248,9 +248,9 @@ describe('Search', () => { searchResultsIsClosed() }) it('uses custom renderer', () => { - const resultSpy = sandbox.spy(() =>
) + const resultSpy = sandbox.spy(() =>
) wrapperRender( - + , ) resultSpy.should.have.been.called.exactly(options.length) @@ -265,7 +265,7 @@ describe('Search', () => { const categoryOptions = _.range(0, categoryLength).reduce((memo, index) => { const category = `${faker.hacker.noun()}-${index}` - memo[category] = { + memo[category] = { // eslint-disable-line no-param-reassign name: category, results: getOptions(categoryResultsLength), } @@ -345,12 +345,12 @@ describe('Search', () => { wrapper .find('SearchResult') - .at(categoryLength * categoryResultsLength - 1) + .at((categoryLength * categoryResultsLength) - 1) .should.have.prop('active', true) }) it('uses custom renderer', () => { - const categorySpy = sandbox.spy(() =>
) - const resultSpy = sandbox.spy(() =>
) + const categorySpy = sandbox.spy(() =>
) + const resultSpy = sandbox.spy(() =>
) wrapperRender( { minCharacters={0} categoryRenderer={categorySpy} resultRenderer={resultSpy} - /> + />, ) categorySpy.should.have.been.called.exactly(categoryLength + 1) @@ -749,7 +749,7 @@ describe('Search', () => { // Search handles some of html props const props = _.without(htmlInputAttrs, 'defaultValue') - props.forEach(propName => { + props.forEach((propName) => { it(`passes "${propName}" to the `, () => { wrapperMount() .find('input') diff --git a/test/specs/modules/Sticky/Sticky-test.js b/test/specs/modules/Sticky/Sticky-test.js index 8514d29784..480580f832 100644 --- a/test/specs/modules/Sticky/Sticky-test.js +++ b/test/specs/modules/Sticky/Sticky-test.js @@ -1,4 +1,5 @@ import React from 'react' + import Sticky from 'src/modules/Sticky/Sticky' import { sandbox } from 'test/utils' import * as common from 'test/specs/commonTests' @@ -8,6 +9,7 @@ const scrollToTop = (wrapper, contextEl, { bottomOffset, offset, height }) => { const instance = wrapper.instance() instance.triggerRef = { getBoundingClientRect: () => ({ top: offset }) } instance.stickyRef = { getBoundingClientRect: () => ({ height, top: offset }) } + // eslint-disable-next-line no-param-reassign contextEl.getBoundingClientRect = () => ({ bottom: height + offset + bottomOffset }) window.dispatchEvent(new Event('scroll')) } @@ -17,7 +19,8 @@ const scrollAfterTrigger = (wrapper, contextEl, { bottomOffset, offset, height } const instance = wrapper.instance() instance.triggerRef = { getBoundingClientRect: () => ({ top: offset - 1 }) } instance.stickyRef = { getBoundingClientRect: () => ({ height }) } - contextEl.getBoundingClientRect = () => ({ bottom: window.innerHeight - bottomOffset + 1 }) + // eslint-disable-next-line no-param-reassign + contextEl.getBoundingClientRect = () => ({ bottom: (window.innerHeight - bottomOffset) + 1 }) window.dispatchEvent(new Event('scroll')) } @@ -26,7 +29,7 @@ const scrollAfterContext = (wrapper, contextEl, { offset, height }) => { const instance = wrapper.instance() instance.triggerRef = { getBoundingClientRect: () => ({ top: offset - 1 }) } instance.stickyRef = { getBoundingClientRect: () => ({ height }) } - contextEl.getBoundingClientRect = () => ({ bottom: -1 }) + contextEl.getBoundingClientRect = () => ({ bottom: -1 }) // eslint-disable-line no-param-reassign window.dispatchEvent(new Event('scroll')) } @@ -35,7 +38,7 @@ const scrollToContextBottom = (wrapper, contextEl, { offset, height }) => { const instance = wrapper.instance() instance.triggerRef = { getBoundingClientRect: () => ({ top: offset - 1 }) } instance.stickyRef = { getBoundingClientRect: () => ({ height }) } - contextEl.getBoundingClientRect = () => ({ bottom: height + 1 }) + contextEl.getBoundingClientRect = () => ({ bottom: height + 1 }) // eslint-disable-line no-param-reassign window.dispatchEvent(new Event('scroll')) } @@ -67,7 +70,7 @@ describe('Sticky', () => { const height = 200 const contextEl = { getBoundingClientRect: () => ({}) } const wrapper = mount( - + , ) // Scroll after trigger @@ -82,7 +85,7 @@ describe('Sticky', () => { const height = 100 const contextEl = { getBoundingClientRect: () => ({}) } const wrapper = mount( - + , ) scrollAfterContext(wrapper, contextEl, { bottomOffset, offset, height }) @@ -97,7 +100,7 @@ describe('Sticky', () => { const height = 100 const contextEl = { getBoundingClientRect: () => ({}) } const wrapper = mount( - + , ) scrollAfterTrigger(wrapper, contextEl, { bottomOffset, offset, height }) @@ -122,7 +125,7 @@ describe('Sticky', () => { const height = 100 const contextEl = { getBoundingClientRect: () => ({}) } const wrapper = mount( - + , ) scrollAfterTrigger(wrapper, contextEl, { bottomOffset, offset, height }) @@ -140,7 +143,7 @@ describe('Sticky', () => { const height = 100000 const contextEl = { getBoundingClientRect: () => ({}) } const wrapper = mount( - + , ) scrollAfterTrigger(wrapper, contextEl, { bottomOffset, offset, height }) wrapper.instance().isOversized().should.be.equal(true) @@ -153,7 +156,7 @@ describe('Sticky', () => { const contextEl = { getBoundingClientRect: () => ({}) } const onStick = sandbox.spy() const wrapper = mount( - + , ) scrollAfterTrigger(wrapper, contextEl, { bottomOffset, offset, height }) @@ -171,7 +174,7 @@ describe('Sticky', () => { const contextEl = { getBoundingClientRect: () => ({}) } const onUnstick = sandbox.spy() const wrapper = mount( - + , ) scrollAfterTrigger(wrapper, contextEl, { bottomOffset, offset, height }) @@ -188,7 +191,7 @@ describe('Sticky', () => { const contextEl = { getBoundingClientRect: () => ({}) } const onTop = sandbox.spy() const wrapper = mount( - + , ) scrollAfterContext(wrapper, contextEl, { bottomOffset, offset, height }) @@ -205,7 +208,7 @@ describe('Sticky', () => { const contextEl = { getBoundingClientRect: () => ({}) } const onBottom = sandbox.spy() const wrapper = mount( - + , ) scrollAfterContext(wrapper, contextEl, { bottomOffset, offset, height }) diff --git a/test/specs/modules/Transition/Transition-test.js b/test/specs/modules/Transition/Transition-test.js index ee4674a036..a7dbc4717b 100644 --- a/test/specs/modules/Transition/Transition-test.js +++ b/test/specs/modules/Transition/Transition-test.js @@ -24,12 +24,12 @@ describe('Transition', () => { }) describe('animation', () => { - SUI.DIRECTIONAL_TRANSITIONS.forEach(animation => { + SUI.DIRECTIONAL_TRANSITIONS.forEach((animation) => { it(`directional ${animation}`, () => { wrapperShallow(

- + , ) wrapper.setState({ status: Transition.ENTERING }) @@ -42,12 +42,12 @@ describe('Transition', () => { }) }) - SUI.STATIC_TRANSITIONS.forEach(animation => { + SUI.STATIC_TRANSITIONS.forEach((animation) => { it(`static ${animation}`, () => { wrapperShallow(

- + , ) wrapper.setState({ status: Transition.ENTERING }) @@ -66,7 +66,7 @@ describe('Transition', () => { wrapperShallow(

- + , ) wrapper.should.have.className('foo') @@ -112,7 +112,7 @@ describe('Transition', () => { wrapperShallow(

- + , ).should.have.descendants('p.foo') }) @@ -120,7 +120,7 @@ describe('Transition', () => { wrapperShallow(

- + , ) wrapper.setState({ status: Transition.UNMOUNTED }) @@ -151,7 +151,7 @@ describe('Transition', () => { unmountOnHide={false} >

- + , ) wrapper.should.have.state('status', Transition.EXITED) @@ -164,7 +164,7 @@ describe('Transition', () => { wrapperShallow(

- + , ).should.have.style('animation-duration', '500ms') }) @@ -172,7 +172,7 @@ describe('Transition', () => { wrapperShallow(

- + , ).should.have.style('animation-duration', '1000ms') }) }) @@ -190,7 +190,7 @@ describe('Transition', () => { wrapperShallow(

- + , ) wrapper.setProps({ visible: false }) @@ -201,7 +201,7 @@ describe('Transition', () => { wrapperShallow(

- + , ) wrapper.setProps({ visible: true }) @@ -209,7 +209,7 @@ describe('Transition', () => { wrapper.instance().should.include({ nextStatus: Transition.ENTERING }) }) - it('updates next status when set to true while performs an ENTERING transition', done => { + it('updates next status when set to true while performs an ENTERING transition', (done) => { wrapperMount( { onHide={done} >

- + , ) wrapper.setProps({ visible: false }) @@ -225,11 +225,11 @@ describe('Transition', () => { wrapper.instance().should.include({ nextStatus: Transition.EXITING }) }) - it('updates next status when set to true while performs an EXITING transition', done => { + it('updates next status when set to true while performs an EXITING transition', (done) => { wrapperMount(

- + , ) wrapper.setProps({ visible: false }) wrapper.setProps({ visible: true }) @@ -240,7 +240,7 @@ describe('Transition', () => { }) describe('onComplete', () => { - it('is called with (null, props) when transition completed', done => { + it('is called with (null, props) when transition completed', (done) => { const onComplete = sandbox.spy() const handleComplete = (...args) => { onComplete(...args) @@ -258,13 +258,13 @@ describe('Transition', () => { transitionOnMount >

- + , ) }) }) describe('onHide', () => { - it('is called with (null, props) when hidden', done => { + it('is called with (null, props) when hidden', (done) => { const onHide = sandbox.spy() const handleHide = (...args) => { onHide(...args) @@ -282,14 +282,14 @@ describe('Transition', () => { transitionOnMount={false} >

- + , ) wrapper.setProps({ visible: false }) }) }) describe('onShow', () => { - it('is called with (null, props) when shown', done => { + it('is called with (null, props) when shown', (done) => { const onShow = sandbox.spy() const handleShow = (...args) => { onShow(...args) @@ -307,13 +307,13 @@ describe('Transition', () => { transitionOnMount >

- + , ) }) }) describe('onStart', () => { - it('is called with (null, props) when transition started', done => { + it('is called with (null, props) when transition started', (done) => { const onStart = sandbox.spy() const handleStart = (...args) => { onStart(...args) @@ -331,7 +331,7 @@ describe('Transition', () => { transitionOnMount >

- + , ) }) }) @@ -341,7 +341,7 @@ describe('Transition', () => { wrapperShallow(

- + , ) wrapper.should.have.style('bottom', '5px') @@ -354,7 +354,7 @@ describe('Transition', () => { wrapperShallow(

- + , ) wrapper.should.have.state('status', Transition.EXITED) @@ -365,13 +365,13 @@ describe('Transition', () => { wrapperMount(

- + , ).should.have.state('status', Transition.ENTERING) }) }) describe('unmountOnHide', () => { - it('unmounts child when true', done => { + it('unmounts child when true', (done) => { const onHide = () => { wrapper.should.have.state('status', Transition.UNMOUNTED) done() @@ -385,12 +385,12 @@ describe('Transition', () => { unmountOnHide >

- + , ) wrapper.setProps({ visible: false }) }) - it('lefts mounted when false', done => { + it('lefts mounted when false', (done) => { const onHide = () => { wrapper.should.have.state('status', Transition.EXITED) done() @@ -404,7 +404,7 @@ describe('Transition', () => { unmountOnHide={false} >

- + , ) wrapper.setProps({ visible: false }) }) diff --git a/test/specs/modules/Transition/TransitionGroup-test.js b/test/specs/modules/Transition/TransitionGroup-test.js index 6c3e82a192..4c17e821a1 100644 --- a/test/specs/modules/Transition/TransitionGroup-test.js +++ b/test/specs/modules/Transition/TransitionGroup-test.js @@ -27,7 +27,7 @@ describe('TransitionGroup', () => {

- + , ) .children() .everyWhere(item => item.type().should.equal(Transition)) @@ -39,10 +39,10 @@ describe('TransitionGroup', () => {
- + , ) .children() - .everyWhere(item => { + .everyWhere((item) => { item.should.have.prop('animation', 'scale') item.should.have.prop('duration', 1500) }) @@ -52,7 +52,7 @@ describe('TransitionGroup', () => { wrapperShallow(
- + , ) wrapper.setProps({ children: [
,
] }) @@ -66,7 +66,7 @@ describe('TransitionGroup', () => { wrapperShallow(
- + , ) wrapper.setProps({ children: [
, '',
] }) @@ -80,7 +80,7 @@ describe('TransitionGroup', () => {
- + , ) wrapper.setProps({ children: [
] }) @@ -88,12 +88,12 @@ describe('TransitionGroup', () => { wrapper.childAt(1).should.have.prop('visible', false) }) - it('removes child after transition', done => { + it('removes child after transition', (done) => { wrapperMount(
- + , ) wrapper.setProps({ children: [
] }) diff --git a/test/specs/views/Advertisement/Advertisement-test.js b/test/specs/views/Advertisement/Advertisement-test.js index 42818fd651..f6f4bf826f 100644 --- a/test/specs/views/Advertisement/Advertisement-test.js +++ b/test/specs/views/Advertisement/Advertisement-test.js @@ -26,7 +26,7 @@ describe('Advertisement', () => { ]) it('renders a
by default', () => { - shallow() + shallow() .should.have.tagName('div') }) }) diff --git a/test/specs/views/Feed/Feed-test.js b/test/specs/views/Feed/Feed-test.js index b50b58360a..ccbcafc8f7 100644 --- a/test/specs/views/Feed/Feed-test.js +++ b/test/specs/views/Feed/Feed-test.js @@ -12,14 +12,12 @@ describe('Feed', () => { common.rendersChildren(Feed) common.propValueOnlyToClassName(Feed, 'size', - _.without(SUI.SIZES, 'mini', 'tiny', 'medium', 'big', 'huge', 'massive') + _.without(SUI.SIZES, 'mini', 'tiny', 'medium', 'big', 'huge', 'massive'), ) describe('events prop', () => { it('renders ', () => { - const events = _.times(3, () => { - return { summary: faker.hacker.phrase() } - }) + const events = _.times(3, () => ({ summary: faker.hacker.phrase() })) shallow() .should.have.exactly(3).descendants('FeedEvent') diff --git a/test/specs/views/Feed/FeedEvent-test.js b/test/specs/views/Feed/FeedEvent-test.js index ca00347ca7..d239b801d7 100644 --- a/test/specs/views/Feed/FeedEvent-test.js +++ b/test/specs/views/Feed/FeedEvent-test.js @@ -30,7 +30,7 @@ describe('FeedEvent', () => { it('renders with other content props', () => { const contentProps = ['content', 'date', 'extraText', 'meta', 'summary'] - contentProps.forEach(propKey => { + contentProps.forEach((propKey) => { const props = { [propKey]: faker.hacker.phrase() } shallow().should.have.descendants('FeedContent') }) diff --git a/test/tests.bundle.js b/test/tests.bundle.js index afab32f140..3a31e72482 100644 --- a/test/tests.bundle.js +++ b/test/tests.bundle.js @@ -9,7 +9,7 @@ const testsContext = require.context('./', true, /-test\.js$/) // only re-run changed tests, or all if none changed // https://www.npmjs.com/package/karma-webpack-with-fast-source-maps const __karmaWebpackManifest__ = [] -let runnable = testsContext.keys().filter((path) => __karmaWebpackManifest__.indexOf(path) >= 0) +let runnable = testsContext.keys().filter(path => __karmaWebpackManifest__.indexOf(path) >= 0) if (!runnable.length) runnable = testsContext.keys()