-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Add new rustdoc-GUI to ensure correct font is used on module items #85669
Add new rustdoc-GUI to ensure correct font is used on module items #85669
Conversation
This test seems fragile: it's testing a specific DOM layout. For instance it will be immediately broken by #85651. As I said on #85651, we should give a specific class to things, e.g. |
Contrary to the CSS rules, I think the test on the opposite should be very layout specific so then when you make a modification, it'll break and you'll be forced to update it and check if it's still working as expected. |
When tests break any time you make a modification, and have a simple update path ("just update the expected output to the new output"), they don't actually serve to prevent breakages. People see the test failure, say "oh yeah that's expected because I changed the DOM," and update the test. Brittle tests also undermine people's faith that test failures are meaningful and important, and they create a barrier to new people entering a project - since it may not be as clear to a new person why the tests are failing or how to fix them. It's much better to have flexible tests that test a semantic property rather than a structural one. For instance, in this case the real properties we are trying to verify are things like: "the string WhoLetTheDogOut shows up in the DOM after the Enums heading with a font of Fira Sans"; "the string 'Just a normal enum' show up in the DOM after the Enums heading with a Font of Source Serif 4". We have a very good example in #85651 (comment). @dns2utf8 is making the same sort of change I was making when I originally broke the font selection for item names in search results: a
The former fails, even if you correctly update the CSS. The latter succeeds if and only if you correctly update the CSS. And when it fails it tells you something more meaningful about the intent of the test - that item names should be rendered in our sans serif font. |
This is the same for more relaxed tests though. I guess I'm afraid that a change would break something but that the selector would still point to something "valid" from the test point of view. Well, you're more experienced than me so let's go with your suggestion! |
Triage: |
Now that the mobile first The main difference is that because of the dynamic layout we no longer have a common grouping element (formerly I quickly threw this together, so it is not tested with the latest commit:
|
@dns2utf8 are you interested in making a PR with that test? |
This comment has been minimized.
This comment has been minimized.
Updating the tests now. ;) |
790a285
to
e701d8a
Compare
Updated. |
Sure, I will get on it unless @GuillaumeGomez has implemented it already |
Very sorry for the confusion, I did not see the comments from @GuillaumeGomez for some reason 😅 |
It's fine, we wrote almost exactly the same code (in #88089). Let's merge yours. ;) |
…aumeGomez Rustdoc font test Add a font test based on rust-lang#85669 fixes rust-lang#85632. r? `@jsha` `@GuillaumeGomez`
Fixes #85632.
r? @jsha