Files
web/packages/design-system/lib/components/Link/Link.stories.tsx
Joakim Jäderberg c54c1ec540 Merged in SW-3270-move-interactive-map-to-design-system-or-booking-flow (pull request #2681)
SW-3270 move interactive map to design system or booking flow

* wip

* wip

* merge

* wip

* add support for locales in design-system

* add story for HotelCard

* setup alias

* .

* remove tracking from design-system for hotelcard

* pass isUserLoggedIn

* export design-system-new-deprecated.css from design-system

* Add HotelMarkerByType to Storybook

* Add interactive map to Storybook

* fix reactintl in vitest

* rename env variables

* .

* fix background colors

* add storybook stories for <Link />

* merge

* fix tracking for when clicking 'See rooms' in InteractiveMap

* Merge branch 'master' of bitbucket.org:scandic-swap/web into SW-3270-move-interactive-map-to-design-system-or-booking-flow

* remove deprecated comment


Approved-by: Anton Gunnarsson
2025-08-25 11:26:16 +00:00

72 lines
1.6 KiB
TypeScript

import type { Meta, StoryObj } from '@storybook/nextjs-vite'
import { expect } from 'storybook/test'
import Link from '.'
const meta: Meta<typeof Link> = {
title: 'Components/Link',
component: Link,
argTypes: {
size: {
control: 'select',
options: ['small', 'regular', 'tiny', 'none'],
},
scroll: {
table: {
disable: true,
},
},
prefetch: {
table: {
disable: true,
},
},
partialMatch: {
table: {
disable: true,
},
},
},
}
export default meta
type Story = StoryObj<typeof Link>
export const Default: Story = {
args: {
active: false,
href: 'https://www.scandichotels.com/en',
},
render: (args) => <Link {...args}>{args.href}</Link>,
play: async ({ canvasElement }) => {
const link = canvasElement.querySelector('a')
if (!link) throw new Error('Link not found')
expect(link).toBeInTheDocument()
},
}
export const Focused: Story = {
args: {
...Default.args,
},
render: Default.render,
play: async ({ canvasElement }) => {
const link = canvasElement.querySelector('a')
if (!link) throw new Error('Link not found')
expect(link).toBeInTheDocument()
expect(link).not.toHaveFocus()
let styles = getComputedStyle(link)
expect(styles.outlineStyle).toBe('none')
expect(parseFloat(styles.outlineWidth)).toBe(0)
link?.focus()
expect(link).toHaveFocus()
styles = getComputedStyle(link)
expect(styles.outlineStyle).not.toBe('none')
expect(parseFloat(styles.outlineWidth)).toBeGreaterThan(0)
},
}