-
Notifications
You must be signed in to change notification settings - Fork 321
Split out KaTeX tests; simplify a bit; split KaTeX widgets from other content widgets #1729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@rajveermalviya the code moves in this PR will call for some conflict resolution in order to rebase your open KaTeX PRs atop this one. I'd like those PRs to also match the style changes here, even where Git doesn't flag a merge conflict. The good news on that front is that I think this completes all the changes I had in mind that were likely to have merge conflicts with lots of other KaTeX work. 🙂 I still have other refactors in mind, but they affect narrower swaths of code and I think mostly won't call for any changes to existing open PRs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for these refactors @gnprice! LGTM.
…ntation This way we maintain our usual parallel between the files that tests live in and the files with the code the tests are about. There's more we can do to make use of having a specific class for these. But we'll do that in separate commits, so that this massive move commit is as pure of a move as possible.
This will let us split some of this file's tests to a different file and have them still use these helpers.
This is a pretty self-contained swath of our content widgets -- the only interface the others use from these is KatexWidget. So it works well to split into a separate file, paralleling the model files.
This removes some repetitive noisy bits from these examples, as well as a level of indentation.
This is available to us now that these strings don't include the leading "```math" and trailing "```" lines, and the newlines separating them from the main content.
We already have an assert enforcing that exactly one of these is passed with a non-null (i.e. non-default) value. So there's no risk of forgetting to specify a detail that should be specified.
We have a lot of calls to the KatexSpanNode constructor in our tests, and a large fraction of them pass an empty `styles`. Let that be the default, reducing some noise. It's a natural default, since it effectively means "do nothing".
a03c898
to
5f85799
Compare
This is the next round, after #1722, of the refactors I'd been contemplating for the KaTeX code but hadn't wanted to do before the logic we'd had in recent releases was merged. In this branch:
Selected commit messages
20eb9af katex test [nfc]: Split parsing tests to their own file, like implementation
This way we maintain our usual parallel between the files that tests
live in and the files with the code the tests are about.
There's more we can do to make use of having a specific class for
these. But we'll do that in separate commits, so that this massive
move commit is as pure of a move as possible.
286fede katex [nfc]: Move KaTeX widgets to their own file
This is a pretty self-contained swath of our content widgets -- the
only interface the others use from these is KatexWidget. So it works
well to split into a separate file, paralleling the model files.
3d5a4d8 katex test [nfc]: Make some examples more compact
f14e318 katex test [nfc]: Simplify a bit with a KatexExample.block constructor
This removes some repetitive noisy bits from these examples,
as well as a level of indentation.
1811266 katex test [nfc]: Use Dart raw strings to avoid double-backslash
This is available to us now that these strings don't include the
leading "
math" and trailing "
" lines, and the newlinesseparating them from the main content.
afb3692 katex [nfc]: On KatexSpanNode constructor let text or nodes be omitted
We already have an assert enforcing that exactly one of these is
passed with a non-null (i.e. non-default) value. So there's no
risk of forgetting to specify a detail that should be specified.
af80c52 katex [nfc]: Let KatexSpanNode.styles default to empty
We have a lot of calls to the KatexSpanNode constructor in our tests,
and a large fraction of them pass an empty
styles
. Let that be thedefault, reducing some noise. It's a natural default, since it
effectively means "do nothing".
a03c898 katex [nfc]: Add docs explaining the different content-node classes