@volverjs/ui-vue 0.0.1-beta.2 → 0.0.1-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,52 @@
1
+ import { expect } from '@storybook/jest'
2
+ import { userEvent } from '@storybook/testing-library'
3
+ import { axe } from 'jest-axe'
4
+
5
+ declare global {
6
+ // eslint-disable-next-line @typescript-eslint/no-namespace
7
+ namespace jest {
8
+ interface Matchers<R> {
9
+ toBeClicked: (expected?: HTMLElement) => CustomMatcherResult
10
+ }
11
+ interface Matchers<R> {
12
+ toHaveClass: (
13
+ className: string | string[],
14
+ expected?: HTMLElement
15
+ ) => CustomMatcherResult
16
+ }
17
+ }
18
+ }
19
+
20
+ expect.extend({
21
+ async toBeClicked(element: HTMLElement) {
22
+ const result = {
23
+ pass: false,
24
+ message: () => "Click event don't works"
25
+ }
26
+ element.addEventListener('click', () => {
27
+ result.pass = true
28
+ result.message = () => `Click event works`
29
+ })
30
+ await userEvent.click(element)
31
+ return result
32
+ },
33
+ async toHaveNoViolations(element: HTMLElement) {
34
+ const results = await axe(element)
35
+ return {
36
+ pass: results.violations.length === 0,
37
+ message: () => 'Element has violations'
38
+ }
39
+ },
40
+ async toHaveClass(element: HTMLElement, className: string | string[]) {
41
+ const classes = !Array.isArray(className) ? [className] : className
42
+ return {
43
+ pass: classes.every((cssClass) =>
44
+ element.classList.contains(cssClass)
45
+ ),
46
+ message: () =>
47
+ `One of these clsses doesn't exist: ${classes.join(', ')}`
48
+ }
49
+ }
50
+ })
51
+
52
+ export { expect }
@@ -0,0 +1,3 @@
1
+ export interface PlayAttributes {
2
+ canvasElement: HTMLElement
3
+ }