| 405 |
405 |
|
let cut = preview("**Bold**").expect("a preview");
|
| 406 |
406 |
|
assert!(matches!(cut, Prose::Text(_)), "got: {cut:?}");
|
| 407 |
407 |
|
}
|
|
408 |
+ |
|
|
409 |
+ |
#[test]
|
|
410 |
+ |
fn the_palette_is_drawn_over_the_screen_rather_than_replacing_it() {
|
|
411 |
+ |
// The one route here that answers with `Over`. Both hosts draw it the same
|
|
412 |
+ |
// way from this one description: the webview into its overlay container,
|
|
413 |
+ |
// the terminal over the current screen. Neither has a line of palette code
|
|
414 |
+ |
// in it -- what each declares is the key, because "ctrl+k" and "k" are the
|
|
415 |
+ |
// same affordance spelled for two keyboards.
|
|
416 |
+ |
let state = state();
|
|
417 |
+ |
let response = get(&state, "/palette");
|
|
418 |
+ |
let Outcome::Over(screen) = &response.outcome else {
|
|
419 |
+ |
panic!("expected an overlay, got {:?}", response.outcome);
|
|
420 |
+ |
};
|
|
421 |
+ |
assert_eq!(screen.title, "Go to note");
|
|
422 |
+ |
// Not a place: nothing to push, nothing to come back from.
|
|
423 |
+ |
assert!(response.destination().is_none());
|
|
424 |
+ |
assert!(response.target().is_none());
|
|
425 |
+ |
}
|
|
426 |
+ |
|
|
427 |
+ |
#[test]
|
|
428 |
+ |
fn the_palette_offers_the_notes_it_can_jump_to() {
|
|
429 |
+ |
let state = state();
|
|
430 |
+ |
post(
|
|
431 |
+ |
&state,
|
|
432 |
+ |
"/note",
|
|
433 |
+ |
Params::new().with("title", "Findable").with("body", "x"),
|
|
434 |
+ |
);
|
|
435 |
+ |
let response = get(&state, "/palette");
|
|
436 |
+ |
let Outcome::Over(screen) = &response.outcome else {
|
|
437 |
+ |
panic!("expected an overlay");
|
|
438 |
+ |
};
|
|
439 |
+ |
let listed = titles(&screen.slots[0]);
|
|
440 |
+ |
assert!(listed.iter().any(|title| title == "Findable"), "{listed:?}");
|
|
441 |
+ |
}
|