Skip to content

A games launcher for GOG, Amazon and Epic Games for Linux, Windows and macOS.

882 B
Raw Blame
import { expect } from 'storybook/test'
import type { Meta, StoryObj } from '@storybook/react-vite'

import BackButton from '.'

const meta = {
  title: 'Navigation/BackButton',
  component: BackButton,
  args: {
    to: '/',
    label: 'Back to library'
  }
} satisfies Meta<typeof BackButton>

export default meta

type Story = StoryObj<typeof meta>

export const Default: Story = {}

export const IconOnly: Story = {
  args: { iconOnly: true },
  play: async ({ canvas }) => {
    const link = canvas.getByRole('link', { name: 'Back to library' })
    await expect(link).toHaveAttribute('href', '/')
    await expect(canvas.queryByText('Back to library')).not.toBeInTheDocument()
  }
}

export const LinksToTheTarget: Story = {
  play: async ({ canvas }) => {
    await expect(
      canvas.getByRole('link', { name: 'Back to library' })
    ).toHaveAttribute('href', '/')
  }
}