mk6umpwt1: Keep the delete error clear of the text-only quote
This commit is contained in:
@@ -257,3 +257,24 @@ describe("long post text stylesheet", () => {
|
||||
expect(css).toMatch(/prefers-reduced-motion: reduce\) \{[^}]*\.slide-reader,\s*\.slide-text\.is-open,/);
|
||||
});
|
||||
});
|
||||
|
||||
describe("delete error on a text-only slide", () => {
|
||||
const css = readFileSync("src/styles/mobile.css", "utf8");
|
||||
const slideOf = (html: string) => html.split("<section").filter((s) => s.includes('data-testid="feed-slide"'));
|
||||
|
||||
it("marks only the slide with the error so the quote box can end above it", () => {
|
||||
const html = render({ deleteErrors: new Set([POSTS[0].key]) });
|
||||
const [own, image] = slideOf(html);
|
||||
expect(own).toContain("slide-has-error");
|
||||
expect(own).toContain("Could not delete the post.");
|
||||
expect(image).not.toContain("slide-has-error");
|
||||
expect(slideOf(render({}))[0]).not.toContain("slide-has-error");
|
||||
});
|
||||
|
||||
it("lifts the quote box by the error line and its gap", () => {
|
||||
const base = Number(/\.slide-quote-w \{[^}]*?bottom: (\d+)px/.exec(css)![1]);
|
||||
const withError = Number(/\.slide-has-error \.slide-quote-w \{ bottom: (\d+)px; \}/.exec(css)![1]);
|
||||
const line = Number(/\.slide-error \{[^}]*?line-height: (\d+)px/.exec(css)![1]);
|
||||
expect(withError).toBe(base + line + 12);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user