Rollup merge of #83393 - GuillaumeGomez:codeblock-tooltip-position, r=Nemo157

Codeblock tooltip position

The codeblocks tooltips were misplaced. Normally, there is no top margin applied to a tooltip unless the codeblock is the first element of the doc block. The CSS rule was too vague though, applying it to all tooltips where the codeblock was the first child of its parent. Which can be easily seen with lists:

Before:

![Screenshot from 2021-03-22 22-05-16](https://user-images.githubusercontent.com/3050060/112059812-a667ba80-8b5c-11eb-88dd-1c598ceb3766.png)

After:

![Screenshot from 2021-03-22 22-06-31](https://user-images.githubusercontent.com/3050060/112059815-a7005100-8b5c-11eb-9e40-8fc57513e498.png)

r? ``@Nemo157``
This commit is contained in:
Dylan DPC 2021-03-24 01:52:32 +01:00 committed by GitHub
commit 8c1c7a7396
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 5 deletions

View file

@ -1353,7 +1353,7 @@ h4 > .notable-traits {
to prevent an overlay between the "collapse toggle" and the information tooltip.
However, it's not needed with smaller screen width because the doc/code block is always put
"one line" below. */
.information:first-child > .tooltip {
.docblock > .information:first-child > .tooltip {
margin-top: 16px;
}
}

View file

@ -0,0 +1,9 @@
goto: file://|DOC_PATH|/index.html
goto: ./fn.check_list_code_block.html
// If the codeblock is the first element of the docblock, the information tooltip must have
// have some top margin to avoid going over the toggle (the "[+]").
assert: (".docblock > .information > .compile_fail", { "margin-top": "16px" })
// Checks that the other codeblocks don't have this top margin.
assert: ("ol > li > .information > .compile_fail", { "margin-top": "0px" })
assert: ("ol > li > .information > .ignore", { "margin-top": "0px" })
assert: (".docblock > .information > .ignore", { "margin-top": "0px" })

View file

@ -62,16 +62,26 @@ pub trait AnotherOne {
fn hello();
}
/// ```compile_fail
/// whatever
/// ```
///
/// Check for "i" signs in lists!
///
/// 1. elem 1
/// 2.test 1
/// ```compile_fail
/// fn foo() {}
/// ```
/// 2. test 1
/// ```compile_fail
/// fn foo() {}
/// ```
/// 3. elem 3
/// 4. ```ignore (it's a test)
/// fn foo() {}
/// ```
/// 5. elem 5
///
/// Final one:
///
/// ```ignore (still a test)
/// let x = 12;
/// ```
pub fn check_list_code_block() {}