Skip to content

armgit / qm

Public Imported from GitHub
0

Multiplayer agent harness for work.

Condense the pinned prompt to two lines while it is stuck (#1515)

Joshua France30ddd393f432
diff --git a/plugins/web-ui/src/chat.ts b/plugins/web-ui/src/chat.ts
index 43dbdc6f0..029818af8 100644
--- a/plugins/web-ui/src/chat.ts
+++ b/plugins/web-ui/src/chat.ts
@@ -1661,7 +1661,9 @@ export function createChatSurface(
${isReadOnlySlackView() ? slackWireBubble(messageText(message)) : markdown(messageText(message))}
${edited || deleted ? html`<span class="revision-badge">(${deleted ? "deleted" : "edited"})</span>` : nothing}
</div>
- <button class="pin-toggle" type="button" hidden aria-expanded="false">Show more</button>
+ <button class="pin-toggle" type="button" hidden aria-expanded="false">
+ <span class="pin-toggle-label">Show more</span>${icon(ChevronDown, 14)}
+ </button>
</div>
${
sendFailure
diff --git a/plugins/web-ui/src/shared-session.ts b/plugins/web-ui/src/shared-session.ts
index 7e2c04ff3..a9eed2967 100644
--- a/plugins/web-ui/src/shared-session.ts
+++ b/plugins/web-ui/src/shared-session.ts
@@ -1,7 +1,7 @@
import "./shell.css";
import "@mariozechner/mini-lit/dist/ThemeToggle.js";
import { html, render } from "lit";
-import { Lock, ArrowUpRight, Check, Copy, File } from "lucide";
+import { Lock, ArrowUpRight, Check, ChevronDown, Copy, File } from "lucide";
import { createTranscriptViewport } from "./transcript-viewport";
import { decorateTextCodeBlocks } from "./text-code";
import { markdown } from "./message-markdown";
@@ -75,7 +75,7 @@ render(
<div class=${message.role === "user" ? "pin-content" : "shared-message-content"}>
${markdown(message.text)}
</div>
- ${message.role === "user" ? html`<button class="pin-toggle" type="button" hidden aria-expanded="false">Show more</button>` : ""}
+ ${message.role === "user" ? html`<button class="pin-toggle" type="button" hidden aria-expanded="false"><span class="pin-toggle-label">Show more</span>${icon(ChevronDown, 14)}</button>` : ""}
${message.role === "assistant" ? files : ""}
${message.role === "assistant" ? html`<div class="message-meta"><button class="msg-copy" aria-label="Copy message" title="Copy" @click=${(e: Event) => void copyText(message.text, e.currentTarget as HTMLButtonElement)}>${icon(Copy, 13)}${icon(Check, 13)}</button></div>` : ""}
</div>
diff --git a/plugins/web-ui/src/shell.css b/plugins/web-ui/src/shell.css
index 0ac465076..538dccedb 100644
--- a/plugins/web-ui/src/shell.css
+++ b/plugins/web-ui/src/shell.css
@@ -2012,7 +2012,9 @@ qm-markdown .tok-in {
line-height: 1.55;
}
.user-bubble {
- background: color-mix(in srgb, var(--secondary) 76%, var(--background));
+ --bubble-bg: color-mix(in srgb, var(--secondary) 76%, var(--background));
+ position: relative;
+ background: var(--bubble-bg);
color: var(--foreground);
overflow-wrap: anywhere;
}
@@ -2039,26 +2041,70 @@ qm-markdown .tok-in {
overflow: auto;
overscroll-behavior: contain;
}
+.message-stack .user-row.stuck:not(.pin-expanded) {
+ min-height: var(--pin-rest-height);
+}
+.message-stack .user-row.stuck:not(.pin-expanded) .user-bubble > .pin-content {
+ max-height: var(--pin-content-max, none);
+}
+.message-stack
+ .user-row.stuck:not(.pin-expanded)
+ .user-bubble
+ > .pin-content:has(code-block, pre, table, img, svg, math, .katex-display, video, iframe) {
+ max-height: var(--pin-content-max, 2lh);
+}
+.message-stack .user-row.pin-condensed:not(.pin-expanded) .user-bubble > .pin-content {
+ -webkit-line-clamp: 2;
+}
+.message-stack
+ .user-row.pin-condensed:not(.pin-expanded)
+ .user-bubble
+ > .pin-content
+ :is(p, ul, ol, blockquote, h1, h2, h3, h4, h5, h6) {
+ margin-block: 0;
+}
+.message-stack .user-row.pin-condensed:not(.pin-expanded) .user-bubble > .pin-content :is(h1, h2, h3, h4, h5, h6) {
+ font-size: inherit;
+ line-height: inherit;
+}
.pin-toggle {
display: none;
- width: fit-content;
- margin: 6px 0 0 auto;
- pointer-events: auto;
+ position: absolute;
+ right: 14px;
+ bottom: 10px;
+ height: 1lh;
+ margin: 0;
+ padding: 0 0 0 36px;
border: 0;
- border-radius: 6px;
- background: transparent;
+ background: linear-gradient(to right, transparent, var(--bubble-bg) 28px);
color: var(--muted-foreground);
font: inherit;
- font-size: 12px;
- padding: 6px 8px;
+ pointer-events: auto;
cursor: pointer;
}
.message-stack .user-row:not(:has(~ .user-row)) > .user-bubble > .pin-toggle:not([hidden]) {
display: flex;
+ align-items: center;
+ gap: 2px;
+}
+.message-stack .user-row.pin-expanded > .user-bubble > .pin-toggle > .icon {
+ transform: rotate(180deg);
}
-.pin-toggle:hover {
+.message-stack .user-row.pin-expanded > .user-bubble > .pin-toggle,
+.message-stack
+ .user-bubble
+ > .pin-content:has(code-block, pre, table, img, svg, math, .katex-display, video, iframe)
+ ~ .pin-toggle {
+ position: static;
+ height: auto;
+ margin: 6px 0 0 auto;
+ padding: 0;
+ background: none;
+ font-size: 12px;
+}
+.pin-toggle:is(:hover, :focus-visible) {
color: var(--foreground);
- background: var(--secondary);
+ text-decoration: underline;
}
.message-files,
.attachment-strip {
diff --git a/plugins/web-ui/src/transcript-viewport.ts b/plugins/web-ui/src/transcript-viewport.ts
index d3fb1aa51..10d785039 100644
--- a/plugins/web-ui/src/transcript-viewport.ts
+++ b/plugins/web-ui/src/transcript-viewport.ts
@@ -26,6 +26,8 @@ export function preserveTranscriptScroll(root: HTMLElement): () => void {
};
}
+const CONDENSED_LINES = 2;
+
export function createTranscriptViewport() {
let scroller: HTMLElement | null = null;
let pins: HTMLElement | null = null;
@@ -38,6 +40,13 @@ export function createTranscriptViewport() {
let observer: ResizeObserver | null = null;
let following = false;
let frame: number | null = null;
+ let remeasure = true;
+ let restContent = 0;
+ let condensedContent = 0;
+ let contentHeight = 0;
+ let condensedHeight = 0;
+ let gap: number | null = null;
+ let contentMax = "";
const contentUpdates = new Set<Promise<void>>();
function setFollowing(value: boolean): void {
@@ -53,8 +62,14 @@ export function createTranscriptViewport() {
function clearPrompt(): void {
if (content) content.scrollTop = 0;
- prompt?.classList.remove("stuck", "sticky-disabled", "pin-expanded");
+ prompt?.classList.remove("stuck", "sticky-disabled", "pin-expanded", "pin-condensed");
prompt?.style.removeProperty("--pin-expanded-max");
+ prompt?.style.removeProperty("--pin-rest-height");
+ prompt?.style.removeProperty("--pin-content-max");
+ restContent = condensedContent = contentHeight = condensedHeight = 0;
+ gap = null;
+ contentMax = "";
+ remeasure = true;
const toggle = prompt?.querySelector<HTMLButtonElement>(".pin-toggle");
if (toggle) toggle.hidden = true;
expanded = false;
@@ -69,7 +84,8 @@ export function createTranscriptViewport() {
if (toggle) {
toggle.hidden = !clipped && !expanded;
const label = expanded ? "Show less" : "Show more";
- if (toggle.textContent !== label) toggle.textContent = label;
+ const text = toggle.querySelector<HTMLElement>(".pin-toggle-label") ?? toggle;
+ if (text.textContent !== label) text.textContent = label;
toggle.setAttribute("aria-expanded", String(expanded));
}
}
@@ -93,7 +109,9 @@ export function createTranscriptViewport() {
const style = getComputedStyle(scroller);
const paddingTop = parseFloat(style.paddingTop) || 0;
const paddingBottom = parseFloat(style.paddingBottom) || 0;
- const promptMargin = prompt ? parseFloat(getComputedStyle(prompt).marginBottom) || 0 : 0;
+ const promptStyle = prompt ? getComputedStyle(prompt) : null;
+ const promptMargin = promptStyle ? parseFloat(promptStyle.marginBottom) || 0 : 0;
+ if (prompt && content && promptStyle && remeasure && !expanded) measureRest(promptStyle);
if (prompt && content) {
const chrome = prompt.getBoundingClientRect().height - content.getBoundingClientRect().height;
const available = scroller.clientHeight - top - paddingTop - paddingBottom - promptMargin - chrome;
@@ -103,13 +121,67 @@ export function createTranscriptViewport() {
!!prompt &&
prompt.getBoundingClientRect().height + promptMargin + top + paddingTop + paddingBottom <= scroller.clientHeight;
prompt?.classList.toggle("sticky-disabled", !canStick);
- prompt?.classList.toggle(
- "stuck",
- canStick &&
- scroller.scrollTop > 0 &&
- prompt.getBoundingClientRect().top <=
- scroller.getBoundingClientRect().top + scroller.clientTop + paddingTop + top + 0.5,
- );
+ const line = scroller.getBoundingClientRect().top + scroller.clientTop + paddingTop + top;
+ const stuck = !!prompt && canStick && scroller.scrollTop > 0 && prompt.getBoundingClientRect().top <= line + 0.5;
+ prompt?.classList.toggle("stuck", stuck);
+ if (!prompt || !content || !promptStyle) return;
+ const edge = anchorEdge();
+ if (!stuck) gap = prompt.getBoundingClientRect().top - edge;
+ condense(stuck && !expanded, line - edge - (gap ?? restingGap(promptStyle)));
+ }
+
+ function anchorEdge(): number {
+ const previous = prompt?.previousElementSibling;
+ if (previous) return previous.getBoundingClientRect().bottom;
+ return stack?.getBoundingClientRect().top ?? 0;
+ }
+
+ function restingGap(promptStyle: CSSStyleDeclaration): number {
+ const previous = prompt?.previousElementSibling;
+ let before = 0;
+ if (previous) before = parseFloat(getComputedStyle(previous).marginBottom) || 0;
+ else if (stack) before = parseFloat(getComputedStyle(stack).paddingTop) || 0;
+ return before + (parseFloat(promptStyle.marginTop) || 0);
+ }
+
+ function measureRest(promptStyle: CSSStyleDeclaration): void {
+ if (!prompt || !content) return;
+ remeasure = false;
+ prompt.classList.remove("pin-condensed");
+ prompt.style.removeProperty("--pin-content-max");
+ prompt.style.setProperty("--pin-rest-height", "0px");
+ contentMax = "";
+ restContent = content.getBoundingClientRect().height;
+ contentHeight = content.scrollHeight;
+ const inner =
+ prompt.getBoundingClientRect().height -
+ (parseFloat(promptStyle.paddingTop) || 0) -
+ (parseFloat(promptStyle.paddingBottom) || 0);
+ prompt.style.setProperty("--pin-rest-height", `${Math.max(0, inner)}px`);
+ const contentStyle = getComputedStyle(content);
+ const lineHeight = parseFloat(contentStyle.lineHeight) || (parseFloat(contentStyle.fontSize) || 0) * 1.5;
+ condensedContent = CONDENSED_LINES * lineHeight;
+ }
+
+ function contentChanged(): boolean {
+ if (!content) return false;
+ return content.scrollHeight !== (prompt?.classList.contains("pin-condensed") ? condensedHeight : contentHeight);
+ }
+
+ function condense(active: boolean, distance: number): void {
+ if (!prompt || !content) return;
+ const span = restContent - condensedContent;
+ const settled = span <= 0.5 || span - distance < 0.5;
+ if (active && settled && !prompt.classList.contains("pin-condensed")) {
+ prompt.classList.add("pin-condensed");
+ condensedHeight = content.scrollHeight;
+ } else if (!(active && settled)) prompt.classList.remove("pin-condensed");
+ let max = "";
+ if (active) max = `${settled ? condensedContent : restContent - Math.max(0, distance)}px`;
+ if (max === contentMax) return;
+ contentMax = max;
+ if (max) prompt.style.setProperty("--pin-content-max", max);
+ else prompt.style.removeProperty("--pin-content-max");
}
function onScroll(): void {
@@ -199,7 +271,8 @@ export function createTranscriptViewport() {
scroller?.addEventListener("click", onClick);
scroller?.addEventListener("keydown", onKeyDown);
if (typeof ResizeObserver !== "undefined") {
- observer = new ResizeObserver(() => {
+ observer = new ResizeObserver((entries = []) => {
+ if (entries.some((entry) => entry.target === scroller) || contentChanged()) remeasure = true;
beforeRender();
syncSticky();
follow();
@@ -233,6 +306,7 @@ export function createTranscriptViewport() {
const nextContent = prompt?.querySelector<HTMLElement>(".pin-content") ?? null;
if (content !== nextContent) {
changed = true;
+ remeasure = true;
if (content) observer?.unobserve(content);
content = nextContent;
if (content) observer?.observe(content);
diff --git a/plugins/web-ui/test/pinned-prompt-collapse.test.ts b/plugins/web-ui/test/pinned-prompt-collapse.test.ts
index 98fe0fd49..c6b64170c 100644
--- a/plugins/web-ui/test/pinned-prompt-collapse.test.ts
+++ b/plugins/web-ui/test/pinned-prompt-collapse.test.ts
@@ -1,13 +1,15 @@
import assert from "node:assert/strict";
import test from "node:test";
+import { readFileSync } from "node:fs";
import { JSDOM } from "jsdom";
import { createTranscriptViewport } from "../src/transcript-viewport.ts";
function fixture() {
const dom = new JSDOM(
- `<section class="chat-scroll"><div class="pinned-strip"></div><div class="message-stack"><article class="user-row" data-index="1"><div class="user-bubble"><div class="pin-content">Example prompt</div><button class="pin-toggle" hidden>Show more</button></div></article></div></section>`,
+ `<section class="chat-scroll"><div class="pinned-strip"></div><div class="message-stack"><article class="user-row" data-index="1"><div class="user-bubble"><div class="pin-content" style="line-height: 20px">Example prompt</div><button class="pin-toggle" hidden><span class="pin-toggle-label">Show more</span><svg class="icon"></svg></button></div></article></div></section>`,
);
const scroller = dom.window.document.querySelector<HTMLElement>("section")!;
+ const stack = scroller.querySelector<HTMLElement>(".message-stack")!;
const row = scroller.querySelector<HTMLElement>("article")!;
const content = row.querySelector<HTMLElement>(".pin-content")!;
const toggle = row.querySelector<HTMLButtonElement>("button")!;
@@ -31,16 +33,17 @@ function fixture() {
});
content.getBoundingClientRect = () => ({ height: content.clientHeight }) as DOMRect;
scroller.getBoundingClientRect = () => ({ top: 0 }) as DOMRect;
+ stack.getBoundingClientRect = () => ({ top: -scroller.scrollTop }) as DOMRect;
row.getBoundingClientRect = () => ({ top: 0, height: content.clientHeight + 24 }) as DOMRect;
const observed = new Set<Element>();
- let resize = () => {};
+ let resize = (_entries: Array<{ target: Element }>) => {};
const restore = ["ResizeObserver", "getComputedStyle"].map(
(key) => [key, Object.getOwnPropertyDescriptor(globalThis, key)] as const,
);
Object.assign(globalThis, {
getComputedStyle: dom.window.getComputedStyle.bind(dom.window),
ResizeObserver: class {
- constructor(callback: () => void) {
+ constructor(callback: (entries: Array<{ target: Element }>) => void) {
resize = callback;
}
observe(element: Element) {
@@ -63,17 +66,21 @@ function fixture() {
toggle,
observed,
viewport,
+ scroll: (top: number) => {
+ scroller.scrollTop = top;
+ scroller.dispatchEvent(new dom.window.Event("scroll"));
+ },
resize: (next: number) => {
height = next;
- resize();
+ resize([{ target: scroller }]);
},
setPins: (next: number) => {
pinsHeight = next;
- resize();
+ resize([{ target: scroller.querySelector(".pinned-strip")! }]);
},
grow: (next: number) => {
fullHeight = next;
- resize();
+ resize([{ target: content }]);
},
close: () => {
viewport.dispose();
@@ -225,6 +232,165 @@ test("expanding a scrolled prompt stays sticky with a bounded scrollable body",
}
});
+test("a stuck prompt keeps the transcript slot it had at rest", () => {
+ const f = fixture();
+ try {
+ const rest = f.row.style.getPropertyValue("--pin-rest-height");
+ assert.equal(rest, "163.5px");
+ f.scroll(500);
+ assert.equal(f.row.classList.contains("stuck"), true);
+ f.row.getBoundingClientRect = () => ({ top: 0, height: 60 }) as DOMRect;
+ f.scroll(520);
+ assert.equal(f.row.style.getPropertyValue("--pin-rest-height"), rest);
+ f.toggle.click();
+ assert.equal(f.row.style.getPropertyValue("--pin-rest-height"), rest);
+ f.toggle.click();
+ f.scroll(0);
+ assert.equal(f.row.classList.contains("stuck"), false);
+ assert.equal(f.row.style.getPropertyValue("--pin-rest-height"), rest);
+ f.resize(300);
+ assert.equal(f.row.style.getPropertyValue("--pin-rest-height"), "60px");
+ f.viewport.dispose();
+ assert.equal(f.row.style.getPropertyValue("--pin-rest-height"), "");
+ } finally {
+ f.close();
+ }
+});
+
+test("the prompt condenses in step with the scroll, one pixel of height per pixel scrolled", () => {
+ const f = fixture();
+ try {
+ assert.equal(f.row.style.getPropertyValue("--pin-content-max"), "");
+ f.scroll(49.75);
+ assert.equal(f.row.classList.contains("stuck"), true);
+ assert.equal(f.row.classList.contains("pin-condensed"), false);
+ assert.equal(f.row.style.getPropertyValue("--pin-content-max"), "89.75px");
+ f.scroll(99.5);
+ assert.equal(f.row.classList.contains("pin-condensed"), true);
+ assert.equal(f.row.style.getPropertyValue("--pin-content-max"), "40px");
+ f.scroll(900);
+ assert.equal(f.row.classList.contains("pin-condensed"), true);
+ assert.equal(f.row.style.getPropertyValue("--pin-content-max"), "40px");
+ f.scroll(20);
+ assert.equal(f.row.classList.contains("pin-condensed"), false);
+ assert.equal(f.row.style.getPropertyValue("--pin-content-max"), "119.5px");
+ f.scroll(0);
+ assert.equal(f.row.classList.contains("stuck"), false);
+ assert.equal(f.row.classList.contains("pin-condensed"), false);
+ assert.equal(f.row.style.getPropertyValue("--pin-content-max"), "");
+ f.scroll(60);
+ f.toggle.click();
+ assert.equal(f.row.classList.contains("pin-condensed"), false);
+ assert.equal(f.row.style.getPropertyValue("--pin-content-max"), "");
+ } finally {
+ f.close();
+ }
+});
+
+test("the collapse is measured from the row's resting place, so it survives being opened mid-scroll", () => {
+ const f = fixture();
+ try {
+ f.scroll(30);
+ f.row.dataset.index = "7";
+ f.viewport.sync(f.scroller);
+ assert.equal(f.row.classList.contains("stuck"), true);
+ assert.equal(f.row.style.getPropertyValue("--pin-content-max"), "109.5px");
+ f.scroll(70);
+ assert.equal(f.row.style.getPropertyValue("--pin-content-max"), "69.5px");
+ } finally {
+ f.close();
+ }
+});
+
+test("rest heights are re-measured for pane and content changes, condensed or not", () => {
+ const f = fixture();
+ try {
+ f.scroll(500);
+ assert.equal(f.row.classList.contains("pin-condensed"), true);
+ f.grow(40);
+ assert.equal(f.row.style.getPropertyValue("--pin-rest-height"), "64px");
+ assert.equal(f.row.classList.contains("pin-condensed"), true);
+ assert.equal(f.row.style.getPropertyValue("--pin-content-max"), "40px");
+ f.grow(800);
+ assert.equal(f.row.style.getPropertyValue("--pin-rest-height"), "163.5px");
+ f.scroll(20);
+ assert.equal(f.row.classList.contains("pin-condensed"), false);
+ assert.equal(f.row.style.getPropertyValue("--pin-content-max"), "119.5px");
+ f.resize(300);
+ assert.equal(f.row.style.getPropertyValue("--pin-rest-height"), "163.5px");
+ f.scroll(0);
+ assert.equal(f.row.style.getPropertyValue("--pin-content-max"), "");
+ } finally {
+ f.close();
+ }
+});
+
+test("rest heights are never taken from an expanded prompt", () => {
+ const f = fixture();
+ try {
+ f.scroll(500);
+ f.toggle.click();
+ assert.equal(f.row.classList.contains("pin-expanded"), true);
+ f.resize(280);
+ assert.equal(f.row.style.getPropertyValue("--pin-rest-height"), "163.5px");
+ f.toggle.click();
+ assert.equal(f.row.style.getPropertyValue("--pin-rest-height"), "163.5px");
+ assert.equal(f.row.style.getPropertyValue("--pin-content-max"), "40px");
+ f.scroll(20);
+ assert.equal(f.row.style.getPropertyValue("--pin-content-max"), "119.5px");
+ } finally {
+ f.close();
+ }
+});
+
+test("the disclosure rides the last visible line while clamped and drops to a row when expanded or over rich content", () => {
+ const css = readFileSync(new URL("../src/shell.css", import.meta.url), "utf8");
+ const bubble = css.match(/\n\.user-bubble \{[^}]*\}/)?.[0] ?? "";
+ assert.match(bubble, /--bubble-bg: color-mix/);
+ assert.match(bubble, /position: relative/);
+ const toggle = css.match(/\n\.pin-toggle \{[^}]*\}/)?.[0] ?? "";
+ assert.match(toggle, /position: absolute/);
+ assert.match(toggle, /height: 1lh/);
+ assert.match(toggle, /background: linear-gradient\(to right, transparent, var\(--bubble-bg\)/);
+ assert.doesNotMatch(toggle, /font-size/);
+ const row =
+ css.match(
+ /\.user-row\.pin-expanded > \.user-bubble > \.pin-toggle,\s*\.message-stack\s+\.user-bubble\s+> \.pin-content:has\(code-block[^{]*~ \.pin-toggle \{[^}]*\}/,
+ )?.[0] ?? "";
+ assert.match(row, /position: static/);
+ assert.match(row, /margin: 6px 0 0 auto/);
+ assert.match(
+ css,
+ /\.user-row\.pin-expanded > \.user-bubble > \.pin-toggle > \.icon \{\s*transform: rotate\(180deg\);/,
+ );
+});
+
+test("the condensed strip is a css contract on the condensed class, with a scroll-driven height on stuck", () => {
+ const css = readFileSync(new URL("../src/shell.css", import.meta.url), "utf8");
+ const condensed =
+ css.match(
+ /\.message-stack \.user-row\.pin-condensed:not\(\.pin-expanded\) \.user-bubble > \.pin-content \{[^}]*\}/,
+ )?.[0] ?? "";
+ assert.match(condensed, /-webkit-line-clamp: 2/);
+ const stuck =
+ css.match(/\.message-stack \.user-row\.stuck:not\(\.pin-expanded\) \.user-bubble > \.pin-content \{[^}]*\}/)?.[0] ??
+ "";
+ assert.match(stuck, /max-height: var\(--pin-content-max, none\)/);
+ assert.doesNotMatch(stuck, /line-clamp|transition/);
+ assert.match(css, /\.user-row\.stuck:not\(\.pin-expanded\) \{\s*min-height: var\(--pin-rest-height\)/);
+ assert.match(
+ css,
+ /\.user-row\.stuck:not\(\.pin-expanded\)\s+\.user-bubble\s+> \.pin-content:has\(code-block[^{]*\{\s*max-height: var\(--pin-content-max, 2lh\)/,
+ );
+ const rest =
+ css.match(
+ /\.message-stack \.user-row:not\(:has\(~ \.user-row\)\):not\(\.pin-expanded\) \.user-bubble > \.pin-content \{[^}]*\}/,
+ )?.[0] ?? "";
+ assert.match(rest, /-webkit-line-clamp: 6/);
+ assert.doesNotMatch(rest, /max-height|transition/);
+ assert.doesNotMatch(css, /pin-condensed[^{]*\{[^}]*transition/);
+});
+
test("expanded prompts reserve pins and chrome when panes resize or content grows", () => {
const f = fixture();
try {
@@ -268,16 +434,17 @@ test("an expanded prompt stays in flow when its chrome alone cannot fit", () =>
test("repeated prompt measurement preserves the disclosure text node", () => {
const f = fixture();
try {
- const label = f.toggle.firstChild;
+ const text = f.toggle.querySelector(".pin-toggle-label")!;
+ const label = text.firstChild;
for (const height of [300, 200, 500]) {
f.resize(height);
- assert.equal(f.toggle.firstChild, label);
+ assert.equal(text.firstChild, label);
}
f.toggle.click();
- const expandedLabel = f.toggle.firstChild;
+ const expandedLabel = text.firstChild;
assert.notEqual(expandedLabel, label);
f.resize(400);
- assert.equal(f.toggle.firstChild, expandedLabel);
+ assert.equal(text.firstChild, expandedLabel);
} finally {
f.close();
}