Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
fix: LSDV-4903: Fix Video tag null rendering (#1313)
Browse files Browse the repository at this point in the history
* fix: LSDV-4903: Remove rendering unexpected null on reinit LS with video tag in config

* test: LSDV-4903: Add VirtualVideo unmounting test

* Try to fix test by emulating supported video format

* Move test to codeceptjs
  • Loading branch information
Gondragos authored and Travis1282 committed Apr 24, 2023
1 parent 2acc4f3 commit 4eebe7a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions e2e/tests/regression-tests/video-unmount.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Feature('Video unmount').tag('@regress');

Scenario('Reiniting Label Studio should not left unexpected null and video tags in DOM', async ({ I, LabelStudio }) => {
I.amOnPage('/');
for (let i = 0; i < 60; i++) {
LabelStudio.init({
config: `
<View>
<Video name="video" value="$video" />
<VideoRectangle name="box" toName="video" />
</View>`,
data: { video: '/files/opossum_intro.webm' },
});

I.wait(i * i / 1000000);
}
I.dontSeeElementInDOM({ xpath: '//body/video[position()=2]' });
I.dontSee('null');
}).config({ waitForAction: 0 });
2 changes: 1 addition & 1 deletion src/components/VideoCanvas/VirtualVideo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export const VirtualVideo = forwardRef<HTMLVideoElement, VirtualVideoProps>((pro
createVideoElement();
attachEventListeners();
canPlayType(props.src ?? '').then((canPlay) => {
if (canPlay) {
if (canPlay && video.current) {
attachSource();
attachRef(video.current);

Expand Down

0 comments on commit 4eebe7a

Please sign in to comment.