Skip to content

Commit c700408

Browse files
committed
Update stories
1 parent 2e326fb commit c700408

12 files changed

Lines changed: 40 additions & 124 deletions

packages/react/src/MinimalFooter/MinimalFooter.features.stories.tsx

Lines changed: 22 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import React from 'react'
22
import type {Meta, StoryObj} from '@storybook/react'
33
import {CheckCircleFillIcon} from '@primer/octicons-react'
4-
import {expect, userEvent, within} from 'storybook/test'
4+
import {expect, within} from 'storybook/test'
55
import {MinimalFooter} from '.'
66
import {InlineLink, Text, ThemeProvider, Token} from '..'
7+
import {RedlineBackground} from '../component-helpers'
78

89
export default {
910
title: 'Components/MinimalFooter/Features',
@@ -99,7 +100,7 @@ export const ReversedSocialLinks: Story = {
99100
}
100101

101102
export const DefaultNarrow: Story = {
102-
name: 'Default (Narrow viewport)',
103+
name: 'Default, narrow view (mobile)',
103104
globals: {
104105
viewport: {value: 'iphonexr'},
105106
},
@@ -165,57 +166,16 @@ export const CustomContent: Story = {
165166

166167
export const BackToTop: Story = {
167168
render: () => (
168-
<MinimalFooter>
169-
<MinimalFooter.BackToTop>Back to top</MinimalFooter.BackToTop>
170-
</MinimalFooter>
171-
),
172-
}
173-
174-
export const BackToTopHover: Story = {
175-
render: () => (
176-
<MinimalFooter>
177-
<MinimalFooter.BackToTop>Back to top</MinimalFooter.BackToTop>
178-
</MinimalFooter>
179-
),
180-
play: async ({canvasElement}) => {
181-
const button = within(canvasElement).getByRole('button', {name: 'Back to top'})
182-
await userEvent.hover(button)
183-
expect(button.matches(':hover')).toBe(true)
184-
},
185-
}
186-
187-
export const BackToTopFocusVisible: Story = {
188-
render: () => (
189-
<MinimalFooter>
190-
<MinimalFooter.BackToTop>Back to top</MinimalFooter.BackToTop>
191-
</MinimalFooter>
192-
),
193-
play: async ({canvasElement}) => {
194-
const button = within(canvasElement).getByRole('button', {name: 'Back to top'})
195-
button.focus()
196-
expect(button).toHaveFocus()
197-
expect(button.matches(':focus-visible')).toBe(true)
198-
},
199-
}
200-
201-
export const BackToTopDisabled: Story = {
202-
render: () => (
203-
<MinimalFooter>
204-
<MinimalFooter.BackToTop disabled>Back to top</MinimalFooter.BackToTop>
205-
</MinimalFooter>
206-
),
207-
play: async ({canvasElement}) => {
208-
expect(within(canvasElement).getByRole('button', {name: 'Back to top'})).toBeDisabled()
209-
},
210-
}
211-
212-
export const BackToTopDark: Story = {
213-
render: () => (
214-
<ThemeProvider colorMode="dark">
169+
<main>
170+
<RedlineBackground style={{height: '120vh'}}>
171+
<Text as="p" align="center" weight="semibold">
172+
Scroll down to test the back-to-top functionality
173+
</Text>
174+
</RedlineBackground>
215175
<MinimalFooter>
216176
<MinimalFooter.BackToTop>Back to top</MinimalFooter.BackToTop>
217177
</MinimalFooter>
218-
</ThemeProvider>
178+
</main>
219179
),
220180
}
221181

@@ -247,34 +207,34 @@ const ResponsiveExample = ({socialLinks = true}: {socialLinks?: boolean}) => (
247207
</MinimalFooter>
248208
)
249209

250-
export const ResponsiveMedium: Story = {
251-
name: 'Responsive medium (834px)',
210+
export const NarrowView: Story = {
211+
name: 'Narrow view (mobile)',
252212
globals: {
253-
viewport: {value: 'ipad10p'},
213+
viewport: {value: 'iphonexr'},
254214
},
255215
render: () => <ResponsiveExample />,
256216
}
257217

258-
export const ResponsiveSmall: Story = {
259-
name: 'Responsive small (390px)',
218+
export const RegularView: Story = {
219+
name: 'Regular view (tablet)',
260220
globals: {
261-
viewport: {value: 'iphone12'},
221+
viewport: {value: 'ipad10p'},
262222
},
263223
render: () => <ResponsiveExample />,
264224
}
265225

266-
export const ResponsiveMediumNoSocialLinks: Story = {
267-
name: 'Responsive medium, no social links (834px)',
226+
export const NarrowViewNoSocialLinks: Story = {
227+
name: 'Narrow view, no social links (mobile)',
268228
globals: {
269-
viewport: {value: 'ipad10p'},
229+
viewport: {value: 'iphonexr'},
270230
},
271231
render: () => <ResponsiveExample socialLinks={false} />,
272232
}
273233

274-
export const ResponsiveSmallNoSocialLinks: Story = {
275-
name: 'Responsive small, no social links (390px)',
234+
export const RegularViewNoSocialLinks: Story = {
235+
name: 'Regular view, no social links (tablet)',
276236
globals: {
277-
viewport: {value: 'iphone12'},
237+
viewport: {value: 'ipad10p'},
278238
},
279239
render: () => <ResponsiveExample socialLinks={false} />,
280240
}

packages/react/src/MinimalFooter/MinimalFooter.visual.spec.ts

Lines changed: 18 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ test.describe('Visual Comparison: MinimalFooter', () => {
9494
})
9595

9696
// eslint-disable-next-line i18n-text/no-en
97-
test.describe('Mobile viewport test for Default (Narrow viewport)', () => {
97+
test.describe('Mobile viewport test for Default, narrow view (mobile)', () => {
9898
test.use({viewport: {width: 360, height: 800}})
99-
test('MinimalFooter / Default (Narrow viewport)', async ({page}) => {
99+
test('MinimalFooter / Default, narrow view (mobile)', async ({page}) => {
100100
await page.goto(
101101
'http://localhost:6006/iframe.html?args=&id=components-minimalfooter-features--default-narrow&viewMode=story',
102102
{waitUntil: 'networkidle'},
@@ -140,56 +140,12 @@ test.describe('Visual Comparison: MinimalFooter', () => {
140140
await expect(page).toHaveScreenshot({fullPage: true})
141141
})
142142

143-
test('MinimalFooter / Back To Top Hover', async ({page}) => {
144-
await page.goto(
145-
'http://localhost:6006/iframe.html?args=&id=components-minimalfooter-features--back-to-top-hover&viewMode=story',
146-
{waitUntil: 'networkidle'},
147-
)
148-
await page.locator('body.sb-show-main').waitFor({state: 'visible'})
149-
150-
await page.waitForTimeout(500)
151-
await expect(page).toHaveScreenshot({fullPage: true})
152-
})
153-
154-
test('MinimalFooter / Back To Top Focus Visible', async ({page}) => {
155-
await page.goto(
156-
'http://localhost:6006/iframe.html?args=&id=components-minimalfooter-features--back-to-top-focus-visible&viewMode=story',
157-
{waitUntil: 'networkidle'},
158-
)
159-
await page.locator('body.sb-show-main').waitFor({state: 'visible'})
160-
161-
await page.waitForTimeout(500)
162-
await expect(page).toHaveScreenshot({fullPage: true})
163-
})
164-
165-
test('MinimalFooter / Back To Top Disabled', async ({page}) => {
166-
await page.goto(
167-
'http://localhost:6006/iframe.html?args=&id=components-minimalfooter-features--back-to-top-disabled&viewMode=story',
168-
{waitUntil: 'networkidle'},
169-
)
170-
await page.locator('body.sb-show-main').waitFor({state: 'visible'})
171-
172-
await page.waitForTimeout(500)
173-
await expect(page).toHaveScreenshot({fullPage: true})
174-
})
175-
176-
test('MinimalFooter / Back To Top Dark', async ({page}) => {
177-
await page.goto(
178-
'http://localhost:6006/iframe.html?args=&id=components-minimalfooter-features--back-to-top-dark&viewMode=story',
179-
{waitUntil: 'networkidle'},
180-
)
181-
await page.locator('body.sb-show-main').waitFor({state: 'visible'})
182-
183-
await page.waitForTimeout(500)
184-
await expect(page).toHaveScreenshot({fullPage: true})
185-
})
186-
187143
// eslint-disable-next-line i18n-text/no-en
188-
test.describe('Fixed viewport test for Responsive medium (834px)', () => {
189-
test.use({viewport: {width: 834, height: 900}})
190-
test('MinimalFooter / Responsive medium (834px)', async ({page}) => {
144+
test.describe('Mobile viewport test for Narrow view (mobile)', () => {
145+
test.use({viewport: {width: 360, height: 800}})
146+
test('MinimalFooter / Narrow view (mobile)', async ({page}) => {
191147
await page.goto(
192-
'http://localhost:6006/iframe.html?args=&id=components-minimalfooter-features--responsive-medium&viewMode=story',
148+
'http://localhost:6006/iframe.html?args=&id=components-minimalfooter-features--narrow-view&viewMode=story',
193149
{waitUntil: 'networkidle'},
194150
)
195151
await page.locator('body.sb-show-main').waitFor({state: 'visible'})
@@ -200,11 +156,11 @@ test.describe('Visual Comparison: MinimalFooter', () => {
200156
})
201157

202158
// eslint-disable-next-line i18n-text/no-en
203-
test.describe('Fixed viewport test for Responsive small (390px)', () => {
204-
test.use({viewport: {width: 390, height: 900}})
205-
test('MinimalFooter / Responsive small (390px)', async ({page}) => {
159+
test.describe('Tablet viewport test for Regular view (tablet)', () => {
160+
test.use({viewport: {width: 834, height: 1112}})
161+
test('MinimalFooter / Regular view (tablet)', async ({page}) => {
206162
await page.goto(
207-
'http://localhost:6006/iframe.html?args=&id=components-minimalfooter-features--responsive-small&viewMode=story',
163+
'http://localhost:6006/iframe.html?args=&id=components-minimalfooter-features--regular-view&viewMode=story',
208164
{waitUntil: 'networkidle'},
209165
)
210166
await page.locator('body.sb-show-main').waitFor({state: 'visible'})
@@ -215,11 +171,11 @@ test.describe('Visual Comparison: MinimalFooter', () => {
215171
})
216172

217173
// eslint-disable-next-line i18n-text/no-en
218-
test.describe('Fixed viewport test for Responsive medium, no social links (834px)', () => {
219-
test.use({viewport: {width: 834, height: 900}})
220-
test('MinimalFooter / Responsive medium, no social links (834px)', async ({page}) => {
174+
test.describe('Mobile viewport test for Narrow view, no social links (mobile)', () => {
175+
test.use({viewport: {width: 360, height: 800}})
176+
test('MinimalFooter / Narrow view, no social links (mobile)', async ({page}) => {
221177
await page.goto(
222-
'http://localhost:6006/iframe.html?args=&id=components-minimalfooter-features--responsive-medium-no-social-links&viewMode=story',
178+
'http://localhost:6006/iframe.html?args=&id=components-minimalfooter-features--narrow-view-no-social-links&viewMode=story',
223179
{waitUntil: 'networkidle'},
224180
)
225181
await page.locator('body.sb-show-main').waitFor({state: 'visible'})
@@ -230,11 +186,11 @@ test.describe('Visual Comparison: MinimalFooter', () => {
230186
})
231187

232188
// eslint-disable-next-line i18n-text/no-en
233-
test.describe('Fixed viewport test for Responsive small, no social links (390px)', () => {
234-
test.use({viewport: {width: 390, height: 900}})
235-
test('MinimalFooter / Responsive small, no social links (390px)', async ({page}) => {
189+
test.describe('Tablet viewport test for Regular view, no social links (tablet)', () => {
190+
test.use({viewport: {width: 834, height: 1112}})
191+
test('MinimalFooter / Regular view, no social links (tablet)', async ({page}) => {
236192
await page.goto(
237-
'http://localhost:6006/iframe.html?args=&id=components-minimalfooter-features--responsive-small-no-social-links&viewMode=story',
193+
'http://localhost:6006/iframe.html?args=&id=components-minimalfooter-features--regular-view-no-social-links&viewMode=story',
238194
{waitUntil: 'networkidle'},
239195
)
240196
await page.locator('body.sb-show-main').waitFor({state: 'visible'})
Loading

packages/react/src/MinimalFooter/MinimalFooter.visual.spec.ts-snapshots/Visual-Comparison-MinimalFooter-Mobile-viewpo-08774-rt-MinimalFooter-Default-Narrow-viewport-1-darwin.png renamed to packages/react/src/MinimalFooter/MinimalFooter.visual.spec.ts-snapshots/Visual-Comparison-MinimalFooter-Mobile-viewpo-d21fe-MinimalFooter-Default-narrow-view-mobile-1-darwin.png

File renamed without changes.

0 commit comments

Comments
 (0)