@@ -12,14 +12,14 @@ define-function: (
1212 assert-css: ("a[id='" + |line| + "'] + .expansion .expanded", {"display": "none"})
1313
1414 // We "expand" the macro.
15- click: "a[id='" + |line| + "'] + .expansion label "
15+ click: "a[id='" + |line| + "'] + .expansion input[type=checkbox] "
1616 // The "original" content is hidden.
1717 assert-css: ("a[id='" + |line| + "'] + .expansion .original", {"display": "none"})
1818 // The expanded macro is visible.
1919 assert-css: ("a[id='" + |line| + "'] + .expansion .expanded", {"display": "inline"})
2020
2121 // We collapse the macro.
22- click: "a[id='" + |line| + "'] + .expansion label "
22+ click: "a[id='" + |line| + "'] + .expansion input[type=checkbox] "
2323 // The "original" content is expanded.
2424 assert-css: ("a[id='" + |line| + "'] + .expansion .original", {"display": "inline"})
2525 // The expanded macro is hidden.
@@ -31,7 +31,7 @@ define-function: (
3131call-function: ("check-expansion", {"line": 33, "original_content": "Debug"})
3232// Then we check the `bar` macro expansion at line 41.
3333call-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 .
3535call-function: ("check-expansion", {"line": 42, "original_content": 'println!("
363643 {y}
373744 ")'})
@@ -56,7 +56,7 @@ assert-css: ('//*[@id="expand-50"]' + |repeat_e| + |repeat_e|, {"display": "none
5656
5757// We "expand" the macro (because the line starts with a string, the label is not at the "top
5858// level" of the `<code>`, so we need to use a different selector).
59- click: ".expansion label[for=' expand-50'] "
59+ click: "# expand-50"
6060// The "original" content is hidden.
6161assert-css: ('//*[@id="expand-50"]' + |repeat_o|, {"display": "none"})
6262assert-css: ('//*[@id="expand-50"]' + |repeat_o| + |repeat_o|, {"display": "none"})
@@ -65,10 +65,49 @@ assert-css: ('//*[@id="expand-50"]' + |repeat_e|, {"display": "inline"})
6565assert-css: ('//*[@id="expand-50"]' + |repeat_e| + |repeat_e|, {"display": "inline"})
6666
6767// We collapse the macro.
68- click: ".expansion label[for=' expand-50'] "
68+ click: "# expand-50"
6969// The "original" content is expanded.
7070assert-css: ('//*[@id="expand-50"]' + |repeat_o|, {"display": "inline"})
7171assert-css: ('//*[@id="expand-50"]' + |repeat_o| + |repeat_o|, {"display": "inline"})
7272// The expanded macro is hidden.
7373assert-css: ('//*[@id="expand-50"]' + |repeat_e|, {"display": "none"})
7474assert-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