Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions src/domain/generation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,63 @@ describe("book generation", () => {
)
})

it.each([
"static-text",
"image-frame",
"gallery-frame",
"rectangle",
"circle",
"line",
"decorative-image",
] as const)("warns when a %s extends beyond the bleed boundary", (type) => {
const layout = layoutFixture()
layout.schema = addElement(
layout.schema,
type,
type === "image-frame" || type === "gallery-frame" ? "photos" : undefined
)
const element = layout.schema.elements.at(-1)!
element.geometry = { ...element.geometry, x: -4 }

expect(
inspectSubmissionPage(
"page",
layout,
submissionFixture(submissionIds[0]!, 1),
completeForm,
[]
)
).toContainEqual(
expect.objectContaining({
code: "outside-print-area",
elementId: element.id,
blocking: false,
})
)
})

it("keeps question-bound text beyond the bleed boundary blocking", () => {
const layout = layoutFixture()
const element = layout.schema.elements.find((candidate) => candidate.type === "bound-text")!
element.geometry = { ...element.geometry, x: -4 }

expect(
inspectSubmissionPage(
"page",
layout,
submissionFixture(submissionIds[0]!, 1),
completeForm,
[]
)
).toContainEqual(
expect.objectContaining({
code: "outside-print-area",
elementId: element.id,
blocking: true,
})
)
})

it("distinguishes repeated text bounding boxes bound to the same question", () => {
const layout = layoutFixture()
const element = layout.schema.elements.find((candidate) => candidate.type === "bound-text")!
Expand Down
2 changes: 1 addition & 1 deletion src/domain/generation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export function inspectSubmissionPage(
pageId,
"outside-print-area",
"An element extends beyond the 3 mm bleed boundary.",
true,
element.type === "bound-text",
element.id
)
)
Expand Down
29 changes: 29 additions & 0 deletions src/domain/preflight.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,33 @@ describe("preflight", () => {
)
expect(hasFailedPreflight(report)).toBe(false)
})

it("allows export when a static element extends beyond the bleed boundary", () => {
const generated = book()
generated.pages[0]!.problems.push({
id: "static-outside-print-area",
code: "outside-print-area",
pageId: generated.pages[0]!.id,
elementId: "static-element",
message: "A static element extends beyond the bleed boundary.",
blocking: false,
})
const report = createPreflightReport({
projectId: generated.projectId,
book: generated,
bookStatus: "current",
pageCount: generated.pages.length,
fontsEmbedded: true,
outputIntentEmbedded: true,
pageBoxesValid: true,
assetResolutionMetadata: true,
assetResolutionCount: 0,
marks: false,
})

expect(report.checks).toContainEqual(
expect.objectContaining({ id: "blocking-problems", status: "pass" })
)
expect(hasFailedPreflight(report)).toBe(false)
})
})
Binary file added visual-artifacts/issues/56/after-book-review.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added visual-artifacts/issues/56/after-export.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added visual-artifacts/issues/56/before-export.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading