diff --git a/.github/workflows/pr-title.yml b/.github/workflows/pr-title.yml new file mode 100644 index 0000000000..42051123ed --- /dev/null +++ b/.github/workflows/pr-title.yml @@ -0,0 +1,27 @@ +name: PR Title + +on: + pull_request: + types: + - opened + - synchronize + - reopened + - edited + +jobs: + verify_title: + name: Verify Title + runs-on: ubuntu-latest + if: ${{github.event.action != 'edited' || github.event.changes.title}} + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 18 + cache: npm + - name: Install Packages + run: npm ci + - name: Run Commitlint + run: echo "${{github.event.pull_request.title}}" | npx commitlint diff --git a/src/components/Dialog/Dialog.tsx b/src/components/Dialog/Dialog.tsx index 15198af2f5..1acdc56547 100644 --- a/src/components/Dialog/Dialog.tsx +++ b/src/components/Dialog/Dialog.tsx @@ -17,7 +17,7 @@ import './Dialog.scss'; const b = block('dialog'); -interface DialogOwnProps { +interface DialogOwnProps extends QAProps { open: boolean; children: React.ReactNode; onEscapeKeyDown?: ModalProps['onEscapeKeyDown']; @@ -52,7 +52,7 @@ interface DialogDefaultProps { } export type DialogProps = DialogOwnProps & Partial; -type DialogInnerProps = DialogOwnProps & DialogDefaultProps & QAProps; +type DialogInnerProps = DialogOwnProps & DialogDefaultProps; export class Dialog extends React.Component { static defaultProps: DialogDefaultProps = { diff --git a/src/components/Dialog/__stories__/DialogShowcase.tsx b/src/components/Dialog/__stories__/DialogShowcase.tsx index e419a9061c..b3e0039b7a 100644 --- a/src/components/Dialog/__stories__/DialogShowcase.tsx +++ b/src/components/Dialog/__stories__/DialogShowcase.tsx @@ -67,6 +67,7 @@ function OtherDialog() { hasCloseButton keepMounted onEnterKeyDown={handleApply} + qa="darthVader" onTransitionEntered={() => { selectRef?.current?.focus(); setTimeout(() => setOpenSelect(true), 0); 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); }