feat: Phase 17.3 — Fixed embed queue panel with collapse/expand iframe resize (OQ1 Option A)
Read-only inline queue panel below the release embed's player bar; row-jump reuses PlayRelease. ForRelease mints a taller iframe plus a postMessage resize listener for the collapse toggle; ForTrack unchanged.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System.Text.RegularExpressions;
|
||||
using DeepDrftPublic.Client.Helpers;
|
||||
|
||||
namespace DeepDrftTests;
|
||||
@@ -5,8 +6,9 @@ namespace DeepDrftTests;
|
||||
/// <summary>
|
||||
/// Unit tests for the share-popover embed snippet (<see cref="EmbedSnippetBuilder"/>). The builder is
|
||||
/// the mode-aware half of SharePopover: track mode targets FramePlayer's TrackEntryKey param, release
|
||||
/// mode targets its ReleaseEntryKey param. The iframe chrome (dimensions, autoplay) must be identical
|
||||
/// across both. Pure string composition, tested directly without rendering the component.
|
||||
/// mode targets its ReleaseEntryKey param. The two snippets share width/border/autoplay chrome but
|
||||
/// diverge in height by design (Phase 17 §4.1, OQ6): the release embed is taller to show its queue
|
||||
/// panel; the track embed stays compact. Pure string composition, tested without rendering.
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class EmbedSnippetBuilderTests
|
||||
@@ -32,7 +34,7 @@ public class EmbedSnippetBuilderTests
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void BothModes_ShareIdenticalIframeChrome()
|
||||
public void BothModes_ShareIdenticalNonHeightChrome()
|
||||
{
|
||||
var track = EmbedSnippetBuilder.ForTrack(BaseUri, "k");
|
||||
var release = EmbedSnippetBuilder.ForRelease(BaseUri, "k");
|
||||
@@ -43,12 +45,59 @@ public class EmbedSnippetBuilderTests
|
||||
{
|
||||
Assert.That(snippet, Does.StartWith("<iframe "));
|
||||
Assert.That(snippet, Does.Contain(@"width=""656"""));
|
||||
Assert.That(snippet, Does.Contain(@"height=""196"""));
|
||||
Assert.That(snippet, Does.Contain(@"frameborder=""0"""));
|
||||
Assert.That(snippet, Does.Contain(@"style=""border-radius:8px;"""));
|
||||
Assert.That(snippet, Does.Contain(@"allow=""autoplay"""));
|
||||
Assert.That(snippet, Does.EndWith("></iframe>"));
|
||||
Assert.That(snippet, Does.Contain("</iframe>"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// T14 (Phase 17 §9): the release embed is taller than the track embed (it shows a queue panel),
|
||||
// and the track embed's height is unchanged from its historical value (UC6/AC6).
|
||||
[Test]
|
||||
public void ForTrack_KeepsHistoricalCompactHeight()
|
||||
{
|
||||
var track = EmbedSnippetBuilder.ForTrack(BaseUri, "k");
|
||||
|
||||
Assert.That(track, Does.Contain(@"height=""196"""));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ForRelease_IsTallerThanForTrack_ToShowQueuePanel()
|
||||
{
|
||||
var trackHeight = HeightOf(EmbedSnippetBuilder.ForTrack(BaseUri, "k"));
|
||||
var releaseHeight = HeightOf(EmbedSnippetBuilder.ForRelease(BaseUri, "k"));
|
||||
|
||||
Assert.That(releaseHeight, Is.GreaterThan(trackHeight));
|
||||
}
|
||||
|
||||
// The release snippet carries the host-side resize listener (OQ1 Option A); the track snippet,
|
||||
// having no panel to collapse, does not.
|
||||
[Test]
|
||||
public void ForRelease_IncludesResizeListenerScript()
|
||||
{
|
||||
var release = EmbedSnippetBuilder.ForRelease(BaseUri, "k");
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(release, Does.Contain("<script>"));
|
||||
Assert.That(release, Does.Contain("deepdrft-embed-resize"));
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ForTrack_HasNoResizeListenerScript()
|
||||
{
|
||||
var track = EmbedSnippetBuilder.ForTrack(BaseUri, "k");
|
||||
|
||||
Assert.That(track, Does.Not.Contain("<script>"));
|
||||
}
|
||||
|
||||
private static int HeightOf(string snippet)
|
||||
{
|
||||
var match = Regex.Match(snippet, @"height=""(\d+)""");
|
||||
Assert.That(match.Success, Is.True, "snippet must declare an iframe height");
|
||||
return int.Parse(match.Groups[1].Value);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user