Skip to main content

max / goingson

Take quasi's own Row::acts and Row::tokens
Author: Max Johnson <me@maxj.phd> · 2026-08-12 17:29 UTC
Signed with PGP, not checked
Commit: 2dbfd9fdb629680900c4930678793118ad744785
Parent: 8f1a547
1 file changed, +4 insertions, -26 deletions
@@ -122,30 +122,6 @@
122 122 }
123 123 }
124 124
125 - /// The controls a row offers, and the badges on it.
126 - ///
127 - /// A row's content is an inline run of parts since quasi `1786cb94`, so
128 - /// `row.actions` and `row.tokens` are gone and the parts carrying them are
129 - /// found by role. Two helpers rather than the filter written out at each
130 - /// assertion: what these tests want to say is "the controls this row offers",
131 - /// and `Row::primary` already sets the precedent of answering that question for
132 - /// the caller.
133 - fn acts(row: &Row) -> impl Iterator<Item = &quasi_router::screen::Act> {
134 - row.role(makeover_layout::RowPart::Actions)
135 - .filter_map(|node| match node {
136 - Node::Act(act) => Some(act),
137 - _ => None,
138 - })
139 - }
140 -
141 - fn tokens(row: &Row) -> impl Iterator<Item = &quasi_router::screen::Tag> {
142 - row.role(makeover_layout::RowPart::Tokens)
143 - .filter_map(|node| match node {
144 - Node::Token(tag) => Some(tag),
145 - _ => None,
146 - })
147 - }
148 -
149 125 /// What a list fragment says is left, and how to ask for it.
150 126 fn remainder(response: Response) -> Option<quasi_router::screen::Rest> {
151 127 match response.outcome {
@@ -268,7 +244,7 @@
268 244 // A control that dropped the filter is a view you fall out of by using it.
269 245 let opening = listed[0].activate.as_ref().expect("a row opens its thread");
270 246 assert_eq!(opening.carried.get("folder"), Some("Archive"));
271 - for act in acts(&listed[0]) {
247 + for act in listed[0].acts() {
272 248 assert_eq!(
273 249 act.action.carried.get("folder"),
274 250 Some("Archive"),
@@ -552,7 +528,9 @@
552 528 let listed = rows(get(&state, "/emails/list", Params::new()));
553 529 assert_eq!(listed.len(), 1, "a thread is one row");
554 530 assert!(
555 - tokens(&listed[0]).any(|tag| tag.label.contains("2 messages")),
531 + listed[0]
532 + .tokens()
533 + .any(|tag| tag.label.contains("2 messages")),
556 534 "the count says what it counts rather than showing a bare digit",
557 535 );
558 536 }