From 49112d95d39e6422b57516d70c77d7de392b080c Mon Sep 17 00:00:00 2001 From: TJ Egan Date: Fri, 13 Mar 2020 08:13:06 -0700 Subject: [PATCH] fix(structured-list): remove unused prop (#5592) * fix(structured-list): remove unused prop * fix(structured-list): wrap prop in deprecate block * fix(structured-list): remove border from other Co-authored-by: Josh Black --- .../__snapshots__/PublicAPI-test.js.snap | 5 +---- .../StructuredList/StructuredList-story.js | 4 ++-- .../StructuredList/StructuredList-test.js | 15 --------------- .../components/StructuredList/StructuredList.js | 10 ++++++---- 4 files changed, 9 insertions(+), 25 deletions(-) diff --git a/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap b/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap index 21b7a4fc60b6..9d34499556f5 100644 --- a/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap +++ b/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap @@ -4456,16 +4456,13 @@ Map { "StructuredListWrapper" => Object { "defaultProps": Object { "ariaLabel": "Structured list section", - "border": false, "selection": false, }, "propTypes": Object { "ariaLabel": Object { "type": "string", }, - "border": Object { - "type": "bool", - }, + "border": [Function], "children": Object { "type": "node", }, diff --git a/packages/react/src/components/StructuredList/StructuredList-story.js b/packages/react/src/components/StructuredList/StructuredList-story.js index 37131ee0b52c..86cb88cbb851 100644 --- a/packages/react/src/components/StructuredList/StructuredList-story.js +++ b/packages/react/src/components/StructuredList/StructuredList-story.js @@ -97,7 +97,7 @@ storiesOf('StructuredList', module) )); }; return ( - + ColumnA @@ -125,7 +125,7 @@ storiesOf('StructuredList', module) () => (
- +
), { diff --git a/packages/react/src/components/StructuredList/StructuredList-test.js b/packages/react/src/components/StructuredList/StructuredList-test.js index 4780dedc6346..7e01b3779875 100644 --- a/packages/react/src/components/StructuredList/StructuredList-test.js +++ b/packages/react/src/components/StructuredList/StructuredList-test.js @@ -33,27 +33,12 @@ describe('StructuredListWrapper', () => { expect(wrapper.hasClass('extra-class')).toEqual(true); }); - it('By default, border prop is false', () => { - wrapper.setProps({ border: false }); - expect(wrapper.hasClass(`${prefix}--structured-list--border`)).toEqual( - false - ); - }); - it('By default, selection prop is false', () => { - wrapper.setProps({ border: false }); expect(wrapper.hasClass(`${prefix}--structured-list--selection`)).toEqual( false ); }); - it('Should add the modifier class for border when border prop is true', () => { - wrapper.setProps({ border: true }); - expect(wrapper.hasClass(`${prefix}--structured-list--border`)).toEqual( - true - ); - }); - it('Should add the modifier class for selection when selection prop is true', () => { wrapper.setProps({ selection: true }); expect(wrapper.hasClass(`${prefix}--structured-list--selection`)).toEqual( diff --git a/packages/react/src/components/StructuredList/StructuredList.js b/packages/react/src/components/StructuredList/StructuredList.js index 69d880980175..d26ef8668dc1 100644 --- a/packages/react/src/components/StructuredList/StructuredList.js +++ b/packages/react/src/components/StructuredList/StructuredList.js @@ -10,6 +10,7 @@ import PropTypes from 'prop-types'; import classNames from 'classnames'; import { settings } from 'carbon-components'; import setupGetInstanceId from '../../tools/setupGetInstanceId'; +import deprecate from '../../prop-types/deprecate'; const { prefix } = settings; @@ -28,7 +29,10 @@ export class StructuredListWrapper extends Component { /** * Specify whether a border should be added to your StructuredListWrapper */ - border: PropTypes.bool, + border: deprecate( + PropTypes.bool, + `\nThe prop \`border\` will be removed in the next major version of Carbon.` + ), /** * Specify whether your StructuredListWrapper should have selections @@ -42,7 +46,6 @@ export class StructuredListWrapper extends Component { }; static defaultProps = { - border: false, selection: false, ariaLabel: 'Structured list section', }; @@ -52,13 +55,12 @@ export class StructuredListWrapper extends Component { children, selection, className, - border, ariaLabel, + border: _border, ...other } = this.props; const classes = classNames(`${prefix}--structured-list`, className, { - [`${prefix}--structured-list--border`]: border, [`${prefix}--structured-list--selection`]: selection, });