Skip to content

Commit

Permalink
Merge pull request #296 from mgreminger/intermediate-fix
Browse files Browse the repository at this point in the history
fix: properly identify no substituion case in intermediate results
  • Loading branch information
mgreminger authored Nov 13, 2024
2 parents fc356b1 + 57b1532 commit 7e86202
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/MathCell.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
8 changes: 7 additions & 1 deletion tests/test_number_format.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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}`);
});

0 comments on commit 7e86202

Please sign in to comment.