Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(structured-list): remove next folder #12590

Merged
merged 6 commits into from
Nov 10, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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