| 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 |
+ |
|
| 125 |
149 |
|
/// What a list fragment says is left, and how to ask for it.
|
| 126 |
150 |
|
fn remainder(response: Response) -> Option<quasi_router::screen::Rest> {
|
| 127 |
151 |
|
match response.outcome {
|
| 244 |
268 |
|
// A control that dropped the filter is a view you fall out of by using it.
|
| 245 |
269 |
|
let opening = listed[0].activate.as_ref().expect("a row opens its thread");
|
| 246 |
270 |
|
assert_eq!(opening.carried.get("folder"), Some("Archive"));
|
| 247 |
|
- |
for act in &listed[0].actions {
|
|
271 |
+ |
for act in acts(&listed[0]) {
|
| 248 |
272 |
|
assert_eq!(
|
| 249 |
273 |
|
act.action.carried.get("folder"),
|
| 250 |
274 |
|
Some("Archive"),
|
| 528 |
552 |
|
let listed = rows(get(&state, "/emails/list", Params::new()));
|
| 529 |
553 |
|
assert_eq!(listed.len(), 1, "a thread is one row");
|
| 530 |
554 |
|
assert!(
|
| 531 |
|
- |
listed[0]
|
| 532 |
|
- |
.tokens
|
| 533 |
|
- |
.iter()
|
| 534 |
|
- |
.any(|tag| tag.label.contains("2 messages")),
|
|
555 |
+ |
tokens(&listed[0]).any(|tag| tag.label.contains("2 messages")),
|
| 535 |
556 |
|
"the count says what it counts rather than showing a bare digit",
|
| 536 |
557 |
|
);
|
| 537 |
558 |
|
}
|