Conversation
|
I wonder if we can test some these behaviors with unit tests that verify that one |
|
I put in the test case from #946 into the screenshotter tests. I haven't thought of a more elegant way to test the parse comparison. |
|
I was hoping the following added tests in describe("An aligned environment", function() {
...
it("should eliminate final newline 1", function() {
expect("\\begin{aligned}x&y\\\\&z\\\\\\end{aligned}")
.toParseLike("\\begin{aligned}x&y\\\\&w\\end{aligned}");
});
it("should eliminate final newline 2", function() {
expect("\\begin{aligned}x&y\\\\z&w\\\\\\end{aligned}")
.toParseLike("\\begin{aligned}x&y\\\\z&w\\end{aligned}");
});I guess we could add a test that confirms the right number of rows in the parsed align table. |
|
@edemaine thanks for checking that. I would've expected that to work. :\ |
|
The code that that removes a trailing Maybe I can think of a unit test that works on Not right away though. My next few days are pretty booked up. If someone would like to suggest a test sooner than that, feel free. |
But the Parser.js imports environments.js which imports array.js and we do call the handler for a particular environment when we encounter it from Parser.js. I'd be interested in seeing how those parse trees diff for those case where we expect them to be the same. |
|
The most recent commit fixes a bug and adds two tests that confirm the correct number of rows. |
|
Can anyone suggest why Travis has not completed its check? Or what I can try to get it working? When I ran |
|
@ronkok not sure why. I'm going to "update branch" and see if that does anything. |
k4b7
left a comment
There was a problem hiding this comment.
Sorry for the delay in reviewing this. Code changes look good, requesting a minor update to one of the tests. See inline comments for details.
test/katex-spec.js
Outdated
| }); | ||
|
|
||
| it("should eat a final newline", function() { | ||
| const m3 = getParsed("\\begin{matrix}a&b\\\\ c&d \\end{matrix}")[0]; |
There was a problem hiding this comment.
Should the TeX code be:
\\begin{matrix}a&b\\\\ c&d \\\\ \\end{matrix}
to include the extra newline that's supposed to get eaten?
There was a problem hiding this comment.
Right you are. I'll make the change and resubmit.
| && lastRow.value.length === 1 | ||
| && lastRow.value[0].value.length === 0) { | ||
| && lastRow.length === 1 | ||
| && lastRow[0].value.value[0].value.length === 0) { |
There was a problem hiding this comment.
Thanks for fixing this... I wish our parse tree was nicer.
|
@kevinbarabash Thank you. That did the trick. |
|
@ronkok thanks for fixing that test. |
|
FWIW, I think this rather significant bug fix is worth a release. Thanks guys for making it happen! |
Issue #946 identified a case in which
array.jsate the final row of a well-writtenalignedenvironment.This PR modifies code from PR #479 to fix this problem and to also continue to eat a trailing
\\submitted to any environment.