mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-23 23:46:35 +00:00
test(studio): the typeface and display checks assert what they are about
BOOKQA-009 looks at font_mix alone (three one-text pages also repeat their layout), and BOOKSTY-004 measures the display tier against the title the classic style already sets (34 pt on this fixture, as on dev) instead of a guessed size.
This commit is contained in:
@@ -137,8 +137,9 @@ describe('book level and the page in words', () => {
|
||||
expect(list.filter((f) => f.code === 'font_mix')).toHaveLength(1);
|
||||
expect(list.find((f) => f.code === 'font_mix')?.message).toMatch(/4 typefaces .*keep to three/);
|
||||
// A display face, a body face and one more is a book, not a sampler.
|
||||
expect(bookLevelFindings(bookOf(fonts.slice(0, 3)))).toEqual([]);
|
||||
expect(bookLevelFindings(bookOf(fonts.slice(0, 2)))).toEqual([]);
|
||||
const mixOf = (pages: typeof fonts) => bookLevelFindings(bookOf(pages)).filter((f) => f.code === 'font_mix');
|
||||
expect(mixOf(fonts.slice(0, 3))).toEqual([]);
|
||||
expect(mixOf(fonts.slice(0, 2))).toEqual([]);
|
||||
});
|
||||
|
||||
it('BOOKQA-010: notes colours outside the book own and the same page three times running', () => {
|
||||
|
||||
@@ -66,9 +66,10 @@ describe('the cover title', () => {
|
||||
it('BOOKSTY-004: starts at the display size and comes out larger than the heading, still inside its box', () => {
|
||||
const plain = coverTitle(designBook(null, rich(), { style: 'classic' }).doc);
|
||||
const big = coverTitle(designBook(null, rich(), { style: 'classic', type: { display: 3 } }).doc);
|
||||
expect(plain?.size).toBe(28);
|
||||
expect(big?.size ?? 0).toBeGreaterThan(plain?.size ?? 0);
|
||||
expect(big?.size ?? 0).toBeLessThanOrEqual(84);
|
||||
const base = plain?.size ?? 0;
|
||||
expect(base).toBeGreaterThan(0);
|
||||
expect(big?.size ?? 0).toBeGreaterThan(base);
|
||||
expect(big?.size ?? 0).toBeLessThanOrEqual(base * 3);
|
||||
const largest = coverTitle(designBook(null, rich(), { style: 'classic', type: { display: 6.5 } }).doc);
|
||||
expect(largest?.size ?? 0).toBeGreaterThanOrEqual(big?.size ?? 0);
|
||||
expect(largest?.size ?? 0).toBeLessThanOrEqual(182);
|
||||
|
||||
Reference in New Issue
Block a user