fix: default to cover is size are 0

This commit is contained in:
Valere
2026-03-02 15:38:43 +01:00
parent adc329a7e7
commit 5165e95d82
2 changed files with 21 additions and 0 deletions

View File

@@ -116,6 +116,18 @@ test.each([
tileSize: VIDEO_480_L,
expected: "contain",
},
{
// Should default to cover if the initial size is 0:0.
// Or else it will cause a flash of "contain" mode until the real size is loaded, which can be jarring.
videoSize: VIDEO_480_L,
tileSize: { width: 0, height: 0 },
expected: "cover",
},
{
videoSize: { width: 0, height: 0 },
tileSize: VIDEO_480_L,
expected: "cover",
},
])(
"videoFit$ returns $expected when videoSize is $videoSize and tileSize is $tileSize",
({ videoSize, tileSize, expected }) => {