Skip to content

Commit

Permalink
chore(structured-list): remove next folder (#12590)
Browse files Browse the repository at this point in the history
* chore(structured-list): remove next folder

* chore(structured-list): update snapshots

* Apply suggestions from code review

* Update index.js

Co-authored-by: Taylor Jones <tay1orjones@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 10, 2022
1 parent e5959d6 commit 1bc93ba
Show file tree
Hide file tree
Showing 8 changed files with 228 additions and 722 deletions.
120 changes: 108 additions & 12 deletions packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6708,24 +6708,96 @@ Map {
"render": [Function],
},
"StructuredListBody" => Object {
"$$typeof": Symbol(react.forward_ref),
"render": [Function],
"defaultProps": Object {
"onKeyDown": [Function],
},
"propTypes": Object {
"children": Object {
"type": "node",
},
"className": Object {
"type": "string",
},
"head": Object {
"type": "bool",
},
"onKeyDown": Object {
"type": "func",
},
},
},
"StructuredListCell" => Object {
"$$typeof": Symbol(react.forward_ref),
"render": [Function],
"defaultProps": Object {
"head": false,
"noWrap": false,
},
"propTypes": Object {
"children": Object {
"type": "node",
},
"className": Object {
"type": "string",
},
"head": Object {
"type": "bool",
},
"noWrap": Object {
"type": "bool",
},
},
},
"StructuredListHead" => Object {
"$$typeof": Symbol(react.forward_ref),
"render": [Function],
"propTypes": Object {
"children": Object {
"type": "node",
},
"className": Object {
"type": "string",
},
},
},
"StructuredListInput" => Object {
"$$typeof": Symbol(react.forward_ref),
"render": [Function],
"defaultProps": Object {
"title": "title",
},
"propTypes": Object {
"className": Object {
"type": "string",
},
"defaultChecked": [Function],
"id": Object {
"type": "string",
},
"name": Object {
"type": "string",
},
"onChange": [Function],
"title": Object {
"type": "string",
},
"value": [Function],
},
},
"StructuredListRow" => Object {
"$$typeof": Symbol(react.forward_ref),
"render": [Function],
"defaultProps": Object {
"head": false,
"onKeyDown": [Function],
},
"propTypes": Object {
"children": Object {
"type": "node",
},
"className": Object {
"type": "string",
},
"head": Object {
"type": "bool",
},
"label": [Function],
"onKeyDown": Object {
"type": "func",
},
},
},
"StructuredListSkeleton" => Object {
"defaultProps": Object {
Expand All @@ -6745,8 +6817,32 @@ Map {
},
},
"StructuredListWrapper" => Object {
"$$typeof": Symbol(react.forward_ref),
"render": [Function],
"defaultProps": Object {
"ariaLabel": "Structured list section",
"isCondensed": false,
"isFlush": false,
"selection": false,
},
"propTypes": Object {
"ariaLabel": Object {
"type": "string",
},
"children": Object {
"type": "node",
},
"className": Object {
"type": "string",
},
"isCondensed": Object {
"type": "bool",
},
"isFlush": Object {
"type": "bool",
},
"selection": Object {
"type": "bool",
},
},
},
"Switch" => Object {
"$$typeof": Symbol(react.forward_ref),
Expand Down
36 changes: 21 additions & 15 deletions packages/react/src/components/StructuredList/StructuredList-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ describe('StructuredListWrapper', () => {
);

it('should have the expected classes', () => {
expect(wrapper.hasClass(`${prefix}--structured-list`)).toEqual(true);
expect(
wrapper.find('div').hasClass(`${prefix}--structured-list`)
).toEqual(true);
});

it('Should add extra classes that are passed via className', () => {
expect(wrapper.hasClass('extra-class')).toEqual(true);
expect(wrapper.find('div').hasClass('extra-class')).toEqual(true);
});

it('By default, selection prop is false', () => {
Expand All @@ -40,9 +42,23 @@ describe('StructuredListWrapper', () => {

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(
true
);
expect(
wrapper.find('div').hasClass(`${prefix}--structured-list--selection`)
).toEqual(true);
});

it('Should add the modifier class for condensed when isCondensed prop is true', () => {
wrapper.setProps({ isCondensed: true });
expect(
wrapper.find('div').hasClass(`${prefix}--structured-list--condensed`)
).toEqual(true);
});

it('Should add the modifier class for flush when isFlush prop is true', () => {
wrapper.setProps({ isFlush: true });
expect(
wrapper.find('div').hasClass(`${prefix}--structured-list--flush`)
).toEqual(true);
});
});
});
Expand Down Expand Up @@ -119,16 +135,6 @@ describe('StructuredListRow', () => {
).toEqual(true);
});

it('should use <div> HTML by default (or when label prop is false)', () => {
const wrapperLabel = shallow(<StructuredListRow />);
expect(wrapperLabel.getElement().type).toEqual('div');
});

it('should use <label> HTML when label prop is true', () => {
const wrapperLabel = shallow(<StructuredListRow label />);
expect(wrapperLabel.getElement().type).toEqual('label');
});

it('Should accept other props from ...other', () => {
const wrapperProps = shallow(
<StructuredListRow title="title">hi</StructuredListRow>
Expand Down
Loading

0 comments on commit 1bc93ba

Please sign in to comment.