-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Open impl blocks by default #84552
Merged
bors
merged 6 commits into
rust-lang:master
from
GuillaumeGomez:open-impl-blocks-by-default
Apr 27, 2021
Merged
Open impl blocks by default #84552
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
33a7098
Open all impl blocks by default
GuillaumeGomez bcad1ec
Add test to ensure that impl blocks are open by default
GuillaumeGomez 175cd9b
Remove unneeded rustdoc-gui test because DOM changed
GuillaumeGomez 1afea79
Fix expansion for item pointed to by the URL hash
GuillaumeGomez 9b44c4b
Add test to ensure that the element pointed to by the URL hash is "ex…
GuillaumeGomez 6c8969c
Add open attribute on details which are supposed to be open by defaul…
GuillaumeGomez 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 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 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 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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// This test ensures that the element corresponding to the hash is displayed. | ||
goto: file://|DOC_PATH|/struct.Foo.html#method.borrow | ||
// In the blanket implementations list, "Borrow" is the second one, hence the ":nth(2)". | ||
assert: ("#blanket-implementations-list > details:nth-child(2)", "open", "") | ||
// Please note the "\" below is needed because otherwise ".borrow" would be interpreted as | ||
// a class selector. | ||
assert: ("#method\.borrow", {"display": "flex"}) | ||
// We first check that the impl block is open by default. | ||
assert: ("#implementations + details", "open", "") | ||
// We collapse it. | ||
click: "#implementations + details > summary" | ||
// We check that it was collapsed as expected. | ||
assert-false: ("#implementations + details", "open", "") | ||
// To ensure that we will click on the currently hidden method. | ||
assert: (".sidebar-links > a", "must_use") | ||
click: ".sidebar-links > a" | ||
// We check that the impl block was opened as expected so that we can see the method. | ||
assert: ("#implementations + details", "open", "") |
This file contains 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// This test ensures that the impl blocks are open by default. | ||
goto: file://|DOC_PATH|/struct.Foo.html | ||
assert: ("#main > details.implementors-toggle", "open", "") | ||
This file was deleted.
Oops, something went wrong.
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.
Can you add a test that intentionally fails to make sure this runs at all?
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.
They are not run, that's for sure. Otherwise, it'd have failed a long time ago because of
nojs-attr-pos.goml
.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.
Ok. In the meantime, can you run it locally and make sure it passes?
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.
This version didn't because I forgot to commit the one with the correct URL (
struct.Foo.html
and notindex.html
). But otherwise it works as expected.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.
Can you fix it to have the correct URL? I don't see the point of adding a test we know will fail.
While you're at it, can you update the other test to pass instead of removing it altogether?
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.
Look at my comment below.
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.
The test which fails checked for attributes toggles. Since they don't have toggles anymore, there is no point of keeping the test.
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.
Can you instead test that it doesn't have toggles?
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.
Would it be useful to check that something was removed? For example, if we put back toggles on attributes with a different DOM, the test would still be happy. Which is why it's simpler to enforce what exists over what doesn't. (Not sure if that makes sense said like this ><)
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.
I agree with @GuillaumeGomez. When removing "code that does X," it's often tempting to add a test for "doesn't do X anymore." But the problem is there are a zillion ways it could wind up doing X again, and it's impossible to cover all of them (or even a reasonable fraction). It winds up adding to the test running time, and the burden of maintaining tests, without a corresponding benefit.