feat(voyage): implement two-opacity pattern (active/inactive/resolved)
This commit is contained in:
parent
224517f205
commit
df0e7837af
2 changed files with 88 additions and 4 deletions
|
|
@ -299,3 +299,41 @@ test('voyage-playground.html keyboard nav announces via aria-live region (v4.3 S
|
|||
// The wireKeyboardNav body contains announce(... ' av ' ...) for nav-position announce
|
||||
assert.match(text, /announce\('Annotering '/, 'aria-live announce on annotation navigation required');
|
||||
});
|
||||
|
||||
// v4.3 Step 21 — two-opacity pattern (active 100% / inactive 40% / resolved 30% strikethrough)
|
||||
test('voyage-playground.html declares two-opacity inactive default for badges (v4.3 Step 21)', () => {
|
||||
const text = readFileSync(HTML, 'utf-8');
|
||||
// Default badge rule must include opacity: 0.4 (inactive)
|
||||
assert.match(text, /\.voyage-anchor-badge\s*\{[^}]*opacity:\s*0\.4/s, '.voyage-anchor-badge default opacity: 0.4 required');
|
||||
});
|
||||
|
||||
test('voyage-playground.html declares two-opacity active state for badges (v4.3 Step 21)', () => {
|
||||
const text = readFileSync(HTML, 'utf-8');
|
||||
// Active state: data-active="true" must restore opacity to 1
|
||||
assert.match(text, /\.voyage-anchor-badge\[data-active="true"\]\s*\{[^}]*opacity:\s*1/s, 'data-active opacity: 1 required');
|
||||
});
|
||||
|
||||
test('voyage-playground.html declares two-opacity resolved state for badges (v4.3 Step 21)', () => {
|
||||
const text = readFileSync(HTML, 'utf-8');
|
||||
// Resolved state: data-resolved="true" must produce opacity 0.3 + line-through
|
||||
assert.match(text, /\.voyage-anchor-badge\[data-resolved="true"\]\s*\{[^}]*opacity:\s*0\.3/s, 'data-resolved opacity: 0.3 required');
|
||||
assert.match(text, /\.voyage-anchor-badge\[data-resolved="true"\]\s*\{[^}]*text-decoration:\s*line-through/s, 'data-resolved line-through required');
|
||||
});
|
||||
|
||||
test('voyage-playground.html declares two-opacity for sidebar list-items (v4.3 Step 21)', () => {
|
||||
const text = readFileSync(HTML, 'utf-8');
|
||||
// List-item default opacity 0.4
|
||||
assert.match(text, /\.voyage-annotation-list__items\s+li\s*\{[^}]*opacity:\s*0\.4/s, 'list-item default opacity: 0.4 required');
|
||||
// List-item active overrides to 1
|
||||
assert.match(text, /\.voyage-annotation-list__items\s+li\[data-active="true"\][^}]*opacity:\s*1/s, 'list-item active opacity: 1 required');
|
||||
// List-item resolved opacity 0.3
|
||||
assert.match(text, /\.voyage-annotation-list__items\s+li\[data-resolved="true"\][^}]*opacity:\s*0\.3/s, 'list-item resolved opacity: 0.3 required');
|
||||
});
|
||||
|
||||
test('voyage-playground.html setActiveAnchor toggles data-active on badges (v4.3 Step 21)', () => {
|
||||
const text = readFileSync(HTML, 'utf-8');
|
||||
// setActiveAnchor must clear prior data-active and set new one
|
||||
assert.match(text, /setAttribute\('data-active',\s*'true'\)/, 'data-active set on active badge required');
|
||||
// injectAnchorBadges must propagate resolved state to badge data-resolved
|
||||
assert.match(text, /setAttribute\('data-resolved',\s*'true'\)/, 'data-resolved set on resolved badge required');
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue