[rustdoc] Wrap code blocks in <code> tag

This commit is contained in:
Jakub Beránek 2021-08-16 23:19:00 +02:00
parent 0035d9dcec
commit ccd550ee56
No known key found for this signature in database
GPG key ID: DBC553E540C2F619
6 changed files with 318 additions and 270 deletions

View file

@ -0,0 +1,20 @@
// This test ensures that items and documentation code blocks are wrapped in <pre><code>
goto: file://|DOC_PATH|/test_docs/fn.foo.html
size: (1080, 600)
// There should be three doc codeblocks
// Check that their content is inside <pre><code>
assert-count: (".example-wrap pre > code", 3)
// Check that function signature is inside <pre><code>
assert: "pre.rust.fn > code"
goto: file://|DOC_PATH|/test_docs/struct.Foo.html
assert: "pre.rust.struct > code"
goto: file://|DOC_PATH|/test_docs/enum.AnEnum.html
assert: "pre.rust.enum > code"
goto: file://|DOC_PATH|/test_docs/trait.AnotherOne.html
assert: "pre.rust.trait > code"
goto: file://|DOC_PATH|/test_docs/type.SomeType.html
assert: "pre.rust.typedef > code"

View file

@ -12,4 +12,4 @@ assert-attribute: (".line-numbers > span:nth-child(5)", {"class": "line-highligh
assert-attribute: (".line-numbers > span:nth-child(6)", {"class": "line-highlighted"})
assert-attribute-false: (".line-numbers > span:nth-child(7)", {"class": "line-highlighted"})
// This is to ensure that the content is correctly align with the line numbers.
compare-elements-position: ("//*[@id='1']", ".rust > span", ("y"))
compare-elements-position: ("//*[@id='1']", ".rust > code > span", ("y"))