Rollup merge of #104967 - willcrichton:fix-scrape-examples, r=notriddle
Fix UI issues with Rustdoc scrape-examples feature. A few regressions have been introduced into scrape-examples in the last few months. This commit fixes those regressions: * Help file was being loaded from the wrong place (introduced inf9e1f6ffdf
). * CSS selector in JS has a typo (introduced in14897180ae
). * Line numbers in scraped example code snippets are overflowing (not sure if this was ever fixed). Changing from flexbox to grid display fixed this issue.
This commit is contained in:
commit
532fe7b8e0
5 changed files with 19 additions and 3 deletions
|
@ -1978,7 +1978,9 @@ in storage.js
|
|||
}
|
||||
|
||||
.scraped-example .code-wrapper .example-wrap {
|
||||
flex: 1;
|
||||
display: grid;
|
||||
grid-template-columns: max-content auto;
|
||||
width: 100%;
|
||||
overflow-x: auto;
|
||||
overflow-y: hidden;
|
||||
margin-bottom: 0;
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
});
|
||||
});
|
||||
|
||||
example.querySelector("next")
|
||||
example.querySelector(".next")
|
||||
.addEventListener("click", () => {
|
||||
onChangeLoc(() => {
|
||||
locIndex = (locIndex + 1) % locs.length;
|
||||
|
|
|
@ -130,4 +130,4 @@ static_files! {
|
|||
nanum_barun_gothic_license => "static/fonts/NanumBarunGothic-LICENSE.txt",
|
||||
}
|
||||
|
||||
pub(crate) static SCRAPE_EXAMPLES_HELP_MD: &str = include_str!("static/js/scrape-examples.js");
|
||||
pub(crate) static SCRAPE_EXAMPLES_HELP_MD: &str = include_str!("static/scrape-examples-help.md");
|
||||
|
|
|
@ -1,4 +1,17 @@
|
|||
goto: "file://" + |DOC_PATH| + "/scrape_examples/fn.test.html"
|
||||
|
||||
store-property: (initialScrollTop, ".scraped-example-list > .scraped-example pre", "scrollTop")
|
||||
focus: ".scraped-example-list > .scraped-example .next"
|
||||
press-key: "Enter"
|
||||
assert-property-false: (".scraped-example-list > .scraped-example pre", {
|
||||
"scrollTop": |initialScrollTop|
|
||||
})
|
||||
focus: ".scraped-example-list > .scraped-example .prev"
|
||||
press-key: "Enter"
|
||||
assert-property: (".scraped-example-list > .scraped-example pre", {
|
||||
"scrollTop": |initialScrollTop|
|
||||
})
|
||||
|
||||
store-property: (smallOffsetHeight, ".scraped-example-list > .scraped-example pre", "offsetHeight")
|
||||
assert-property-false: (".scraped-example-list > .scraped-example pre", {
|
||||
"scrollHeight": |smallOffsetHeight|
|
||||
|
|
|
@ -22,4 +22,5 @@ fn main() {
|
|||
println!("hello world!");
|
||||
println!("hello world!");
|
||||
}
|
||||
scrape_examples::test();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue