Default to light theme if JS is enabled but not working by GuillaumeGomez · Pull...
source link: https://github.com/rust-lang/rust/pull/123407
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
This comment has been minimized.
added A-testsuite Area: The testsuite used to check the correctness of rustc T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
labels
// Even though JS is disabled, we should still have themes applied. Links are never black-colored |
||
// if styles are applied so we check that they are not. |
||
assert-css-false: ("a.src", {"color": "#000"}) |
Contributor
This doesn't seem like it's actually testing what the commit is fixing.
The nightly docs aren't broken because javascript is disabled. They're broken because javascript is enabled, but the script fails to load. Your test case should actually create these conditions.
It doesn't indeed because I couldn't find a way to have a "broken JS" state. So this ensure that the rules I modified still works for noscript. However for the "broken JS" state, well. Please trust me? ^^'
Contributor
I think this could reasonably be tested with a few minor changes to browser-ui-test. Puppeteer has an API for intercepting network requests. This could be used to implement a block-network-request: "*.js"
command that we could use to simulate a broken network.
It might also be possible to add a CSP through a meta tag that doesn't allow any script-source.
But I'm not sure if that triggers the noscript alternative.
This could be used to implement a block-network-request: "*.js" command that we could use to simulate a broken network.
Good idea!
It might also be possible to add a CSP through a meta tag that doesn't allow any script-source. But I'm not sure if that triggers the noscript alternative.
It would require to update the DOM before loading the page. Can be done but I'm not a big fan of this approach.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK