Skip to content

Commit 73b69a3

Browse files
authored
Merge pull request #42 from pie-framework/fix/PD-1306
fix(literal-validation): do not validate fractions with calculated value PD-1306
2 parents f5f9328 + 10a2cb1 commit 73b69a3

2 files changed

Lines changed: 21 additions & 8 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
export default {
2+
mode: "literal",
3+
tests: [
4+
{
5+
target: "\\frac{5}{4}",
6+
eq: [],
7+
ne: ["1.25", "\\frac{10}{8}"],
8+
},
9+
{
10+
target: "\\frac{10}{2}",
11+
eq: [],
12+
ne: ["5", "\\frac{20}{4}"],
13+
},
14+
{
15+
target: "\\frac{2}{1}",
16+
eq: [],
17+
ne: ["2", "\\frac{4}{2}"],
18+
}
19+
],
20+
};

src/literal/index.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,5 @@ export const isMathEqual = (a: MathNode, b: MathNode, opts: LiteralOpts) => {
3131
b = sort(b);
3232
}
3333

34-
let equalTex;
35-
36-
// @ts-ignore
37-
if (!a.isUnit) {
38-
equalTex = a.toTex().trim() === b.toTex().trim();
39-
}
40-
41-
return a.equals(b) || equalTex;
34+
return a.equals(b)
4235
};

0 commit comments

Comments
 (0)