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

feat(data-table): add data-table to sass modules style package #8844

Merged
merged 11 commits into from
Jun 14, 2021
Merged
24 changes: 18 additions & 6 deletions packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4964,12 +4964,24 @@ Map {
},
},
},
"StructuredListWrapper" => Object {},
"StructuredListHead" => Object {},
"StructuredListBody" => Object {},
"StructuredListRow" => Object {},
"StructuredListInput" => Object {},
"StructuredListCell" => Object {},
"StructuredListWrapper" => Object {
"displayName": "v11Switch(StructuredListWrapper)",
},
"StructuredListHead" => Object {
"displayName": "v11Switch(StructuredListHead)",
},
"StructuredListBody" => Object {
"displayName": "v11Switch(StructuredListBody)",
},
"StructuredListRow" => Object {
"displayName": "v11Switch(StructuredListRow)",
},
"StructuredListInput" => Object {
"displayName": "v11Switch(StructuredListInput)",
},
"StructuredListCell" => Object {
"displayName": "v11Switch(StructuredListCell)",
},
"StructuredListSkeleton" => Object {
"defaultProps": Object {
"border": false,
Expand Down
7 changes: 7 additions & 0 deletions packages/react/src/components/StructuredList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export function StructuredListWrapper(props) {
}
return <StructuredListWrapperClassic {...props} />;
}
StructuredListWrapper.displayName = 'v11Switch(StructuredListWrapper)';

export function StructuredListHead(props) {
const enabled = useFeatureFlag('enable-v11-release');
Expand All @@ -38,13 +39,16 @@ export function StructuredListHead(props) {
}
return <StructuredListHeadClassic {...props} />;
}
StructuredListHead.displayName = 'v11Switch(StructuredListHead)';

export function StructuredListInput(props) {
const enabled = useFeatureFlag('enable-v11-release');
if (enabled) {
return <StructuredListInputNext {...props} />;
}
return <StructuredListInputClassic {...props} />;
}
StructuredListInput.displayName = 'v11Switch(StructuredListInput)';

export function StructuredListBody(props) {
const enabled = useFeatureFlag('enable-v11-release');
Expand All @@ -53,6 +57,7 @@ export function StructuredListBody(props) {
}
return <StructuredListBodyClassic {...props} />;
}
StructuredListBody.displayName = 'v11Switch(StructuredListBody)';

export function StructuredListRow(props) {
const enabled = useFeatureFlag('enable-v11-release');
Expand All @@ -61,6 +66,7 @@ export function StructuredListRow(props) {
}
return <StructuredListRowClassic {...props} />;
}
StructuredListRow.displayName = 'v11Switch(StructuredListRow)';

export function StructuredListCell(props) {
const enabled = useFeatureFlag('enable-v11-release');
Expand All @@ -69,5 +75,6 @@ export function StructuredListCell(props) {
}
return <StructuredListCellClassic {...props} />;
}
StructuredListCell.displayName = 'v11Switch(StructuredListCell)';

export { default as StructuredListSkeleton } from './StructuredList.Skeleton';
85 changes: 85 additions & 0 deletions packages/styles/scss/components/__tests__/data-table-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/**
* Copyright IBM Corp. 2018, 2018
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*
* @jest-environment node
*/

'use strict';

const { SassRenderer } = require('@carbon/test-utils/scss');

const { render } = SassRenderer.create(__dirname);

describe('scss/components/data-table', () => {
test('Public API', async () => {
const { unwrap } = await render(`
@use 'sass:map';
@use 'sass:meta';
@use '../data-table';

$_: get('mixin', meta.mixin-exists('data-table', 'data-table'));
$_: get('variables', map.keys(meta.module-variables('data-table')));
`);
expect(unwrap('mixin')).toBe(true);
expect(unwrap('variables')).toMatchInlineSnapshot(`
Array [
"data-table-column-hover",
]
`);
});
});

describe('scss/components/data-table/action', () => {
test('Public API', async () => {
const { unwrap } = await render(`
@use 'sass:map';
@use 'sass:meta';
@use '../data-table/action';

$_: get('mixin', meta.mixin-exists('data-table-action', 'action'));
`);
expect(unwrap('mixin')).toBe(true);
});
});

describe('scss/components/data-table/expandable', () => {
test('Public API', async () => {
const { unwrap } = await render(`
@use 'sass:map';
@use 'sass:meta';
@use '../data-table/expandable';

$_: get('mixin', meta.mixin-exists('data-table-expandable', 'expandable'));
`);
expect(unwrap('mixin')).toBe(true);
});
});

describe('scss/components/data-table/skeleton', () => {
test('Public API', async () => {
const { unwrap } = await render(`
@use 'sass:map';
@use 'sass:meta';
@use '../data-table/skeleton';

$_: get('mixin', meta.mixin-exists('data-table-skeleton', 'skeleton'));
`);
expect(unwrap('mixin')).toBe(true);
});
});

describe('scss/components/data-table/sort', () => {
test('Public API', async () => {
const { unwrap } = await render(`
@use 'sass:map';
@use 'sass:meta';
@use '../data-table/sort';

$_: get('mixin', meta.mixin-exists('data-table-sort', 'sort'));
`);
expect(unwrap('mixin')).toBe(true);
tay1orjones marked this conversation as resolved.
Show resolved Hide resolved
});
});
5 changes: 5 additions & 0 deletions packages/styles/scss/components/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@
@use 'link';
@use 'list';
@use 'loading';
@use 'data-table';
@use 'data-table/action';
@use 'data-table/expandable';
@use 'data-table/skeleton';
@use 'data-table/sort';
Loading