check:evangelical-share reads the life grids as SVG: the week and year numbers are text.lc-t, and the reader's words are checked with the tags stripped (the grid's markup names data-weeks as geometry)
This commit is contained in:
parent
63cef78455
commit
9910b7e410
2 changed files with 5 additions and 3 deletions
|
|
@ -90,7 +90,9 @@ const notes = []
|
|||
if (!partial.includes(`5 ${ppl}`) || !partial.includes(`995 ${ppl}`)) {
|
||||
fails.push(`a 0.5% list of 1,000 people does not state both totals ("5 ${ppl}" who follow Jesus, "995 ${ppl}" who do not yet)`)
|
||||
} else notes.push(' ok both totals are stated in people: 5 who follow Jesus, 995 who do not yet')
|
||||
if (/week/i.test(partial) || /class="lc-(wk|y)"/.test(partial)) fails.push('the page still counts in weeks or draws a week/year axis')
|
||||
// The grid is one SVG now (lifeGrid): its week and year numbers are <text class="lc-t">, and its markup names
|
||||
// `data-weeks` as geometry, so the WORDS a reader sees are read with the tags stripped.
|
||||
if (/week/i.test(partial.replace(/<[^>]+>/g, ' ')) || /class="lc-t/.test(partial)) fails.push('the page still counts in weeks or draws a week/year axis')
|
||||
else notes.push(' ok no weeks and no week/year axis on the page')
|
||||
// A TINY SHARE: the totals come from the unrounded figure. 0.004% of 1,000,000,000 is 40,000 people,
|
||||
// which must not print as 0 because the percentage rounds to 0.00.
|
||||
|
|
@ -98,7 +100,7 @@ const notes = []
|
|||
if (!tiny.includes(`40,000 ${ppl}`) || !/ev-pct"><0\.01%</.test(tiny)) fails.push('a 0.004% share of a billion does not print 40,000 people and "<0.01%"')
|
||||
else notes.push(' ok a share below the printed digits keeps its real total (40,000 people) and reads "<0.01%"')
|
||||
// NEG CONTROL: the life page itself keeps its axes, so the axis test above can see one when it is there.
|
||||
if (!/class="lc-wk"/.test(R.lifePage(zone))) fails.push('the life page lost its week axis (the axis check above cannot fail)')
|
||||
if (!/class="lc-t"/.test(R.lifePage(zone))) fails.push('the life page lost its week axis (the axis check above cannot fail)')
|
||||
}
|
||||
|
||||
for (const n of notes) console.log(n)
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ ok(!/<em>[^<]*<\/em><\/span>/.test(full.slice(full.indexOf('class="card"'))), 't
|
|||
const ev = boxes(grid(full, 'sheet-christian'))
|
||||
ok(ev.total === 5200 && ev.on.length === Math.round(0.032 * 5200) && ev.on.every((v, i) => v === i),
|
||||
`the %-evangelical grid should shade 3.2% = ${Math.round(0.032 * 5200)} boxes FROM THE TOP, got ${ev.on.length} of ${ev.total}`)
|
||||
// THE SAME TABLE: the people grid has the life grid's exact shape (the Driver: the same aspect ratio).
|
||||
// THE SAME TABLE: the people grid has the life grid's exact shape (one aspect ratio for both pages).
|
||||
const vb = (svg) => (svg.match(/viewBox="([^"]+)"/) || [])[1]
|
||||
ok(vb(grid(full, 'sheet-life')) && vb(grid(full, 'sheet-life')) === vb(grid(full, 'sheet-christian')), 'the people grid should have the life grid\'s exact shape')
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue