Skip to content

Commit

Permalink
Revert "fix(structured-list): remove unused prop (carbon-design-syste…
Browse files Browse the repository at this point in the history
…m#5592)"

This reverts commit 49112d9.
  • Loading branch information
renmaddox authored Mar 20, 2020
1 parent 88b0480 commit 3c3bbf8
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4456,13 +4456,16 @@ Map {
"StructuredListWrapper" => Object {
"defaultProps": Object {
"ariaLabel": "Structured list section",
"border": false,
"selection": false,
},
"propTypes": Object {
"ariaLabel": Object {
"type": "string",
},
"border": [Function],
"border": Object {
"type": "bool",
},
"children": Object {
"type": "node",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ storiesOf('StructuredList', module)
));
};
return (
<StructuredListWrapper selection>
<StructuredListWrapper selection border>
<StructuredListHead>
<StructuredListRow head>
<StructuredListCell head>ColumnA</StructuredListCell>
Expand Down Expand Up @@ -125,7 +125,7 @@ storiesOf('StructuredList', module)
() => (
<div style={{ width: '800px' }}>
<StructuredListSkeleton />
<StructuredListSkeleton />
<StructuredListSkeleton border />
</div>
),
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,27 @@ 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(
Expand Down
10 changes: 4 additions & 6 deletions packages/react/src/components/StructuredList/StructuredList.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ 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;

Expand All @@ -29,10 +28,7 @@ export class StructuredListWrapper extends Component {
/**
* Specify whether a border should be added to your StructuredListWrapper
*/
border: deprecate(
PropTypes.bool,
`\nThe prop \`border\` will be removed in the next major version of Carbon.`
),
border: PropTypes.bool,

/**
* Specify whether your StructuredListWrapper should have selections
Expand All @@ -46,6 +42,7 @@ export class StructuredListWrapper extends Component {
};

static defaultProps = {
border: false,
selection: false,
ariaLabel: 'Structured list section',
};
Expand All @@ -55,12 +52,13 @@ 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,
});

Expand Down

0 comments on commit 3c3bbf8

Please sign in to comment.