26 lines
1.5 KiB
JavaScript
26 lines
1.5 KiB
JavaScript
const assert = require('node:assert/strict')
|
|
const fs = require('node:fs')
|
|
const src = fs.readFileSync('src/pages/index/index.ux', 'utf8')
|
|
const manifest = JSON.parse(fs.readFileSync('src/manifest.json'))
|
|
function css(name, prop) {
|
|
const block = src.match(new RegExp('\\.' + name + '\\s*\\{([^}]+)'))[1]
|
|
return block.match(new RegExp(prop + ':\\s*([^;]+)'))[1].trim()
|
|
}
|
|
assert.equal(css('page', 'background-color'), '#000000', 'page must be AMOLED black')
|
|
assert.equal(manifest.display.backgroundColor, '#000000')
|
|
assert.match(src, /<list\s[^>]*class="prayers"/, 'native swipe-scrollable list')
|
|
assert.match(src, /<list-item[^>]*type="prayer"[^>]*for="\{\{ row in rows \}\}"/)
|
|
assert.ok(parseFloat(css('rowName', 'font-size')) >= 28)
|
|
assert.ok(parseFloat(css('rowTime', 'font-size')) >= 36)
|
|
const top = parseFloat(css('prayers', 'top'))
|
|
const height = parseFloat(css('prayers', 'height'))
|
|
const width = parseFloat(css('prayers', 'width'))
|
|
const dy = Math.max(Math.abs(top - 233), Math.abs(top + height - 233))
|
|
assert.ok(width <= 2 * Math.sqrt(233 ** 2 - dy ** 2) - 20, 'whole scroll viewport fits circle')
|
|
const rowH = parseFloat(css('row', 'height'))
|
|
const pad = parseFloat(css('spacer', 'height'))
|
|
assert.equal(pad, (height - rowH) / 2, 'first/last rows can reach viewport center')
|
|
assert.ok(6 * rowH + 2 * pad > height, 'content actually scrolls')
|
|
assert.ok(!src.includes('onBackPress'), 'system back still exits')
|
|
console.log('AMOLED, large text, scroll wiring and circular viewport checks passed')
|