File: source-code-wrapping.goml

package info (click to toggle)
rustc 1.88.0%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 934,128 kB
  • sloc: xml: 158,127; python: 36,062; javascript: 19,855; sh: 19,700; cpp: 18,947; ansic: 12,993; asm: 4,792; makefile: 690; lisp: 29; perl: 29; ruby: 19; sql: 11
file content (47 lines) | stat: -rw-r--r-- 2,142 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Checks that the interactions with the source code pages are working as expected.
go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"
show-text: true
set-window-size: (1000, 1000)

define-function: (
    "click-code-wrapping",
    [expected],
    block {
        click: "#word-wrap-source-code"
        wait-for-local-storage: {"rustdoc-word-wrap-source-code": |expected|}
    },
)

store-size: (".rust code", {"width": width, "height": height})
click: "#settings-menu"
wait-for: "#settings"
call-function: ("click-code-wrapping", {"expected": "true"})
wait-for-size-false: (".rust code", {"width": |width|, "height": |height|})
store-size: (".rust code", {"width": new_width, "height": new_height})
// The width should now be smaller than the window's and the height
// should have increased.
assert: |width| > |new_width| && |height| < |new_height|

// Switching back to the original setting.
call-function: ("click-code-wrapping", {"expected": "false"})
assert-size: (".rust code", {"width": |width|, "height": |height|})

// Now let's check in docs code examples.
go-to: "file://" + |DOC_PATH| + "/test_docs/trait_bounds/index.html"
click: "#settings-menu"
wait-for: "#settings"

store-size: (".example-wrap .rust code", {"width": rust_width, "height": rust_height})
store-size: (".example-wrap .language-text code", {"width": txt_width, "height": txt_height})
call-function: ("click-code-wrapping", {"expected": "true"})
wait-for-size-false: (".example-wrap .rust code", {"width": |rust_width|, "height": |rust_height|})

store-size: (".example-wrap .rust code", {"width": new_rust_width, "height": new_rust_height})
store-size: (".example-wrap .language-text code", {"width": new_txt_width, "height": new_txt_height})

assert: |rust_width| > |new_rust_width| && |rust_height| < |new_rust_height|
assert: |txt_width| > |new_txt_width| && |txt_height| < |new_txt_height|

call-function: ("click-code-wrapping", {"expected": "false"})
wait-for-size: (".example-wrap .rust code", {"width": |rust_width|, "height": |rust_height|})
assert-size: (".example-wrap .language-text code", {"width": |txt_width|, "height": |txt_height|})