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

test vrt #33703

Open
wants to merge 7 commits into
base: vrt-gha-testing
Choose a base branch
from
Open

test vrt #33703

Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .github/workflows/pr-vrt-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:

- name: VR App - Create Policy
run: |
echo "MAKE THIS WORK"
echo "MAKE THIS WORK TEST"

- name: Run screenshotdiff
run: |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import * as React from 'react';
import type { Meta } from '@storybook/react';
import { Steps } from 'storywright';
import {
DataGrid,
DataGridBody,
DataGridCell,
DataGridHeader,
DataGridHeaderCell,
DataGridRow,
} from '@fluentui/react-table';
import { withStoryWrightSteps } from '../../utilities';
import { columns, items, type Item } from './utils';

export default {
title: 'DataGridConverged - subtle multi select',

decorators: [
story =>
withStoryWrightSteps({
story,
steps: new Steps()
.hover('.fui-DataGridHeader > .fui-DataGridRow')
.snapshot('hover header row')
.hover('.fui-DataGridBody > .fui-DataGridRow')
.snapshot('hover row')
.end(),
}),
],
} satisfies Meta<typeof DataGrid>;

export const Default = () => {
return (
<DataGrid
items={items}
columns={columns}
sortable
selectionMode="multiselect"
subtleSelection
// eslint-disable-next-line react/jsx-no-bind
getRowId={(item: Item) => item.file.label}
focusMode="composite"
style={{ minWidth: '550px' }}
>
<DataGridHeader>
<DataGridRow selectionCell={{ checkboxIndicator: { 'aria-label': 'Select all rows' } }}>
{({ renderHeaderCell }) => <DataGridHeaderCell>{renderHeaderCell()}</DataGridHeaderCell>}
</DataGridRow>
</DataGridHeader>
<DataGridBody<Item>>
{({ item, rowId }) => (
<DataGridRow<Item> key={rowId} selectionCell={{ checkboxIndicator: { 'aria-label': 'Select row' } }}>
{({ renderCell }) => <DataGridCell>{renderCell(item)}</DataGridCell>}
</DataGridRow>
)}
</DataGridBody>
</DataGrid>
);
};
Default.storyName = 'default';
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import * as React from 'react';
import type { Meta } from '@storybook/react';
import { Steps } from 'storywright';
import {
DataGrid,
DataGridBody,
DataGridCell,
DataGridHeader,
DataGridHeaderCell,
DataGridRow,
} from '@fluentui/react-table';
import { withStoryWrightSteps } from '../../utilities';
import { columns, items, type Item } from './utils';

export default {
title: 'DataGridConverged - subtle single select',

decorators: [
story =>
withStoryWrightSteps({
story,
steps: new Steps()
.hover('.fui-DataGridHeader > .fui-DataGridRow')
.snapshot('hover header row')
.hover('.fui-DataGridBody > .fui-DataGridRow')
.snapshot('hover row')
.end(),
}),
],
} satisfies Meta<typeof DataGrid>;

export const Default = () => {
return (
<DataGrid
items={items}
columns={columns}
sortable
selectionMode="single"
subtleSelection
// eslint-disable-next-line react/jsx-no-bind
getRowId={(item: Item) => item.file.label}
focusMode="composite"
style={{ minWidth: '550px' }}
>
<DataGridHeader>
<DataGridRow selectionCell={{ checkboxIndicator: { 'aria-label': 'Select all rows' } }}>
{({ renderHeaderCell }) => <DataGridHeaderCell>{renderHeaderCell()}</DataGridHeaderCell>}
</DataGridRow>
</DataGridHeader>
<DataGridBody<Item>>
{({ item, rowId }) => (
<DataGridRow<Item> key={rowId} selectionCell={{ checkboxIndicator: { 'aria-label': 'Select row' } }}>
{({ renderCell }) => <DataGridCell>{renderCell(item)}</DataGridCell>}
</DataGridRow>
)}
</DataGridBody>
</DataGrid>
);
};
Default.storyName = 'default';
140 changes: 140 additions & 0 deletions apps/vr-tests-react-components/src/stories/DataGrid/utils.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
import * as React from 'react';
import { PresenceBadgeStatus } from '@fluentui/react-badge';
import { createTableColumn, TableColumnDefinition } from '@fluentui/react-table';
import {
DocumentPdfRegular,
DocumentRegular,
EditRegular,
FolderRegular,
OpenRegular,
PeopleRegular,
VideoRegular,
} from '@fluentui/react-icons';
import { TableCellLayout } from '@fluentui/react-table';
import { Avatar } from '@fluentui/react-avatar';

type FileCell = {
label: string;
icon: JSX.Element;
};

type LastUpdatedCell = {
label: string;
timestamp: number;
};

