1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-02 20:35:25 +02:00

chore(data-cy): require data-cy attributes [EE-6880] (#11453)
Some checks are pending
ci / build_images (map[arch:amd64 platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
ci / build_images (map[arch:arm platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:arm64 platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:ppc64le platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:s390x platform:linux version:]) (push) Waiting to run
ci / build_manifests (push) Blocked by required conditions
/ triage (push) Waiting to run
Lint / Run linters (push) Waiting to run
Test / test-client (push) Waiting to run
Test / test-server (map[arch:amd64 platform:linux]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
Test / test-server (map[arch:arm64 platform:linux]) (push) Waiting to run

This commit is contained in:
Ali 2024-04-11 12:11:38 +12:00 committed by GitHub
parent 3cad13388c
commit d38085a560
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
538 changed files with 2571 additions and 595 deletions

View file

@ -19,7 +19,14 @@ interface StoryProps {
}
function Template({ value, icon, type }: StoryProps) {
return <DashboardItem value={value} icon={icon} type={type} />;
return (
<DashboardItem
value={value}
icon={icon}
type={type}
dataCy="data-cy-example"
/>
);
}
export const Primary: Story<StoryProps> = Template.bind({});
@ -31,15 +38,25 @@ Primary.args = {
export function WithLink() {
return (
<Link to="example.page">
<DashboardItem value={1} icon={List} type="Example resource" />
<Link to="example.page" data-cy="data-cy-example">
<DashboardItem
value={1}
icon={List}
type="Example resource"
dataCy="data-cy-example"
/>
</Link>
);
}
export function WithChildren() {
return (
<DashboardItem value={1} icon={List} type="Example resource">
<DashboardItem
value={1}
icon={List}
type="Example resource"
dataCy="data-cy-example"
>
<div>Children</div>
</DashboardItem>
);

View file

@ -26,5 +26,7 @@ test('should have accessibility label created from the provided resource type',
});
function renderComponent(value = 0, icon = User, type = '') {
return render(<DashboardItem value={value} icon={icon} type={type} />);
return render(
<DashboardItem value={value} icon={icon} type={type} dataCy="example" />
);
}

View file

@ -16,7 +16,7 @@ interface Props extends IconProps {
to?: string;
params?: object;
children?: ReactNode;
dataCy?: string;
dataCy: string;
}
export function DashboardItem({
@ -103,7 +103,12 @@ export function DashboardItem({
if (to) {
return (
<Link to={to} className="!no-underline" params={params}>
<Link
to={to}
className="!no-underline"
params={params}
data-cy={`${dataCy}-link`}
>
{Item}
</Link>
);