Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ export const SecondStory = {
};

export const CombinedStories = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
play: async (context) => {
const canvas = within(context.canvasElement);

// Runs the FirstStory and Second story play function before running this story's play function
await FirstStory.play({ canvasElement });
await SecondStory.play({ canvasElement });
await FirstStory.play(context);
await SecondStory.play(context);
await userEvent.type(canvas.getByTestId('another-element'), 'random value');
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ export const SecondStory: Story = {
};

export const CombinedStories: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
play: async (context) => {
const canvas = within(context.canvasElement);

// Runs the FirstStory and Second story play function before running this story's play function
await FirstStory.play({ canvasElement });
await SecondStory.play({ canvasElement });
await FirstStory.play(context);
await SecondStory.play(context);
await userEvent.type(canvas.getByTestId('another-element'), 'random value');
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ export const SecondStory = {
};

export const CombinedStories = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
play: async (context) => {
const canvas = within(context.canvasElement);

// Runs the FirstStory and Second story play function before running this story's play function
await FirstStory.play({ canvasElement });
await SecondStory.play({ canvasElement });
await FirstStory.play(context);
await SecondStory.play(context);
await userEvent.type(canvas.getByTestId('another-element'), 'random value');
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ export const SecondStory: Story = {
};

export const CombinedStories: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
play: async (context) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Foxhoundn can you add a small comment in the example explaining why the user would use context instead of the destructured canvasElement, so that we can clarify to the readers? Also if you're able, can you also apply this pattern to this file, so that folks don't see one example with canvasElement and another with context

const canvas = within(context.canvasElement);

// Runs the FirstStory and Second story play function before running this story's play function
await FirstStory.play({ canvasElement });
await SecondStory.play({ canvasElement });
await FirstStory.play(context);
await SecondStory.play(context);
await userEvent.type(canvas.getByTestId('another-element'), 'random value');
},
};
Expand Down