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: add a11y tests to showcases #2581

Merged
merged 44 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
ea9dc54
test: add a11y tests to showcases
nmerget Apr 25, 2024
a9814c5
test: a11y test showcase only watch main
nmerget Apr 25, 2024
fc81c02
test: add test for home screen
nmerget Apr 25, 2024
5cec4ad
fix: a11y issues for notification and tab-item
nmerget Apr 26, 2024
0690fb6
fix: issue with ts miss match
nmerget Apr 26, 2024
3e42967
fix: issues with a11y tests in showcases
nmerget Apr 26, 2024
f0bc30d
fix: issues with a11y tests in showcases
nmerget Apr 26, 2024
2f4bccf
fix: try to fix issues with a11y tests
nmerget Apr 26, 2024
65b9bfd
fix: some playwright issues
nmerget Apr 29, 2024
0b74d00
fix: skip test for angular
nmerget Apr 29, 2024
b0fa322
fix: skip test for angular
nmerget Apr 29, 2024
04695d4
fix: issues with wrong notification heading
nmerget Apr 30, 2024
09bbea3
chore: update snapshots
nmerget Apr 30, 2024
7c55780
chore: update snapshots
nmerget Apr 30, 2024
a4d4421
fix: issue with vue showcase for popover
nmerget Apr 30, 2024
59e172b
chore: add additional e2e tests for showcases
nmerget Apr 30, 2024
11fa42a
Merge branch 'main' of github.com:db-ui/mono into test-a11y-showcases
nmerget Apr 30, 2024
ad9936a
chore: update from main
nmerget Apr 30, 2024
8e6d4fd
Merge branch 'main' of github.com:db-ui/mono into test-a11y-showcases
nmerget Apr 30, 2024
46d09a4
fix: a11y issue for navigation
nmerget Apr 30, 2024
4434539
fix: a11y issue for tabs
nmerget May 2, 2024
164589f
chore: update snapshots
nmerget May 2, 2024
610475f
chore: update e2e tests for drawer
nmerget May 2, 2024
12d185f
chore: update e2e tests for a11y
nmerget May 2, 2024
f02db20
Merge branch 'main' into test-a11y-showcases
mfranzke May 6, 2024
120b038
Merge branch 'main' of github.com:db-ui/mono into test-a11y-showcases
nmerget May 10, 2024
3ce76ce
chore: update from main
nmerget May 10, 2024
cd45061
chore: update snapshots
nmerget May 10, 2024
3f1d264
Merge remote-tracking branch 'origin/test-a11y-showcases' into test-a…
nmerget May 10, 2024
8631a4b
Merge branch 'main' into test-a11y-showcases
mfranzke May 13, 2024
fe2ff5d
Update showcases/e2e/fixtures/hover.ts
nmerget May 13, 2024
ab3e7a0
Update packages/components/src/components/tooltip/tooltip.scss
nmerget May 13, 2024
d3280d2
Update packages/components/src/components/popover/popover.scss
nmerget May 13, 2024
6c7ce80
Update packages/components/src/components/tabs/tabs.spec.tsx
nmerget May 13, 2024
42959e0
Update showcase-tab-item.spec.ts
mfranzke May 13, 2024
b415400
Update showcase-tabs.spec.ts
mfranzke May 13, 2024
3ecd826
Update showcases/e2e/home/showcase-home.spec.ts
nmerget May 13, 2024
eef5b6b
fix: issue from PR
nmerget May 13, 2024
411fda3
feat: add aria and data passing for angular
nmerget May 13, 2024
381659d
fix: issue with vue header showcase test
nmerget May 13, 2024
bc152d0
test: disable mask to test screenshots´issues
nmerget May 13, 2024
1fb71df
fix: issues with angular
nmerget May 14, 2024
d13bd72
Merge branch 'main' of github.com:db-ui/mono into test-a11y-showcases
nmerget May 14, 2024
850da4f
fix: issues with angular showcase
nmerget May 14, 2024
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
4 changes: 2 additions & 2 deletions .github/workflows/02-e2e-showcases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
fail-fast: false
matrix:
framework: [angular, react, vue]
shardIndex: [1, 2]
shardTotal: [2]
shardIndex: [1, 2, 3, 4, 5]
shardTotal: [5]
steps:
- name: ⏬ Checkout repo
uses: actions/checkout@v4
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
1 change: 0 additions & 1 deletion output/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"tsc": "tsc -p . --sourceMap false"
},
"devDependencies": {
"@axe-core/playwright": "^4.8.5",
"@playwright/experimental-ct-react": "1.44.0",
"@types/react": "^18.3.2",
"react": "^18.3.1",
Expand Down
1 change: 0 additions & 1 deletion output/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"vue": "^3.4.27"
},
"devDependencies": {
"@axe-core/playwright": "^4.8.5",
"@playwright/experimental-ct-vue": "1.44.0",
"@vitejs/plugin-vue": "^5.0.4",
"sass": "^1.77.1",
Expand Down
3 changes: 1 addition & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"update:icon-fonts": "npm run update:icon-fonts --workspace=scripts"
},
"devDependencies": {
"@axe-core/playwright": "^4.9.0",
"@commitlint/cli": "19.3.0",
"@commitlint/config-conventional": "19.2.2",
"@playwright/test": "1.44.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ import { test } from '@playwright/test';
import { getDefaultScreenshotTest } from '../default.ts';

test.describe('DB<%= h.changeCase.pascal(name) %>', () => {
getDefaultScreenshotTest('<%= name %>');
getDefaultScreenshotTest({ path: '<%= name %>' });
});

26 changes: 26 additions & 0 deletions packages/components/scripts/post-build/angular.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,26 @@ export class ${directive.name}Directive {}
});
};

