diff --git a/deploy/index.html b/deploy/index.html index 323453b8..1fac2f82 100644 --- a/deploy/index.html +++ b/deploy/index.html @@ -184,7 +184,7 @@ } .status-info { background: #e8f0fe; - color: #1a73e8; + color: #1765cc; } .status-ok { background: #e6f4ea; diff --git a/deploy/tests/ui.spec.js b/deploy/tests/ui.spec.js index c627953a..8001ba55 100644 --- a/deploy/tests/ui.spec.js +++ b/deploy/tests/ui.spec.js @@ -1290,6 +1290,37 @@ test.describe('deploy index.html', () => { await expect(page.locator('#status-msg.status-error')).toBeVisible() }) + test('status-info banner meets WCAG AA contrast (>= 4.5:1)', async ({ + page, + }) => { + const contrast = await page.evaluate(() => { + const el = document.createElement('div') + el.className = 'status-msg status-info' + el.textContent = 'sample' + document.body.appendChild(el) + const cs = getComputedStyle(el) + const fg = cs.color + const bg = cs.backgroundColor + el.remove() + + const channels = (s) => + ((s || '').match(/\d+(\.\d+)?/g) || []).map(Number) + const luminance = ([r, g, b]) => { + const lin = [r, g, b].map((v) => { + v /= 255 + return v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4) + }) + return 0.2126 * lin[0] + 0.7152 * lin[1] + 0.0722 * lin[2] + } + const l1 = luminance(channels(fg)) + const l2 = luminance(channels(bg)) + const lighter = Math.max(l1, l2) + const darker = Math.min(l1, l2) + return (lighter + 0.05) / (darker + 0.05) + }) + expect(contrast).toBeGreaterThanOrEqual(4.5) + }) + test('successful deploy shows status-ok class', async ({ page }) => { await mockSuccessfulDeploy(page) await signIn(page) diff --git a/gas-installer/Index.html b/gas-installer/Index.html index f660ace0..84f1b3b0 100644 --- a/gas-installer/Index.html +++ b/gas-installer/Index.html @@ -168,7 +168,7 @@ } .status-info { background: #e8f0fe; - color: #1a73e8; + color: #1765cc; } .status-ok { background: #e6f4ea; diff --git a/gas-installer/tests/ui.spec.js b/gas-installer/tests/ui.spec.js index d1418e82..5d63894f 100644 --- a/gas-installer/tests/ui.spec.js +++ b/gas-installer/tests/ui.spec.js @@ -205,6 +205,37 @@ test.describe('gas-installer Index.html', () => { await expect(page.locator('#status-msg.status-info')).toBeVisible() }) + test('status-info banner meets WCAG AA contrast (>= 4.5:1)', async ({ + page, + }) => { + const contrast = await page.evaluate(() => { + const el = document.createElement('div') + el.className = 'status-msg status-info' + el.textContent = 'sample' + document.body.appendChild(el) + const cs = getComputedStyle(el) + const fg = cs.color + const bg = cs.backgroundColor + el.remove() + + const channels = (s) => + ((s || '').match(/\d+(\.\d+)?/g) || []).map(Number) + const luminance = ([r, g, b]) => { + const lin = [r, g, b].map((v) => { + v /= 255 + return v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4) + }) + return 0.2126 * lin[0] + 0.7152 * lin[1] + 0.0722 * lin[2] + } + const l1 = luminance(channels(fg)) + const l2 = luminance(channels(bg)) + const lighter = Math.max(l1, l2) + const darker = Math.min(l1, l2) + return (lighter + 0.05) / (darker + 0.05) + }) + expect(contrast).toBeGreaterThanOrEqual(4.5) + }) + test('showStatus ok applies status-ok class', async ({ page }) => { await page.locator('#script-gmail').click() await page.fill('#project-title', 'My Project')