diff --git a/js/app/src/components/Audio/Audio.test.ts b/js/app/src/components/Audio/Audio.test.ts index 50dfa7727b1f..35b238f053a6 100644 --- a/js/app/src/components/Audio/Audio.test.ts +++ b/js/app/src/components/Audio/Audio.test.ts @@ -218,7 +218,7 @@ describe("Audio", () => { assert.equal(fn.callCount, 1); }); - test("when autoplay is true `media.play` should be called in static mode", async () => { + test("when autoplay is true `media.play` should be called in dynamic mode", async () => { const { getByTestId } = await render(Audio, { show_label: true, loading_status, diff --git a/js/app/src/components/Video/Video.test.ts b/js/app/src/components/Video/Video.test.ts index 2825e410bbb2..31236a28caa4 100644 --- a/js/app/src/components/Video/Video.test.ts +++ b/js/app/src/components/Video/Video.test.ts @@ -9,8 +9,7 @@ import { expect } from "vitest"; import { spyOn } from "tinyspy"; -import { cleanup, render, wait_for_event, wait } from "@gradio/tootils"; -import event from "@testing-library/user-event"; +import { cleanup, render } from "@gradio/tootils"; import { setupi18n } from "../../i18n"; import Video from "./Video.svelte"; @@ -134,7 +133,8 @@ describe("Video", () => { startButton.dispatchEvent(new Event("loadeddata")); assert.equal(fn.callCount, 1); }); - test("when autoplay is true `media.play` should be called in static mode", async () => { + + test("when autoplay is true `media.play` should be called in dynamic mode", async () => { const { getByTestId } = await render(Video, { show_label: true, loading_status, @@ -158,6 +158,7 @@ describe("Video", () => { startButton.dispatchEvent(new Event("loadeddata")); assert.equal(fn.callCount, 1); }); + test("when autoplay is true `media.play` should be called in static mode when the Video data is updated", async () => { const { component, getByTestId } = await render(Video, { show_label: true, @@ -190,6 +191,7 @@ describe("Video", () => { startButton.dispatchEvent(new Event("loadeddata")); assert.equal(fn.callCount, 2); }); + test("when autoplay is true `media.play` should be called in dynamic mode when the Video data is updated", async () => { const { component, getByTestId } = await render(Video, { show_label: true, diff --git a/js/video/src/utils.ts b/js/video/src/utils.ts index bbcf3a144252..95905bade3fb 100644 --- a/js/video/src/utils.ts +++ b/js/video/src/utils.ts @@ -24,7 +24,6 @@ export function loaded( ): ActionReturn { async function handle_playback(): Promise { if (!autoplay) return; - // node.pause(); await node.play(); }