-
Notifications
You must be signed in to change notification settings - Fork 322
katex: Remove renderKaTex experimental flag #1742
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
Merged
gnprice
merged 3 commits into
zulip:main
from
rajveermalviya:pr-tex-drop-experimental-flag
Jul 28, 2025
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,6 @@ import '../example_data.dart' as eg; | |
import '../flutter_checks.dart'; | ||
import '../model/binding.dart'; | ||
import '../model/content_test.dart'; | ||
import '../model/store_checks.dart'; | ||
import '../model/test_store.dart'; | ||
import '../test_images.dart'; | ||
import '../test_navigation.dart'; | ||
|
@@ -566,23 +565,14 @@ void main() { | |
|
||
testContentSmoke(ContentExample.mathBlock); | ||
|
||
testWidgets('displays KaTeX source; experimental flag disabled', (tester) async { | ||
addTearDown(testBinding.reset); | ||
final globalSettings = testBinding.globalStore.settings; | ||
await globalSettings.setBool(BoolGlobalSetting.renderKatex, false); | ||
|
||
testWidgets('displays KaTeX content', (tester) async { | ||
await prepareContent(tester, plainContent(ContentExample.mathBlock.html)); | ||
tester.widget(find.text(r'\lambda', findRichText: true)); | ||
tester.widget(find.text('λ', findRichText: true)); | ||
}); | ||
|
||
testWidgets('displays KaTeX content; experimental flag enabled', (tester) async { | ||
addTearDown(testBinding.reset); | ||
final globalSettings = testBinding.globalStore.settings; | ||
await globalSettings.setBool(BoolGlobalSetting.renderKatex, true); | ||
check(globalSettings).getBool(BoolGlobalSetting.renderKatex).isTrue(); | ||
|
||
await prepareContent(tester, plainContent(ContentExample.mathBlock.html)); | ||
tester.widget(find.text('λ', findRichText: true)); | ||
testWidgets('fallback to displaying KaTeX source if unsupported KaTeX HTML', (tester) async { | ||
await prepareContent(tester, plainContent(ContentExample.mathBlockUnknown.html)); | ||
tester.widget(find.text(r'\lambda', findRichText: true)); | ||
}); | ||
}); | ||
|
||
|
@@ -1000,11 +990,6 @@ void main() { | |
testContentSmoke(ContentExample.mathInline); | ||
|
||
testWidgets('maintains font-size ratio with surrounding text', (tester) async { | ||
addTearDown(testBinding.reset); | ||
final globalSettings = testBinding.globalStore.settings; | ||
await globalSettings.setBool(BoolGlobalSetting.renderKatex, true); | ||
check(globalSettings.getBool(BoolGlobalSetting.renderKatex)).isTrue(); | ||
|
||
const html = '<span class="katex">' | ||
'<span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>λ</mi></mrow>' | ||
'<annotation encoding="application/x-tex"> \\lambda </annotation></semantics></math></span>' | ||
|
@@ -1025,50 +1010,27 @@ void main() { | |
}); | ||
}); | ||
|
||
testWidgets('maintains font-size ratio with surrounding text, when showing TeX source', (tester) async { | ||
const html = '<span class="katex">' | ||
'<span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>λ</mi></mrow>' | ||
'<annotation encoding="application/x-tex"> \\lambda </annotation></semantics></math></span>' | ||
'<span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal">λ</span></span></span></span>'; | ||
await checkFontSizeRatio(tester, | ||
targetHtml: html, | ||
targetFontSizeFinder: mkTargetFontSizeFinderFromPattern(r'λ')); | ||
}, skip: true // TODO(#46): adapt this test | ||
// (it needs a more complex targetFontSizeFinder; | ||
// see other uses in this file for examples.) | ||
); | ||
|
||
testWidgets('maintains font-size ratio with surrounding text, when showing TeX source', (tester) async { | ||
addTearDown(testBinding.reset); | ||
final globalSettings = testBinding.globalStore.settings; | ||
await globalSettings.setBool(BoolGlobalSetting.renderKatex, false); | ||
|
||
const html = '<span class="katex">' | ||
testWidgets('maintains font-size ratio with surrounding text, when falling back to TeX source', (tester) async { | ||
const unsupportedHtml = '<span class="katex">' | ||
'<span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>λ</mi></mrow>' | ||
'<annotation encoding="application/x-tex"> \\lambda </annotation></semantics></math></span>' | ||
'<span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal">λ</span></span></span></span>'; | ||
'<span class="katex-html" aria-hidden="true">' | ||
'<span class="base unknown">' // Server doesn't generate this 'unknown' class. | ||
'<span class="strut" style="height:0.6944em;"></span>' | ||
'<span class="mord mathnormal">λ</span></span></span></span>'; | ||
await checkFontSizeRatio(tester, | ||
targetHtml: html, | ||
targetHtml: unsupportedHtml, | ||
targetFontSizeFinder: mkTargetFontSizeFinderFromPattern(r'\lambda')); | ||
}); | ||
|
||
testWidgets('displays KaTeX source; experimental flag disabled', (tester) async { | ||
addTearDown(testBinding.reset); | ||
final globalSettings = testBinding.globalStore.settings; | ||
await globalSettings.setBool(BoolGlobalSetting.renderKatex, false); | ||
|
||
testWidgets('displays KaTeX content', (tester) async { | ||
await prepareContent(tester, plainContent(ContentExample.mathInline.html)); | ||
tester.widget(find.text(r'\lambda', findRichText: true)); | ||
tester.widget(find.text('λ', findRichText: true)); | ||
}); | ||
|
||
testWidgets('displays KaTeX content; experimental flag enabled', (tester) async { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: make summary line more specific
There's room in that summary line to put some of that information from the body, to give an idea of what the reordering is about. Like:
|
||
addTearDown(testBinding.reset); | ||
final globalSettings = testBinding.globalStore.settings; | ||
await globalSettings.setBool(BoolGlobalSetting.renderKatex, true); | ||
check(globalSettings.getBool(BoolGlobalSetting.renderKatex)).isTrue(); | ||
|
||
await prepareContent(tester, plainContent(ContentExample.mathInline.html)); | ||
tester.widget(find.text('λ', findRichText: true)); | ||
testWidgets('fallback to displaying KaTeX source if unsupported KaTeX HTML', (tester) async { | ||
await prepareContent(tester, plainContent(ContentExample.mathInlineUnknown.html)); | ||
tester.widget(find.text(r'\lambda')); | ||
}); | ||
}); | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
nit:
rather, it's a skipped duplicate such test — there's another KaTeX font-size ratio test, which this is a duplicate of, but there's no other skipped KaTeX font-size ratio test, so it can't be a duplicate within that category.
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.
Also please add a sentence to the commit message clarifying that the existing test this duplicates is the one above it, not the one below. I initially read it as the latter (because the descriptions match — my conflict-resolution error, probably, somewhere in the chain of cherry-picking that led to b073c6b / #1270), and was going to comment that it's not actually a duplicate of that 🙂