| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
use quasi_router::{Curve, Field, layout}; |
| 9 |
|
| 10 |
#[test] |
| 11 |
fn a_slider_can_be_given_a_curve_from_outside_the_crate() { |
| 12 |
let field = Field::range("gain", "Gain", "0", "1").curve(Curve::Logarithmic { |
| 13 |
step: Some("0.01".into()), |
| 14 |
}); |
| 15 |
|
| 16 |
field.with_layout(|drawn| { |
| 17 |
assert_eq!( |
| 18 |
drawn.curve, |
| 19 |
layout::Curve::Logarithmic { step: Some("0.01") } |
| 20 |
); |
| 21 |
}); |
| 22 |
} |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
#[test] |
| 28 |
fn a_save_ask_and_its_answer_can_be_built_from_outside_the_crate() { |
| 29 |
use quasi_router::{Accepted, Action, Locating, Picked, Sought}; |
| 30 |
|
| 31 |
let asking = Locating::new( |
| 32 |
Sought::Save { |
| 33 |
name: "drums.afcl".into(), |
| 34 |
accept: vec![Accepted::suffix(".afcl")], |
| 35 |
}, |
| 36 |
"Export classifier", |
| 37 |
Action::post("/classifier/export"), |
| 38 |
"path", |
| 39 |
); |
| 40 |
let call = asking |
| 41 |
.answered([Picked::new("/home/max/drums.afcl", "drums.afcl")]) |
| 42 |
.expect("a route to answer to"); |
| 43 |
assert_eq!(call.payload.get("path"), Some("/home/max/drums.afcl")); |
| 44 |
} |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
#[test] |
| 50 |
fn a_document_can_be_built_and_its_names_checked_from_outside_the_crate() { |
| 51 |
use quasi_router::{Document, Screen, writable_root_attr}; |
| 52 |
|
| 53 |
let screen = Screen::list_detail("Admin", false).documented( |
| 54 |
Document::default() |
| 55 |
.classed("admin-page") |
| 56 |
.rooted("data-theme", "slate"), |
| 57 |
); |
| 58 |
|
| 59 |
assert_eq!(screen.document.body_class.as_deref(), Some("admin-page")); |
| 60 |
assert!(writable_root_attr(&screen.document.root[0].0)); |
| 61 |
} |
| 62 |
|