Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
fix: update tests
  • Loading branch information
Alessandro Bellesia committed Jun 4, 2024
1 parent fcb3b7b commit 6aef2f2
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/components/VvNav/VvNavItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<template>
<li class="vv-nav__item" role="presentation">
<VvAction v-bind="$attrs" class="vv-nav__item-label">
<VvAction v-bind="$attrs" class="vv-nav__item-label" role="menuitem">
<slot />
</VvAction>
</li>
Expand Down
6 changes: 3 additions & 3 deletions src/composables/alert/useAlert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
DEFAULT_ALERT_INFO_ICON,
DefaultAlertIconMap,
} from '@/constants'
import type { Alert, AlertModifier } from '@/types/alert'
import type { Alert } from '@/types/alert'

type AlertInGroup = Alert & { timestamp: number; group: string }

Expand Down Expand Up @@ -59,8 +59,8 @@ export const useAlert = () => {

if (!icon) {
const alertModifier = normalizedModifiers.find((modifier) =>
DefaultAlertIconMap.has(modifier as AlertModifier),
) as AlertModifier | undefined
DefaultAlertIconMap.has(modifier),
)

if (alertModifier) {
icon = DefaultAlertIconMap.get(alertModifier) as string
Expand Down
4 changes: 2 additions & 2 deletions src/stories/AlertGroup/AlertGroup.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { PlayAttributes } from '@/test/types'
import { expect } from '@/test/expect'
import { within } from '@storybook/test'
import { userEvent, within } from '@storybook/test'

export async function defaultTest({ canvasElement, args }: PlayAttributes) {
const element = await within(canvasElement).findByTestId('element')
Expand Down Expand Up @@ -75,7 +75,7 @@ export async function defaultTest({ canvasElement, args }: PlayAttributes) {
// click every button child and expect to have alert with correct css class
for (const element of buttons.children) {
const button = element as HTMLElement
button.click()
await userEvent.click(button)
expect(alertGroupList.lastElementChild).toHaveClass(
`vv-alert--${button.id}`,
)
Expand Down
2 changes: 1 addition & 1 deletion src/stories/Badge/Badge.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const Default: Story = {
return { args }
},
template: /*html*/ `
<vv-badge v-bind="args">
<vv-badge v-bind="args" data-testId="element">
<template #default v-if="args.default"><span v-html="args.default"></span></template>
</vv-badge>
`,
Expand Down
2 changes: 1 addition & 1 deletion src/stories/Badge/Badge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { within } from '@storybook/test'
import { expect } from '@/test/expect'

export const defaultTest = async ({ canvasElement, args }: PlayAttributes) => {
const badge = await within(canvasElement).findByRole('status')
const badge = await within(canvasElement).findByTestId('element')
expect(badge).toHaveClass('vv-badge')
if (args.modifiers.length > 0) {
expect(badge).toHaveClass(`vv-badge--${args.modifiers}`)
Expand Down

0 comments on commit 6aef2f2

Please sign in to comment.