@@ -366,23 +366,42 @@ assert-css: (
366
366
{"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"},
367
367
)
368
368
369
- // Check the alias more specifically in the dark theme .
369
+ // Check the alias.
370
370
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
371
- // We set the theme so we're sure that the correct values will be used, whatever the computer
372
- // this test is running on.
373
- local-storage: {
374
- "rustdoc-theme": "dark",
375
- "rustdoc-use-system-theme": "false",
376
- }
377
371
// If the text isn't displayed, the browser doesn't compute color style correctly...
378
372
show-text: true
379
- // We reload the page so the local storage settings are being used.
380
- reload:
381
- write: (".search-input", "thisisanalias")
382
- // To be SURE that the search will be run.
383
- press-key: 'Enter'
384
- // Waiting for the search results to appear...
385
- wait-for: "#titles"
386
- // Checking that the colors for the alias element are the ones expected.
387
- assert-css: (".result-name > .alias", {"color": "rgb(255, 255, 255)"})
388
- assert-css: (".result-name > .alias > .grey", {"color": "rgb(204, 204, 204)"})
373
+
374
+ define-function: (
375
+ "check-alias",
376
+ (theme, alias, grey),
377
+ [
378
+ ("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
379
+ ("reload"),
380
+ ("write", (".search-input", "thisisanalias")),
381
+ // To be SURE that the search will be run.
382
+ ("press-key", 'Enter'),
383
+ // Waiting for the search results to appear...
384
+ ("wait-for", "#titles"),
385
+ // Checking that the colors for the alias element are the ones expected.
386
+ ("assert-css", (".result-name > .alias", {"color": |alias|})),
387
+ ("assert-css", (".result-name > .alias > .grey", {"color": |grey|})),
388
+ // Leave the search results to prevent reloading with an already filled search input.
389
+ ("press-key", "Escape"),
390
+ ],
391
+ )
392
+
393
+ call-function: ("check-alias", {
394
+ "theme": "ayu",
395
+ "alias": "rgb(197, 197, 197)",
396
+ "grey": "rgb(153, 153, 153)",
397
+ })
398
+ call-function: ("check-alias", {
399
+ "theme": "dark",
400
+ "alias": "rgb(255, 255, 255)",
401
+ "grey": "rgb(204, 204, 204)",
402
+ })
403
+ call-function: ("check-alias", {
404
+ "theme": "light",
405
+ "alias": "rgb(0, 0, 0)",
406
+ "grey": "rgb(153, 153, 153)",
407
+ })
0 commit comments