diff --git a/src/components/Table/__snapshots__/Table.visual.test.tsx-snapshots/Table-render-story-Default-dark-chromium-linux.png b/src/components/Table/__snapshots__/Table.visual.test.tsx-snapshots/Table-render-story-Default-dark-chromium-linux.png new file mode 100644 index 0000000000..d360ec3944 Binary files /dev/null and b/src/components/Table/__snapshots__/Table.visual.test.tsx-snapshots/Table-render-story-Default-dark-chromium-linux.png differ diff --git a/src/components/Table/__snapshots__/Table.visual.test.tsx-snapshots/Table-render-story-Default-dark-webkit-linux.png b/src/components/Table/__snapshots__/Table.visual.test.tsx-snapshots/Table-render-story-Default-dark-webkit-linux.png new file mode 100644 index 0000000000..a9cd718ed0 Binary files /dev/null and b/src/components/Table/__snapshots__/Table.visual.test.tsx-snapshots/Table-render-story-Default-dark-webkit-linux.png differ diff --git a/src/components/Table/__snapshots__/Table.visual.test.tsx-snapshots/Table-render-story-Default-light-chromium-linux.png b/src/components/Table/__snapshots__/Table.visual.test.tsx-snapshots/Table-render-story-Default-light-chromium-linux.png new file mode 100644 index 0000000000..2cce9f0e31 Binary files /dev/null and b/src/components/Table/__snapshots__/Table.visual.test.tsx-snapshots/Table-render-story-Default-light-chromium-linux.png differ diff --git a/src/components/Table/__snapshots__/Table.visual.test.tsx-snapshots/Table-render-story-Default-light-webkit-linux.png b/src/components/Table/__snapshots__/Table.visual.test.tsx-snapshots/Table-render-story-Default-light-webkit-linux.png new file mode 100644 index 0000000000..1c12d8c11f Binary files /dev/null and b/src/components/Table/__snapshots__/Table.visual.test.tsx-snapshots/Table-render-story-Default-light-webkit-linux.png differ diff --git a/src/components/Table/__snapshots__/Table.visual.test.tsx-snapshots/Table-render-story-HOCWithTableSorting-dark-chromium-linux.png b/src/components/Table/__snapshots__/Table.visual.test.tsx-snapshots/Table-render-story-HOCWithTableSorting-dark-chromium-linux.png new file mode 100644 index 0000000000..df5744b1e4 Binary files /dev/null and b/src/components/Table/__snapshots__/Table.visual.test.tsx-snapshots/Table-render-story-HOCWithTableSorting-dark-chromium-linux.png differ diff --git a/src/components/Table/__snapshots__/Table.visual.test.tsx-snapshots/Table-render-story-HOCWithTableSorting-dark-webkit-linux.png b/src/components/Table/__snapshots__/Table.visual.test.tsx-snapshots/Table-render-story-HOCWithTableSorting-dark-webkit-linux.png new file mode 100644 index 0000000000..609f9ee9b4 Binary files /dev/null and b/src/components/Table/__snapshots__/Table.visual.test.tsx-snapshots/Table-render-story-HOCWithTableSorting-dark-webkit-linux.png differ diff --git a/src/components/Table/__snapshots__/Table.visual.test.tsx-snapshots/Table-render-story-HOCWithTableSorting-light-chromium-linux.png b/src/components/Table/__snapshots__/Table.visual.test.tsx-snapshots/Table-render-story-HOCWithTableSorting-light-chromium-linux.png new file mode 100644 index 0000000000..31292b1dde Binary files /dev/null and b/src/components/Table/__snapshots__/Table.visual.test.tsx-snapshots/Table-render-story-HOCWithTableSorting-light-chromium-linux.png differ diff --git a/src/components/Table/__snapshots__/Table.visual.test.tsx-snapshots/Table-render-story-HOCWithTableSorting-light-webkit-linux.png b/src/components/Table/__snapshots__/Table.visual.test.tsx-snapshots/Table-render-story-HOCWithTableSorting-light-webkit-linux.png new file mode 100644 index 0000000000..14a346142d Binary files /dev/null and b/src/components/Table/__snapshots__/Table.visual.test.tsx-snapshots/Table-render-story-HOCWithTableSorting-light-webkit-linux.png differ diff --git a/src/components/Table/__tests__/Table.visual.test.tsx b/src/components/Table/__tests__/Table.visual.test.tsx new file mode 100644 index 0000000000..8138313b91 --- /dev/null +++ b/src/components/Table/__tests__/Table.visual.test.tsx @@ -0,0 +1,19 @@ +import React from 'react'; + +import {test} from '~playwright/core'; + +import {TableStories} from './helpersPlaywright'; + +test.describe('Table', () => { + test('render story: ', async ({mount, expectScreenshot}) => { + await mount(); + + await expectScreenshot(); + }); + + test('render story: ', async ({mount, expectScreenshot}) => { + await mount(); + + await expectScreenshot(); + }); +}); diff --git a/src/components/Table/__tests__/helpersPlaywright.tsx b/src/components/Table/__tests__/helpersPlaywright.tsx new file mode 100644 index 0000000000..97d0a0ef78 --- /dev/null +++ b/src/components/Table/__tests__/helpersPlaywright.tsx @@ -0,0 +1,5 @@ +import {composeStories} from '@storybook/react'; + +import * as DefaultTableStories from '../__stories__/Table.stories'; + +export const TableStories = composeStories(DefaultTableStories); diff --git a/src/components/Table/hoc/withTableSorting/SortIndicator/SortIndicator.scss b/src/components/Table/hoc/withTableSorting/SortIndicator/SortIndicator.scss deleted file mode 100644 index f6833f1cf6..0000000000 --- a/src/components/Table/hoc/withTableSorting/SortIndicator/SortIndicator.scss +++ /dev/null @@ -1,9 +0,0 @@ -@use '../../../../variables'; - -$block: '.#{variables.$ns}sort-indicator'; - -#{$block} { - &__icon { - vertical-align: -2px; - } -} diff --git a/src/components/Table/hoc/withTableSorting/SortIndicator/SortIndicator.tsx b/src/components/Table/hoc/withTableSorting/SortIndicator/SortIndicator.tsx index 10911b2a7e..ecceb3cc56 100644 --- a/src/components/Table/hoc/withTableSorting/SortIndicator/SortIndicator.tsx +++ b/src/components/Table/hoc/withTableSorting/SortIndicator/SortIndicator.tsx @@ -3,16 +3,11 @@ import React from 'react'; import {ArrowDown, ArrowUp, ArrowUpArrowDown} from '@gravity-ui/icons'; import {Icon} from '../../../../Icon'; -import {block} from '../../../../utils/cn'; - -import './SortIndicator.scss'; export interface SortIndicatorProps { order?: 'asc' | 'desc'; } -const b = block('sort-indicator'); - export function SortIndicator({order}: SortIndicatorProps) { let icon; switch (order) { @@ -26,9 +21,5 @@ export function SortIndicator({order}: SortIndicatorProps) { icon = ArrowUpArrowDown; } - return ( -
- -
- ); + return ; } diff --git a/src/components/Table/hoc/withTableSorting/withTableSorting.scss b/src/components/Table/hoc/withTableSorting/withTableSorting.scss index b43996aa38..da24721fd0 100644 --- a/src/components/Table/hoc/withTableSorting/withTableSorting.scss +++ b/src/components/Table/hoc/withTableSorting/withTableSorting.scss @@ -5,7 +5,7 @@ $block: '.#{variables.$ns}table'; #{$block} { &__sort { display: inline-flex; - align-items: baseline; + align-items: center; gap: var(--g-spacing-1); // `top` to avoid redundant height to appear vertical-align: top; @@ -14,6 +14,7 @@ $block: '.#{variables.$ns}table'; border-radius: var(--g-border-radius-xs); &-indicator { + display: flex; flex-shrink: 0; color: var(--g-color-text-hint); }