diff --git a/src/MathCell.svelte b/src/MathCell.svelte index 4abff9a0..868477b0 100644 --- a/src/MathCell.svelte +++ b/src/MathCell.svelte @@ -340,7 +340,8 @@ newLatex = ` ${currentResultLatex.resultLatex}${currentResultLatex.resultUnitsLatex} `; } - if (startingLatex.slice(replacement.location, replacement.location+replacement.deletionLength) === newLatex.trim()) { + if (startingLatex.slice(replacement.location, replacement.location+replacement.deletionLength).replace(/[ \\{}]/g, '') === + newLatex.trim().replace(/[ \\{}]/g, '')) { continue; } diff --git a/tests/test_number_format.spec.mjs b/tests/test_number_format.spec.mjs index 3ae4c2d4..6054c883 100644 --- a/tests/test_number_format.spec.mjs +++ b/tests/test_number_format.spec.mjs @@ -644,7 +644,10 @@ test('Test intermediate results with symbolic values', async () => { test('Test intermediate results with only symbolic values', async () => { await page.setLatex(0, String.raw`x\cdot y=`); - // turn on symbolic results + await page.locator('#add-math-cell').click(); + await page.setLatex(1, String.raw`\alpha_1\cdot a=`); + + // turn on intermediate results await page.getByRole('button', { name: 'Sheet Settings' }).click(); await page.locator('label').filter({ hasText: 'Show Intermediate Results' }).click(); await page.getByRole('button', { name: 'Confirm' }).click(); @@ -654,4 +657,7 @@ test('Test intermediate results with only symbolic values', async () => { // there should be no intermediate result let content = await page.textContent('#result-value-0'); expect(content).toBe(String.raw`x \cdot y`); + + content = await page.textContent('#result-value-1'); + expect(content).toBe(String.raw`a \cdot \alpha_{1}`); });