From 97374d1c3130a4c15db4cde12962ebb307be8345 Mon Sep 17 00:00:00 2001 From: Kyle Gach Date: Thu, 30 May 2024 13:38:13 -0600 Subject: [PATCH] Merge pull request #27426 from storybookjs/update-sub-path-imports-snippets Docs: Use absolute imports in module mocking snippets (cherry picked from commit fa80d2246609b421520067886ca3ba8f837e0c4f) --- docs/snippets/angular/before-each-in-meta-mock-date.ts.mdx | 2 +- docs/snippets/angular/storybook-test-fn-mock-spy.ts.mdx | 4 ++-- docs/snippets/angular/storybook-test-mock-return-value.ts.mdx | 2 +- docs/snippets/common/before-each-in-meta-mock-date.js.mdx | 2 +- docs/snippets/common/before-each-in-meta-mock-date.ts-4-9.mdx | 2 +- docs/snippets/common/before-each-in-meta-mock-date.ts.mdx | 2 +- docs/snippets/common/storybook-test-fn-mock-spy.js.mdx | 4 ++-- docs/snippets/common/storybook-test-fn-mock-spy.ts-4-9.mdx | 4 ++-- docs/snippets/common/storybook-test-fn-mock-spy.ts.mdx | 4 ++-- docs/snippets/common/storybook-test-mock-return-value.js.mdx | 2 +- .../common/storybook-test-mock-return-value.ts-4-9.mdx | 2 +- docs/snippets/common/storybook-test-mock-return-value.ts.mdx | 2 +- .../web-components/before-each-in-meta-mock-date.ts.mdx | 2 +- .../snippets/web-components/storybook-test-fn-mock-spy.js.mdx | 4 ++-- .../snippets/web-components/storybook-test-fn-mock-spy.ts.mdx | 4 ++-- .../web-components/storybook-test-mock-return-value.js.mdx | 2 +- .../web-components/storybook-test-mock-return-value.ts.mdx | 2 +- 17 files changed, 23 insertions(+), 23 deletions(-) diff --git a/docs/snippets/angular/before-each-in-meta-mock-date.ts.mdx b/docs/snippets/angular/before-each-in-meta-mock-date.ts.mdx index 8168708e3825..1d2cf99e0127 100644 --- a/docs/snippets/angular/before-each-in-meta-mock-date.ts.mdx +++ b/docs/snippets/angular/before-each-in-meta-mock-date.ts.mdx @@ -4,7 +4,7 @@ import type { Meta, StoryObj } from '@storybook/angular'; import MockDate from 'mockdate'; // 👇 Must include the `.mock` portion of filename to have mocks typed correctly -import { getUserFromSession } from '../../api/session.mock'; +import { getUserFromSession } from '#api/session.mock'; import { Page } from './Page'; const meta: Meta = { diff --git a/docs/snippets/angular/storybook-test-fn-mock-spy.ts.mdx b/docs/snippets/angular/storybook-test-fn-mock-spy.ts.mdx index 2108d5f64f1b..e23845a4be7a 100644 --- a/docs/snippets/angular/storybook-test-fn-mock-spy.ts.mdx +++ b/docs/snippets/angular/storybook-test-fn-mock-spy.ts.mdx @@ -4,8 +4,8 @@ import type { Meta, StoryObj } from '@storybook/angular'; import { expect, userEvent, within } from '@storybook/test'; // 👇 Must include the `.mock` portion of filename to have mocks typed correctly -import { saveNote } from '../../app/actions.mock'; -import { createNotes } from '../../mocks/notes'; +import { saveNote } from '#app/actions.mock'; +import { createNotes } from '#mocks/notes'; import NoteUI from './note-ui'; const meta: Meta = { diff --git a/docs/snippets/angular/storybook-test-mock-return-value.ts.mdx b/docs/snippets/angular/storybook-test-mock-return-value.ts.mdx index f86630d0fe85..9c5c5982efe4 100644 --- a/docs/snippets/angular/storybook-test-mock-return-value.ts.mdx +++ b/docs/snippets/angular/storybook-test-mock-return-value.ts.mdx @@ -3,7 +3,7 @@ import type { Meta, StoryObj } from '@storybook/angular'; // 👇 Must include the `.mock` portion of filename to have mocks typed correctly -import { getUserFromSession } from '../../api/session.mock'; +import { getUserFromSession } from '#api/session.mock'; import { Page } from './Page'; const meta: Meta = { diff --git a/docs/snippets/common/before-each-in-meta-mock-date.js.mdx b/docs/snippets/common/before-each-in-meta-mock-date.js.mdx index 88358f60cbac..b39e8d8120b0 100644 --- a/docs/snippets/common/before-each-in-meta-mock-date.js.mdx +++ b/docs/snippets/common/before-each-in-meta-mock-date.js.mdx @@ -2,7 +2,7 @@ // Page.stories.js import MockDate from 'mockdate'; -import { getUserFromSession } from '../../api/session.mock'; +import { getUserFromSession } from '#api/session.mock'; import { Page } from './Page'; export default { diff --git a/docs/snippets/common/before-each-in-meta-mock-date.ts-4-9.mdx b/docs/snippets/common/before-each-in-meta-mock-date.ts-4-9.mdx index 32aa8c4dfe70..4a26f603d1ed 100644 --- a/docs/snippets/common/before-each-in-meta-mock-date.ts-4-9.mdx +++ b/docs/snippets/common/before-each-in-meta-mock-date.ts-4-9.mdx @@ -5,7 +5,7 @@ import type { Meta, StoryObj } from '@storybook/your-renderer'; import MockDate from 'mockdate'; // 👇 Must include the `.mock` portion of filename to have mocks typed correctly -import { getUserFromSession } from '../../api/session.mock'; +import { getUserFromSession } from '#api/session.mock'; import { Page } from './Page'; const meta = { diff --git a/docs/snippets/common/before-each-in-meta-mock-date.ts.mdx b/docs/snippets/common/before-each-in-meta-mock-date.ts.mdx index cc15ba1b6251..89c3ca1717da 100644 --- a/docs/snippets/common/before-each-in-meta-mock-date.ts.mdx +++ b/docs/snippets/common/before-each-in-meta-mock-date.ts.mdx @@ -5,7 +5,7 @@ import type { Meta, StoryObj } from '@storybook/your-renderer'; import MockDate from 'mockdate'; // 👇 Must include the `.mock` portion of filename to have mocks typed correctly -import { getUserFromSession } from '../../api/session.mock'; +import { getUserFromSession } from '#api/session.mock'; import { Page } from './Page'; const meta: Meta = { diff --git a/docs/snippets/common/storybook-test-fn-mock-spy.js.mdx b/docs/snippets/common/storybook-test-fn-mock-spy.js.mdx index b647d7f747f2..e9d26c1b36c4 100644 --- a/docs/snippets/common/storybook-test-fn-mock-spy.js.mdx +++ b/docs/snippets/common/storybook-test-fn-mock-spy.js.mdx @@ -2,8 +2,8 @@ // NoteUI.stories.js import { expect, userEvent, within } from '@storybook/test'; -import { saveNote } from '../../app/actions.mock'; -import { createNotes } from '../../mocks/notes'; +import { saveNote } from '#app/actions.mock'; +import { createNotes } from '#mocks/notes'; import NoteUI from './note-ui'; export default { diff --git a/docs/snippets/common/storybook-test-fn-mock-spy.ts-4-9.mdx b/docs/snippets/common/storybook-test-fn-mock-spy.ts-4-9.mdx index ebfeb6f4e41b..a081b0f00883 100644 --- a/docs/snippets/common/storybook-test-fn-mock-spy.ts-4-9.mdx +++ b/docs/snippets/common/storybook-test-fn-mock-spy.ts-4-9.mdx @@ -5,8 +5,8 @@ import type { Meta, StoryObj } from '@storybook/your-renderer'; import { expect, userEvent, within } from '@storybook/test'; // 👇 Must include the `.mock` portion of filename to have mocks typed correctly -import { saveNote } from '../../app/actions.mock'; -import { createNotes } from '../../mocks/notes'; +import { saveNote } from '#app/actions.mock'; +import { createNotes } from '#mocks/notes'; import NoteUI from './note-ui'; const meta = { diff --git a/docs/snippets/common/storybook-test-fn-mock-spy.ts.mdx b/docs/snippets/common/storybook-test-fn-mock-spy.ts.mdx index 0b350296f3e6..3e2418789d6c 100644 --- a/docs/snippets/common/storybook-test-fn-mock-spy.ts.mdx +++ b/docs/snippets/common/storybook-test-fn-mock-spy.ts.mdx @@ -5,8 +5,8 @@ import type { Meta, StoryObj } from '@storybook/your-renderer'; import { expect, userEvent, within } from '@storybook/test'; // 👇 Must include the `.mock` portion of filename to have mocks typed correctly -import { saveNote } from '../../app/actions.mock'; -import { createNotes } from '../../mocks/notes'; +import { saveNote } from '#app/actions.mock'; +import { createNotes } from '#mocks/notes'; import NoteUI from './note-ui'; const meta: Meta = { diff --git a/docs/snippets/common/storybook-test-mock-return-value.js.mdx b/docs/snippets/common/storybook-test-mock-return-value.js.mdx index cad1a2854f2f..40359fae8522 100644 --- a/docs/snippets/common/storybook-test-mock-return-value.js.mdx +++ b/docs/snippets/common/storybook-test-mock-return-value.js.mdx @@ -1,6 +1,6 @@ ```js // Page.stories.js -import { getUserFromSession } from '../../api/session.mock'; +import { getUserFromSession } from '#api/session.mock'; import { Page } from './Page'; export default { diff --git a/docs/snippets/common/storybook-test-mock-return-value.ts-4-9.mdx b/docs/snippets/common/storybook-test-mock-return-value.ts-4-9.mdx index 6044c33ddb99..8db3429a8bfa 100644 --- a/docs/snippets/common/storybook-test-mock-return-value.ts-4-9.mdx +++ b/docs/snippets/common/storybook-test-mock-return-value.ts-4-9.mdx @@ -4,7 +4,7 @@ import type { Meta, StoryObj } from '@storybook/your-renderer'; // 👇 Must include the `.mock` portion of filename to have mocks typed correctly -import { getUserFromSession } from '../../api/session.mock'; +import { getUserFromSession } from '#api/session.mock'; import { Page } from './Page'; const meta = { diff --git a/docs/snippets/common/storybook-test-mock-return-value.ts.mdx b/docs/snippets/common/storybook-test-mock-return-value.ts.mdx index 549751464b22..bf7c4164992b 100644 --- a/docs/snippets/common/storybook-test-mock-return-value.ts.mdx +++ b/docs/snippets/common/storybook-test-mock-return-value.ts.mdx @@ -4,7 +4,7 @@ import type { Meta, StoryObj } from '@storybook/your-renderer'; // 👇 Must include the `.mock` portion of filename to have mocks typed correctly -import { getUserFromSession } from '../../api/session.mock'; +import { getUserFromSession } from '#api/session.mock'; import { Page } from './Page'; const meta: Meta = { diff --git a/docs/snippets/web-components/before-each-in-meta-mock-date.ts.mdx b/docs/snippets/web-components/before-each-in-meta-mock-date.ts.mdx index 3e1c4911e348..166b29c6028e 100644 --- a/docs/snippets/web-components/before-each-in-meta-mock-date.ts.mdx +++ b/docs/snippets/web-components/before-each-in-meta-mock-date.ts.mdx @@ -4,7 +4,7 @@ import type { Meta, StoryObj } from '@storybook/web-components'; import MockDate from 'mockdate'; // 👇 Must include the `.mock` portion of filename to have mocks typed correctly -import { getUserFromSession } from '../../api/session.mock'; +import { getUserFromSession } from '#api/session.mock'; const meta: Meta = { component: 'my-page', diff --git a/docs/snippets/web-components/storybook-test-fn-mock-spy.js.mdx b/docs/snippets/web-components/storybook-test-fn-mock-spy.js.mdx index b89c145a5114..c93f3ba6b3ef 100644 --- a/docs/snippets/web-components/storybook-test-fn-mock-spy.js.mdx +++ b/docs/snippets/web-components/storybook-test-fn-mock-spy.js.mdx @@ -2,8 +2,8 @@ // NoteUI.stories.js import { expect, userEvent, within } from '@storybook/test'; -import { saveNote } from '../../app/actions.mock'; -import { createNotes } from '../../mocks/notes'; +import { saveNote } from '#app/actions.mock'; +import { createNotes } from '#mocks/notes'; export default { title: 'Mocked/NoteUI', diff --git a/docs/snippets/web-components/storybook-test-fn-mock-spy.ts.mdx b/docs/snippets/web-components/storybook-test-fn-mock-spy.ts.mdx index 9a94601ec81d..dfb83b7f8f07 100644 --- a/docs/snippets/web-components/storybook-test-fn-mock-spy.ts.mdx +++ b/docs/snippets/web-components/storybook-test-fn-mock-spy.ts.mdx @@ -4,8 +4,8 @@ import type { Meta, StoryObj } from '@storybook/react'; import { expect, userEvent, within } from '@storybook/test'; // 👇 Must include the `.mock` portion of filename to have mocks typed correctly -import { saveNote } from '../../app/actions.mock'; -import { createNotes } from '../../mocks/notes'; +import { saveNote } from '#app/actions.mock'; +import { createNotes } from '#mocks/notes'; const meta: Meta = { title: 'Mocked/NoteUI', diff --git a/docs/snippets/web-components/storybook-test-mock-return-value.js.mdx b/docs/snippets/web-components/storybook-test-mock-return-value.js.mdx index 9f89343855b3..04c8c9858980 100644 --- a/docs/snippets/web-components/storybook-test-mock-return-value.js.mdx +++ b/docs/snippets/web-components/storybook-test-mock-return-value.js.mdx @@ -1,6 +1,6 @@ ```js // Page.stories.js -import { getUserFromSession } from '../../api/session.mock'; +import { getUserFromSession } from '#api/session.mock'; export default { component: 'my-page', diff --git a/docs/snippets/web-components/storybook-test-mock-return-value.ts.mdx b/docs/snippets/web-components/storybook-test-mock-return-value.ts.mdx index 54ffafc25108..053eb05ec8c6 100644 --- a/docs/snippets/web-components/storybook-test-mock-return-value.ts.mdx +++ b/docs/snippets/web-components/storybook-test-mock-return-value.ts.mdx @@ -3,7 +3,7 @@ import type { Meta, StoryObj } from '@storybook/web-components'; // 👇 Must include the `.mock` portion of filename to have mocks typed correctly -import { getUserFromSession } from '../../api/session.mock'; +import { getUserFromSession } from '#api/session.mock'; const meta: Meta = { component: 'my-page',