fix(live): expose full refresh busy and phase progress

Ensure full refresh marks the live projection as building before source refresh awaits, and expose phase-specific counters so language detection progress is determinate.

Covers #40 and #41.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
blomios
2026-10-08 16:20:36 +02:00
parent 09bdaa3ec1
commit ddd7a3f295
7 changed files with 139 additions and 25 deletions

View File

@ -104,7 +104,7 @@ function waitFor(condition, message) {
});
}
test('Settings renders Laya batch progress and removes misleading values when its total is unknown', () => {
test('Settings renders language phase progress accessibly and removes misleading values when its total is unknown', () => {
const { window } = createDom();
const settingsPage = Object.create(window.SettingsPage.prototype);
settingsPage.app = { player: { settings: { languageDetectionMode: 'hybrid' } } };
@ -112,30 +112,33 @@ test('Settings renders Laya batch progress and removes misleading values when it
settingsPage.renderLiveAnalysisStatus({
status: 'building',
phase: 'laya_identity',
layaProcessed: 3,
layaTotal: 8,
phase: 'laya_language',
phaseProcessed: 5,
phaseTotal: 10,
processed: 0,
total: 39348
});
const track = window.document.getElementById('live-analysis-progress-track');
const bar = window.document.getElementById('live-analysis-progress-bar');
assert.equal(window.document.getElementById('live-analysis-status').textContent, 'Analyzing with local AI…');
assert.equal(window.document.getElementById('live-analysis-progress-text').textContent, 'AI batch 3 of 8 · 38%');
assert.equal(track.getAttribute('aria-valuenow'), '38');
assert.equal(bar.style.width, '38%');
assert.equal(window.document.getElementById('live-analysis-status').textContent, 'Detecting stream languages…');
assert.equal(window.document.getElementById('live-analysis-progress-text').textContent, 'Language batch 5 of 10 · 50%');
assert.equal(track.getAttribute('aria-valuemin'), '0');
assert.equal(track.getAttribute('aria-valuemax'), '100');
assert.equal(track.getAttribute('aria-valuenow'), '50');
assert.equal(track.getAttribute('aria-valuetext'), 'Language batch 5 of 10 · 50%');
assert.equal(bar.style.width, '50%');
settingsPage.renderLiveAnalysisStatus({
status: 'building',
phase: 'laya_identity',
phase: 'laya_language',
layaProcessed: 0,
layaTotal: null,
processed: 0,
total: 39348
});
assert.equal(window.document.getElementById('live-analysis-progress-text').textContent, 'In progress…');
assert.equal(window.document.getElementById('live-analysis-progress-text').textContent, 'In progress — this step may take several minutes.');
assert.equal(track.classList.contains('indeterminate'), true);
assert.equal(track.hasAttribute('aria-valuenow'), false);
assert.equal(bar.style.width, '');