const getAttributePassing = (componentName) => `
ngAfterViewInit(): void {
\t\tconst element: HTMLElement | null = this.ref?.nativeElement;
\t\tconst parent = element?.closest('db-${componentName}') ?? element?.closest('db${componentName.replaceAll('-', '')}');
\t\tif (element && parent) {
\t\t\tconst attributes = parent.attributes;
\t\t\tfor (let i = 0; i < attributes.length; i++) {
\t\t\t\tconst attr = attributes.item(i);
\t\t\t\tif (
\t\t\t\t\tattr &&
\t\t\t\t\t(attr.name.startsWith('data-') ||
\t\t\t\t\t\tattr.name.startsWith('aria-'))
\t\t\t\t) {
\t\t\t\t\telement.setAttribute(attr.name, attr.value);
\t\t\t\t\tparent.removeAttribute(attr.name);
\t\t\t\t}
\t\t\t}
\t\t}
\t}`;

module.exports = (tmp) => {
const outputFolder = `${tmp ? 'output/tmp' : 'output'}`;
// Activate vue specific event handling
Expand Down Expand Up @@ -212,6 +232,12 @@ module.exports = (tmp) => {
{
from: 'mouseMove',
to: 'mousemove'
},
{
from: '@ViewChild("ref") ref!: ElementRef | undefined;',
to:
'@ViewChild("ref") ref!: ElementRef | undefined;' +
getAttributePassing(component.name)
}
];

Expand Down
18 changes: 5 additions & 13 deletions packages/components/scripts/post-build/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,16 @@ const getComponents = () => [
},

{
name: 'tab-panel',
config: {
angular: {
initValues: [
{ key: 'name', value: '' },
{ key: 'index', value: 0 }
]
}
}
name: 'tab-panel'
},
{
name: 'tab-item',
config: {
vue: {
vModel: [{ modelValue: 'checked', binding: ':checked' }]
},
angular: {
initValues: [
{ key: 'name', value: '' },
{ key: 'index', value: 0 }
]
controlValueAccessor: 'checked'
}
}
},
Expand Down
10 changes: 8 additions & 2 deletions packages/components/src/components/navigation/model.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import { GlobalProps, GlobalState } from '../../shared/model';
import {
AriaLabelledByProps,
GlobalProps,
GlobalState
} from '../../shared/model';

export interface DBNavigationDefaultProps {}

export type DBNavigationProps = DBNavigationDefaultProps & GlobalProps;
export type DBNavigationProps = DBNavigationDefaultProps &
GlobalProps &
AriaLabelledByProps;

export interface DBNavigationDefaultState {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export default function DBNavigation(props: DBNavigationProps) {
<nav
ref={ref}
id={state._id}
aria-labelledby={props.labelledBy}
class={cls('db-navigation', props.className)}>
<menu>{props.children}</menu>
</nav>
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/components/notification/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export interface DBNotificationDefaultProps {
/**
* The headline attribute changes the text of the bold headline.
*/
headline?: string;
headline?: string | any;

/**
* The linkVariant will be used if slotLink is set.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}

// 2. headline
&:has(h6) {
&:has(header) {
grid-template-columns: 1fr;
grid-template-areas:
"head"
Expand All @@ -35,7 +35,7 @@
grid-template-areas: "icon content close";
}

&:has(h6) {
&:has(header) {
grid-template-columns: min-content 1fr;
grid-template-areas:
"icon head"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
}

// 2. headline
&:has(h6) {
&:has(header) {
grid-template-columns: 1fr;
grid-template-areas:
"head"
Expand All @@ -45,7 +45,7 @@
"icon link";
grid-template-columns: min-content 1fr;

&:has(h6) {
&:has(header) {
grid-template-columns: min-content 1fr;
grid-template-areas:
"icon head"
Expand Down Expand Up @@ -74,7 +74,7 @@
}

// 2. headline
&:has(h6) {
&:has(header) {
grid-template-columns: 1fr min-content;
grid-template-areas:
"head link"
Expand All @@ -100,7 +100,7 @@
grid-template-areas: "icon content link close";
}

&:has(h6) {
&:has(header) {
grid-template-columns: min-content 1fr min-content;
grid-template-areas:
"icon head link"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}

// 2. headline
&:has(h6) {
&:has(header) {
grid-template-columns: 1fr min-content;
grid-template-areas:
"head timestamp"
Expand All @@ -41,7 +41,7 @@
grid-template-areas: "icon content timestamp close";
}

&:has(h6) {
&:has(header) {
grid-template-columns: min-content 1fr min-content;
grid-template-areas:
"icon head timestamp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function DBNotification(props: DBNotificationProps) {
// jscpd:ignore-end

return (
<div
<article
ref={ref}
id={props.id}
class={cls('db-notification', props.className)}
Expand All @@ -33,7 +33,7 @@ export default function DBNotification(props: DBNotificationProps) {
data-link-variant={props.linkVariant}>
<Slot name="image" />
<Show when={props.headline}>
<h6>{props.headline}</h6>
<header>{props.headline}</header>
mfranzke marked this conversation as resolved.
Show resolved Hide resolved
</Show>
<p>{props.children}</p>
<Show when={props.timestamp}>
Expand All @@ -55,6 +55,6 @@ export default function DBNotification(props: DBNotificationProps) {
{props.closeButtonText ?? DEFAULT_CLOSE_BUTTON}
</DBButton>
</Show>
</div>
</article>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
%ugly-line-height-workarounds {
// resets line-height to smaller height based on timestamp
&:has(span) {
h6,
header,
p,
&::before,
.db-button {
Expand Down Expand Up @@ -59,10 +59,28 @@
}

// headline
h6 {
font-family: var(--db-font-family-sans);
header {
grid-area: head;
margin: 0;
font-weight: 700;

&,
h1,
h2,
h3,
h4,
h5,
h6 {
font-family: var(--db-font-family-sans);
margin: 0;
line-height: var(--db-type-headline-line-height-2xs);
font-size: var(--db-type-headline-font-size-2xs);

&::before,
&::after {
--db-icon-font-size: var(--db-base-headline-icon-font-size-2xs);
--db-icon-font-weight: var(--db-base-headline-icon-weight-2xs);
}
}
}

// content
Expand Down
1 change: 0 additions & 1 deletion packages/components/src/components/page/page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
}

&[data-variant="fixed"] {

@include header-footer-style();
block-size: 100%;
min-block-size: 100%;
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/components/popover/popover.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
.db-popover {
position: relative;

&[data-e2e-hover="true"],
&:hover,
&:focus-within {
& > article {
Expand Down
26 changes: 19 additions & 7 deletions packages/components/src/components/tab-item/model.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import {
ActiveProps,
AriaControlsProps,
ChangeEventProps,
ChangeEventState,
GlobalProps,
GlobalState,
IconAfterProps,
Expand All @@ -8,29 +11,38 @@ import {
} from '../../shared/model';

export type DBTabItemDefaultProps = {
/**
* To control the component
*/
checked?: boolean;

/**
* The disabled attribute can be set to keep a user from clicking on the tab-item.
*/
disabled?: boolean;
/**
* The label of the tab-item, if you don't want to use children.
*/
label?: string;

/**
* Define the text next to the icon specified via the icon Property to get hidden.
*/
noText?: boolean;
/**
* The disabled attribute can be set to keep a user from clicking on the tab-item.
*/
disabled?: boolean;
};

export type DBTabItemProps = GlobalProps &
DBTabItemDefaultProps &
IconProps &
IconAfterProps &
ActiveProps;
ActiveProps &
AriaControlsProps &
ChangeEventProps<HTMLInputElement>;

export type DBTabItemDefaultState = {};
export type DBTabItemDefaultState = {
_selected: boolean;
};

export type DBTabItemState = DBTabItemDefaultState &
GlobalState &
ChangeEventState<HTMLInputElement> &
InitializedState;
Loading
Loading