type LastUpdateCell = {
label: string;
icon: JSX.Element;
};

type AuthorCell = {
label: string;
status: PresenceBadgeStatus;
};

export type Item = {
file: FileCell;
author: AuthorCell;
lastUpdated: LastUpdatedCell;
lastUpdate: LastUpdateCell;
};

export const items: Item[] = [
{
file: { label: 'Meeting notes', icon: <DocumentRegular /> },
author: { label: 'Max Mustermann', status: 'available' },
lastUpdated: { label: '7h ago', timestamp: 3 },
lastUpdate: {
label: 'You edited this',
icon: <EditRegular />,
},
},
{
file: { label: 'Thursday presentation', icon: <FolderRegular /> },
author: { label: 'Erika Mustermann', status: 'busy' },
lastUpdated: { label: 'Yesterday at 1:45 PM', timestamp: 2 },
lastUpdate: {
label: 'You recently opened this',
icon: <OpenRegular />,
},
},
{
file: { label: 'Training recording', icon: <VideoRegular /> },
author: { label: 'John Doe', status: 'away' },
lastUpdated: { label: 'Yesterday at 1:45 PM', timestamp: 2 },
lastUpdate: {
label: 'You recently opened this',
icon: <OpenRegular />,
},
},
{
file: { label: 'Purchase order', icon: <DocumentPdfRegular /> },
author: { label: 'Jane Doe', status: 'offline' },
lastUpdated: { label: 'Tue at 9:30 AM', timestamp: 1 },
lastUpdate: {
label: 'You shared this in a Teams chat',
icon: <PeopleRegular />,
},
},
];

export const columns: TableColumnDefinition<Item>[] = [
createTableColumn<Item>({
columnId: 'file',
compare: (a, b) => {
return a.file.label.localeCompare(b.file.label);
},
renderHeaderCell: () => {
return 'File';
},
renderCell: item => {
return <TableCellLayout media={item.file.icon}>{item.file.label}</TableCellLayout>;
},
}),
createTableColumn<Item>({
columnId: 'author',
compare: (a, b) => {
return a.author.label.localeCompare(b.author.label);
},
renderHeaderCell: () => {
return 'Author';
},
renderCell: item => {
return (
<TableCellLayout
media={
<Avatar aria-label={item.author.label} name={item.author.label} badge={{ status: item.author.status }} />
}
>
{item.author.label}
</TableCellLayout>
);
},
}),
createTableColumn<Item>({
columnId: 'lastUpdated',
compare: (a, b) => {
return a.lastUpdated.timestamp - b.lastUpdated.timestamp;
},
renderHeaderCell: () => {
return 'Last updated';
},

renderCell: item => {
return item.lastUpdated.label;
},
}),
createTableColumn<Item>({
columnId: 'lastUpdate',
compare: (a, b) => {
return a.lastUpdate.label.localeCompare(b.lastUpdate.label);
},
renderHeaderCell: () => {
return 'Last update';
},
renderCell: item => {
return <TableCellLayout media={item.lastUpdate.icon}>{item.lastUpdate.label}</TableCellLayout>;
},
}),
];
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@fluentui/fluentui-repo",
"version": "1.0.0",
"description": "Reusable React components for building experiences for Microsoft 365.",
"description": "Reusable React components for test building experiences for Microsoft 365.",
"private": true,
"repository": {
"type": "git",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,20 @@ export const Carousel = () => (
<TeachingPopoverCarouselCard value="1">
<TeachingPopoverBody media={<Image alt="test image" fit="cover" src={swapImage} />}>
<TeachingPopoverTitle>Teaching Bubble Title</TeachingPopoverTitle>
<div>This is page: 1</div>
<div>This test page: 1</div>
</TeachingPopoverBody>
</TeachingPopoverCarouselCard>

<TeachingPopoverCarouselCard value="2">
<TeachingPopoverBody media={<Image alt="test image" fit="cover" src={swapImage} />}>
<TeachingPopoverTitle>Teaching Bubble Title</TeachingPopoverTitle>
<div>This is page: 2</div>
<div>This is page: test 2</div>
</TeachingPopoverBody>
</TeachingPopoverCarouselCard>

<TeachingPopoverCarouselCard value="3">
<TeachingPopoverCarouselCard value="9">
<TeachingPopoverBody media={<Image alt="test image" fit="cover" src={swapImage} />}>
<TeachingPopoverTitle>Teaching Bubble Title</TeachingPopoverTitle>
<TeachingPopoverTitle>Teaching Bubble 3 Title</TeachingPopoverTitle>
<div>This is page: 3</div>
</TeachingPopoverBody>
</TeachingPopoverCarouselCard>
Expand Down
Loading