Skip to content

Commit

Permalink
Merge pull request #2223 from epam/feat/e2e_add_tests_for_pickerInput
Browse files Browse the repository at this point in the history
Feat/e2e add tests for picker input
  • Loading branch information
siarheiyelin authored May 6, 2024
2 parents 4613429 + 4513e46 commit 03ff2a0
Show file tree
Hide file tree
Showing 602 changed files with 657 additions and 96 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import * as React from 'react';
import {
Button, ControlGroup,
Dropdown, DropdownMenuButton, Panel, Text, Tooltip,
Dropdown, DropdownMenuBody, DropdownMenuButton, ScrollBars, Text, Tooltip,
} from '@epam/uui';
import { ReactComponent as PreviewIcon } from '@epam/assets/icons/common/media-fullscreen-12.svg';
import { ReactComponent as MenuIcon } from '@epam/assets/icons/common/navigation-more_vert-18.svg';
import { TPreviewRef } from '../../../../../preview/types';
import { DropdownBodyProps } from '@epam/uui-core';

const LABELS = {
Fullscreen: 'Fullscreen',
Expand All @@ -27,18 +28,20 @@ export function FullscreenBtn(props: { previewRef: TPreviewRef }) {

const hasPredefinedPreviews = previewRef.predefinedPreviewRefs.length > 0;

const renderPredefinedPreviewList = () => {
const renderPredefinedPreviewList = (props: DropdownBodyProps) => {
if (hasPredefinedPreviews) {
const allItems = previewRef.predefinedPreviewRefs.map(
({ link, id }) => <DropdownMenuButton caption={ id } href={ link } target="_blank" key={ id } />,
);
return (
<Panel background="surface-main" shadow={ true }>
{
previewRef.predefinedPreviewRefs.map(({ link, id }) => {
return (
<DropdownMenuButton caption={ id } href={ link } target="_blank" />
);
})
}
</Panel>
<DropdownMenuBody
{ ...props }
rawProps={ { style: { maxWidth: '250px', padding: '6px 0' } } }
>
<ScrollBars style={ { maxHeight: '50vh' } }>
{ allItems }
</ScrollBars>
</DropdownMenuBody>
);
}
return null;
Expand Down
87 changes: 20 additions & 67 deletions app/src/docs/TextInput.doc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@ import * as uui from '@epam/uui';
import * as loveship from '@epam/loveship';
import * as promo from '@epam/promo';
import * as electric from '@epam/electric';
import { DocBuilder, DocPreviewBuilder, TComponentPreview, TDocConfig, TDocContext, TSkin } from '@epam/uui-docs';
import {
DocBuilder,
DocPreviewBuilder,
TDocConfig,
TDocContext,
TPreviewCellSize, TPreviewMatrix,
TSkin,
} from '@epam/uui-docs';
import { BaseDocsBlock, DocExample, EditableDocContent } from '../common';
import { TTextInputPreview } from './_types/previewIds';

Expand Down Expand Up @@ -31,8 +38,8 @@ export class TextInputDoc extends BaseDocsBlock {
icon: 'action-account-fill.svg',
placeholder: 'Test placeholder',
};

const baseMatrix: TComponentPreview<uui.TextInputProps>['matrix'] = {
type TMatrixLocal = TPreviewMatrix<uui.TextInputProps>;
const baseMatrix: TMatrixLocal = {
size: { examples: '*' },
icon: { examples: [undefined, TEST_DATA.icon] },
iconPosition: { examples: '*', condition: (pp) => !!pp.icon },
Expand All @@ -41,70 +48,16 @@ export class TextInputDoc extends BaseDocsBlock {
onCancel: { examples: ['callback'] },
value: { values: [undefined, TEST_DATA.value] },
};
docPreview.add({
id: TTextInputPreview['Form'],
matrix: {
mode: { examples: ['form'] },
...baseMatrix,
},
cellSize: '180-80',
});
docPreview.add({
id: TTextInputPreview['Form (invalid)'],
matrix: {
mode: { examples: ['form'] },
isInvalid: { values: [true] },
...baseMatrix,
},
cellSize: '180-80',
});
docPreview.add({
id: TTextInputPreview['Form (disabled)'],
matrix: {
mode: { examples: ['form'] },
isDisabled: { values: [true] },
...baseMatrix,
},
cellSize: '180-80',
});
docPreview.add({
id: TTextInputPreview['Form (read only)'],
matrix: {
mode: { examples: ['form'] },
isReadonly: { values: [true] },
...baseMatrix,
},
cellSize: '180-80',
});
//
//
//
docPreview.add({
id: TTextInputPreview['Inline'],
matrix: {
mode: { examples: ['inline'] },
...baseMatrix,
},
cellSize: '180-80',
});
docPreview.add({
id: TTextInputPreview['Inline (disabled)'],
matrix: {
mode: { examples: ['inline'] },
isDisabled: { values: [true] },
...baseMatrix,
},
cellSize: '180-80',
});
docPreview.add({
id: TTextInputPreview['Inline (read only)'],
matrix: {
mode: { examples: ['inline'] },
isReadonly: { values: [true] },
...baseMatrix,
},
cellSize: '180-80',
});
const cellSize: TPreviewCellSize = '180-80';
const formBaseMatrix: TMatrixLocal = { mode: { examples: ['form'] }, ...baseMatrix };
docPreview.add(TTextInputPreview['Form'], formBaseMatrix, cellSize);
docPreview.add(TTextInputPreview['Form (invalid)'], { ...formBaseMatrix, isInvalid: { values: [true] } }, cellSize);
docPreview.add(TTextInputPreview['Form (disabled)'], { ...formBaseMatrix, isDisabled: { values: [true] } }, cellSize);
docPreview.add(TTextInputPreview['Form (read only)'], { ...formBaseMatrix, isReadonly: { values: [true] } }, cellSize);
const inlineBaseMatrix: TMatrixLocal = { mode: { examples: ['inline'] }, ...baseMatrix };
docPreview.add(TTextInputPreview['Inline'], inlineBaseMatrix, cellSize);
docPreview.add(TTextInputPreview['Inline (disabled)'], { ...inlineBaseMatrix, isDisabled: { values: [true] } }, cellSize);
docPreview.add(TTextInputPreview['Inline (read only)'], { ...inlineBaseMatrix, isReadonly: { values: [true] } }, cellSize);
},
};

Expand Down
64 changes: 64 additions & 0 deletions app/src/docs/_types/previewIds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,67 @@ export enum TVerticalTabButtonPreview {
'Inactive Dropdown' = 'Inactive Dropdown',
'Inactive Dropdown Disabled' = 'Inactive Dropdown Disabled'
}

export enum TPickerInputPreview {
/** FORM */
// Form > Single
'Form Single'= 'Form Single',
'Form Single Invalid'= 'Form Single Invalid',
'Form Single Disabled'= 'Form Single Disabled',
'Form Single ReadOnly'= 'Form Single ReadOnly',
// Form > Single > HasValue
'Form Single HasValue'= 'Form Single HasValue',
'Form Single HasValue Invalid'= 'Form Single HasValue Invalid',
'Form Single HasValue Disabled'= 'Form Single HasValue Disabled',
'Form Single HasValue ReadOnly'= 'Form Single HasValue ReadOnly',
// Form > Multi
'Form Multi'= 'Form Multi',
'Form Multi Invalid'= 'Form Multi Invalid',
'Form Multi Disabled'= 'Form Multi Disabled',
'Form Multi ReadOnly'= 'Form Multi ReadOnly',
// Form > Multi > HasValue
'Form Multi HasValue'= 'Form Multi HasValue',
'Form Multi HasValue Invalid'= 'Form Multi HasValue Invalid',
'Form Multi HasValue Disabled'= 'Form Multi HasValue Disabled',
'Form Multi HasValue ReadOnly'= 'Form Multi HasValue ReadOnly',
// Form > Multi > HasValue > MultiLine
'Form Multi HasValue Multiline'= 'Form Multi HasValue Multiline',
'Form Multi HasValue Multiline Invalid'= 'Form Multi HasValue Multiline Invalid',
'Form Multi HasValue Multiline Disabled'= 'Form Multi HasValue Multiline Disabled',
'Form Multi HasValue Multiline ReadOnly'= 'Form Multi HasValue Multiline ReadOnly',
// Form > Multi > HasValue > Overflow
'Form Multi HasValue Overflow'= 'Form Multi HasValue Overflow',
'Form Multi HasValue Overflow Invalid'= 'Form Multi HasValue Overflow Invalid',
'Form Multi HasValue Overflow Disabled'= 'Form Multi HasValue Overflow Disabled',
'Form Multi HasValue Overflow ReadOnly'= 'Form Multi HasValue Overflow ReadOnly',
/** INLINE */
// Inline > Single
'Inline Single'= 'Inline Single',
'Inline Single Disabled'= 'Inline Single Disabled',
'Inline Single ReadOnly'= 'Inline Single ReadOnly',
// Inline > Single > HasValue
'Inline Single HasValue'= 'Inline Single HasValue',
'Inline Single HasValue Disabled'= 'Inline Single HasValue Disabled',
'Inline Single HasValue ReadOnly'= 'Inline Single HasValue ReadOnly',
// Inline > Multi
'Inline Multi'= 'Inline Multi',
'Inline Multi Disabled'= 'Inline Multi Disabled',
'Inline Multi ReadOnly'= 'Inline Multi ReadOnly',
// Inline > Multi > HasValue
'Inline Multi HasValue'= 'Inline Multi HasValue',
'Inline Multi HasValue Disabled'= 'Inline Multi HasValue Disabled',
'Inline Multi HasValue ReadOnly'= 'Inline Multi HasValue ReadOnly',
// Inline > Multi > HasValue > MultiLine
'Inline Multi HasValue MultiLine'= 'Inline Multi HasValue MultiLine',
'Inline Multi HasValue MultiLine Disabled'= 'Inline Multi HasValue MultiLine Disabled ',
'Inline Multi HasValue MultiLine ReadOnly'= 'Inline Multi HasValue MultiLine ReadOnly',
// Inline > Multi > HasValue > Overflow
'Inline Multi HasValue Overflow'= 'Inline Multi HasValue Overflow',
'Inline Multi HasValue Overflow Disabled'= 'Inline Multi HasValue Overflow Disabled',
'Inline Multi HasValue Overflow ReadOnly'= 'Inline Multi HasValue Overflow ReadOnly',
// Opened > Dropdown
'Opened Dropdown Form List' = 'Opened Dropdown Form List',
'Opened Dropdown Form Multi List' = 'Opened Dropdown Form Multi List',
'Opened Dropdown Form Tree' = 'Opened Dropdown Form Tree',
'Opened Dropdown Form Multi Tree' = 'Opened Dropdown Form Multi Tree'
}
Loading

0 comments on commit 03ff2a0

Please sign in to comment.