Skip to content

Commit

Permalink
たぶんドラッグができなくてテスト不可能
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiroshiba committed Sep 7, 2024
1 parent cdec85a commit 5b706a5
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 deletions.
28 changes: 24 additions & 4 deletions src/components/Sing/SingEditor.stories.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { userEvent, within, expect, fn, waitFor } from "@storybook/test";
import {
userEvent,

Check failure on line 2 in src/components/Sing/SingEditor.stories.ts

View workflow job for this annotation

GitHub Actions / build-test

'userEvent' is defined but never used
within,
expect,
fn,
waitFor,
fireEvent,

Check failure on line 7 in src/components/Sing/SingEditor.stories.ts

View workflow job for this annotation

GitHub Actions / build-test

'fireEvent' is defined but never used
} from "@storybook/test";

import { Meta, StoryObj } from "@storybook/vue3";
import { provide, toRaw } from "vue";

Check failure on line 11 in src/components/Sing/SingEditor.stories.ts

View workflow job for this annotation

GitHub Actions / build-test

'toRaw' is defined but never used
Expand Down Expand Up @@ -32,6 +39,7 @@ const meta: Meta<typeof SingEditor> = {
args: {
isEnginesReady: true,
isProjectFileLoaded: false,
onCompleteInitialStartup: fn(),
},
decorators: [
(story, context) => {
Expand Down Expand Up @@ -143,9 +151,7 @@ export const Default: Story = {
play: async ({ args }) => {
// 準備が完了するまで待機する
await waitFor(
() => {
// expect(args.onCompleteInitialStartup).toHaveBeenCalled();
},
() => expect(args.onCompleteInitialStartup).toHaveBeenCalled(),
{ timeout: 5000 },
);
},
Expand All @@ -157,3 +163,17 @@ export const NowLoading: Story = {
isProjectFileLoaded: "waiting",
},
};

export const AddNote: Story = {
name: "ノート追加のテスト",
play: async ({ context, canvasElement, parameters }) => {

Check failure on line 169 in src/components/Sing/SingEditor.stories.ts

View workflow job for this annotation

GitHub Actions / build-test

'parameters' is defined but never used
await Default.play?.(context);

Check failure on line 170 in src/components/Sing/SingEditor.stories.ts

View workflow job for this annotation

GitHub Actions / build-test

Pass a context when invoking play function of another story

const canvas = within(canvasElement);

Check failure on line 172 in src/components/Sing/SingEditor.stories.ts

View workflow job for this annotation

GitHub Actions / build-test

'canvas' is assigned a value but never used

// たぶんドラッグができなくてテスト不可能

// const { audioItems, audioKeys } = parameters.vuexState;
// await window.storybookTestSnapshot?.({ audioItems, audioKeys });
},
};
6 changes: 6 additions & 0 deletions src/components/Sing/SingEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ const props = defineProps<{
isProjectFileLoaded: boolean | "waiting";
}>();
const emit = defineEmits<{
/** ソングエディタの準備が完了するときに呼ばれる */
completeInitialStartup: [];
}>();
const store = useStore();
const isSidebarOpen = computed(
Expand Down Expand Up @@ -118,6 +123,7 @@ onetimeWatch(
await store.dispatch("SET_PLAYHEAD_POSITION", { position: 0 });
await store.dispatch("SYNC_TRACKS_AND_TRACK_CHANNEL_STRIPS");
isCompletedInitialStartup.value = true;
emit("completeInitialStartup");
return "unwatch";
},
Expand Down
4 changes: 1 addition & 3 deletions src/components/Talk/TalkEditor.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,7 @@ export const Default: Story = {
play: async ({ args }) => {
// 準備が完了するまで待機する
await waitFor(
() => {
expect(args.onCompleteInitialStartup).toHaveBeenCalled();
},
() => expect(args.onCompleteInitialStartup).toHaveBeenCalled(),
{ timeout: 5000 },
);
},
Expand Down

0 comments on commit 5b706a5

Please sign in to comment.