@@ -12,14 +12,14 @@ define-function: (
12
12
assert-css: ("a[id='" + |line| + "'] + .expansion .expanded", {"display": "none"})
13
13
14
14
// We "expand" the macro.
15
- click: "a[id='" + |line| + "'] + .expansion label "
15
+ click: "a[id='" + |line| + "'] + .expansion input[type=checkbox] "
16
16
// The "original" content is hidden.
17
17
assert-css: ("a[id='" + |line| + "'] + .expansion .original", {"display": "none"})
18
18
// The expanded macro is visible.
19
19
assert-css: ("a[id='" + |line| + "'] + .expansion .expanded", {"display": "inline"})
20
20
21
21
// We collapse the macro.
22
- click: "a[id='" + |line| + "'] + .expansion label "
22
+ click: "a[id='" + |line| + "'] + .expansion input[type=checkbox] "
23
23
// The "original" content is expanded.
24
24
assert-css: ("a[id='" + |line| + "'] + .expansion .original", {"display": "inline"})
25
25
// The expanded macro is hidden.
@@ -31,7 +31,7 @@ define-function: (
31
31
call-function: ("check-expansion", {"line": 33, "original_content": "Debug"})
32
32
// Then we check the `bar` macro expansion at line 41.
33
33
call-function: ("check-expansion", {"line": 41, "original_content": "bar!(y)"})
34
- // Then we check the `println` macro expansion at line 23-25 .
34
+ // Then we check the `println` macro expansion at line 42-44 .
35
35
call-function: ("check-expansion", {"line": 42, "original_content": 'println!("
36
36
43 {y}
37
37
44 ")'})
@@ -56,7 +56,7 @@ assert-css: ('//*[@id="expand-50"]' + |repeat_e| + |repeat_e|, {"display": "none
56
56
57
57
// We "expand" the macro (because the line starts with a string, the label is not at the "top
58
58
// level" of the `<code>`, so we need to use a different selector).
59
- click: ".expansion label[for=' expand-50'] "
59
+ click: "# expand-50"
60
60
// The "original" content is hidden.
61
61
assert-css: ('//*[@id="expand-50"]' + |repeat_o|, {"display": "none"})
62
62
assert-css: ('//*[@id="expand-50"]' + |repeat_o| + |repeat_o|, {"display": "none"})
@@ -65,10 +65,49 @@ assert-css: ('//*[@id="expand-50"]' + |repeat_e|, {"display": "inline"})
65
65
assert-css: ('//*[@id="expand-50"]' + |repeat_e| + |repeat_e|, {"display": "inline"})
66
66
67
67
// We collapse the macro.
68
- click: ".expansion label[for=' expand-50'] "
68
+ click: "# expand-50"
69
69
// The "original" content is expanded.
70
70
assert-css: ('//*[@id="expand-50"]' + |repeat_o|, {"display": "inline"})
71
71
assert-css: ('//*[@id="expand-50"]' + |repeat_o| + |repeat_o|, {"display": "inline"})
72
72
// The expanded macro is hidden.
73
73
assert-css: ('//*[@id="expand-50"]' + |repeat_e|, {"display": "none"})
74
74
assert-css: ('//*[@id="expand-50"]' + |repeat_e| + |repeat_e|, {"display": "none"})
75
+
76
+ // Checking the line 46 `println` which needs to be handled differently because the line number is
77
+ // inside a "comment" span.
78
+ assert-text: ("#expand-46 ~ .original", 'println!("
79
+ 47 {y}
80
+ 48 ")')
81
+ // The "original" content should be expanded.
82
+ assert-css: ("#expand-46 ~ .original", {"display": "inline"})
83
+ // The expanded macro should be hidden.
84
+ assert-css: ("#expand-46 ~ .expanded", {"display": "none"})
85
+
86
+ // We "expand" the macro.
87
+ click: "#expand-46"
88
+ // The "original" content is hidden.
89
+ assert-css: ("#expand-46 ~ .original", {"display": "none"})
90
+ // The expanded macro is visible.
91
+ assert-css: ("#expand-46 ~ .expanded", {"display": "inline"})
92
+
93
+ // We collapse the macro.
94
+ click: "#expand-46"
95
+ // The "original" content is expanded.
96
+ assert-css: ("#expand-46 ~ .original", {"display": "inline"})
97
+ // The expanded macro is hidden.
98
+ assert-css: ("#expand-46 ~ .expanded", {"display": "none"})
99
+
100
+ // Ensure that the toggles are focusable and can be interacted with keyboard.
101
+ focus: "//a[@id='27']"
102
+ press-key: "Tab"
103
+ assert: "#expand-27:focus"
104
+ assert-css: ("#expand-27 ~ .expanded", {"display": "none"})
105
+ assert-css: ("#expand-27 ~ .original", {"display": "inline"})
106
+ // We now expand the macro.
107
+ press-key: "Space"
108
+ assert-css: ("#expand-27 ~ .expanded", {"display": "inline"})
109
+ assert-css: ("#expand-27 ~ .original", {"display": "none"})
110
+ // We collapse the macro.
111
+ press-key: "Space"
112
+ assert-css: ("#expand-27 ~ .expanded", {"display": "none"})
113
+ assert-css: ("#expand-27 ~ .original", {"display": "inline"})
0 commit comments