Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion desktop-app/resources/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -11139,7 +11139,6 @@ ${selector} .arrowheadPath {
renderMathJaxNodes(roots, rawVal, context, { snapshotReviewTargets: true });

decorateReviewTargets();
updateDocumentStats();
updateFindHighlights();
scheduleLineNumberUpdate();
scheduleAdvancedPostProcessRecovery(rawVal, context);
Expand Down Expand Up @@ -11188,6 +11187,10 @@ ${selector} .arrowheadPath {
options = options || {};
const rawVal = markdownEditor.value;
const force = options.force === true;
// Stats must reflect the current editor content on every render call, even when
// the preview HTML itself is skipped below because it's already up to date
// (e.g. switching back to a tab whose content didn't change).
updateDocumentStats();
const previewDocumentId = getActivePreviewDocumentId();
Comment on lines +11190 to +11193
const hasCurrentPreview =
previewHasCommittedRender &&
Expand Down
5 changes: 4 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
Expand Up @@ -11139,7 +11139,6 @@ ${selector} .arrowheadPath {
renderMathJaxNodes(roots, rawVal, context, { snapshotReviewTargets: true });

decorateReviewTargets();
updateDocumentStats();
updateFindHighlights();
scheduleLineNumberUpdate();
scheduleAdvancedPostProcessRecovery(rawVal, context);
Expand Down Expand Up @@ -11188,6 +11187,10 @@ ${selector} .arrowheadPath {
options = options || {};
const rawVal = markdownEditor.value;
const force = options.force === true;
// Stats must reflect the current editor content on every render call, even when
// the preview HTML itself is skipped below because it's already up to date
// (e.g. switching back to a tab whose content didn't change).
updateDocumentStats();
const previewDocumentId = getActivePreviewDocumentId();
Comment on lines +11190 to +11193
const hasCurrentPreview =
previewHasCommittedRender &&
Expand Down
18 changes: 18 additions & 0 deletions tests/e2e/tab-split-sidebar-update.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,24 @@ test('closing a tab keeps the document in Files and reopening restores the tab',
await expect(reopenedRow).toHaveCount(0);
});

test('reopening the only closed tab restores the word/char/reading-time stats', async ({ page }) => {
const closedTabId = await page.locator('#tab-list .tab-item.active').getAttribute('data-tab-id');
await setEditorContent(page, '# Kept document\n\nSome words to count here.');

await expect(page.locator('#word-count')).toHaveText('8');
await expect(page.locator('#char-count')).toHaveText('42');

await page.locator('#tab-list .tab-item.active .tab-close-btn').click();
await expect(page.locator('#word-count')).toHaveText('0');
await expect(page.locator('#char-count')).toHaveText('0');

await page.locator(`.document-tree-row[data-document-id="${closedTabId}"] .document-tree-main`).click();
await expect(page.locator('#markdown-editor')).toHaveValue('# Kept document\n\nSome words to count here.');
await expect(page.locator('#word-count')).toHaveText('8');
await expect(page.locator('#char-count')).toHaveText('42');
await expect(page.locator('#reading-time')).toHaveText('1');
});

test('format toolbar consolidates heading, case, alignment, and insert actions', async ({ page }) => {
await expect(page.locator('[data-md-action="clear-formatting"]')).toHaveCount(0);
await expect(page.locator('[data-md-action="help"]')).toHaveCount(0);
Expand Down
Loading