Misc · Asking and learning: Submit never rests; radio labels wrap
Survey's Submit asks for any missing answer instead of resting, so no untick takes its focus handle out of the tree. Flashcards turn and go round, and a quiz pick clears its ask, through methods the tests reach; the poll's rows show which one holds the vote. forms::Radio's label wraps in its own block, as Checkbox's does, so a long one stays in a narrow box.
This commit is contained in:
1 parent
86c9de7d0a
commit
46aa381eee
9 files changed
+136
-56
No files matched your search
+9
-4
@@ -59,6 +59,11 @@ struct Sitting {
|
||||
}
|
||||
|
||||
impl Sitting {
|
||||
fn pick(&mut self, option: usize) {
|
||||
self.pick = Some(option);
|
||||
self.nudged = false;
|
||||
}
|
||||
|
||||
/// What the one button does next, and says.
|
||||
fn next(&self, count: usize) -> &'static str {
|
||||
match (self.done, self.checked, self.at + 1 == count) {
|
||||
@@ -172,8 +177,7 @@ impl RenderOnce for Quiz {
|
||||
.on_change(move |value, _, cx| {
|
||||
let ix = value.parse().expect("an option's place");
|
||||
chose.update(cx, |sitting, cx| {
|
||||
sitting.pick = Some(ix);
|
||||
sitting.nudged = false;
|
||||
sitting.pick(ix);
|
||||
cx.notify();
|
||||
})
|
||||
});
|
||||
@@ -289,7 +293,8 @@ mod tests {
|
||||
assert_eq!(sitting.next(2), "Check");
|
||||
sitting.advance(1, 2);
|
||||
assert!(sitting.nudged, "Check with no pick asks for one");
|
||||
sitting.pick = Some(1);
|
||||
sitting.pick(1);
|
||||
assert!(!sitting.nudged, "a pick answers the ask");
|
||||
sitting.advance(1, 2);
|
||||
assert_eq!(
|
||||
(sitting.checked, sitting.right, sitting.next(2)),
|
||||
@@ -300,7 +305,7 @@ mod tests {
|
||||
(sitting.at, sitting.pick, sitting.checked),
|
||||
(1, None, false)
|
||||
);
|
||||
sitting.pick = Some(0);
|
||||
sitting.pick(0);
|
||||
sitting.advance(2, 2);
|
||||
assert_eq!(
|
||||
(sitting.right, sitting.next(2)),
|
||||
|
||||
Reference in new issue
Block a user