🎨 (core): Retoques de estilo menores
This commit is contained in:
parent
b50d186fb1
commit
997017bb75
11 changed files with 23 additions and 22 deletions
|
|
@ -37,9 +37,10 @@ impl TestComp {
|
|||
|
||||
/// Creates a component with no id, with fixed output text.
|
||||
fn text(text: &str) -> Self {
|
||||
let mut c = Self::default();
|
||||
c.text = text.to_string();
|
||||
c
|
||||
Self {
|
||||
text: text.to_string(),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ impl Theme for MarkerTheme {
|
|||
component: &mut dyn Component,
|
||||
_cx: &mut Context,
|
||||
) -> Option<Result<Markup, ComponentError>> {
|
||||
let template = (&*component).downcast_ref::<layout::Template>()?;
|
||||
let template = (*component).downcast_ref::<layout::Template>()?;
|
||||
template.template().downcast_ref::<CoreTemplates>()?;
|
||||
Some(Ok(html! { "marker-template-output" }))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use pagetop::prelude::*;
|
|||
#[pagetop::test]
|
||||
async fn set_and_read_extra() {
|
||||
let props = Props::default().with_prop(PropsOp::set_extra("ext.flag", true));
|
||||
assert_eq!(*props.extra::<bool>("ext.flag").unwrap(), true);
|
||||
assert!(*props.extra::<bool>("ext.flag").unwrap());
|
||||
}
|
||||
|
||||
#[pagetop::test]
|
||||
|
|
@ -52,13 +52,13 @@ async fn extra_type_mismatch() {
|
|||
#[pagetop::test]
|
||||
async fn extra_or_returns_value_when_found() {
|
||||
let props = Props::default().with_prop(PropsOp::set_extra("ext.flag", true));
|
||||
assert_eq!(props.extra_or("ext.flag", false), true);
|
||||
assert!(props.extra_or("ext.flag", false));
|
||||
}
|
||||
|
||||
#[pagetop::test]
|
||||
async fn extra_or_returns_default_on_missing() {
|
||||
let props = Props::default();
|
||||
assert_eq!(props.extra_or("ext.flag", false), false);
|
||||
assert!(!props.extra_or("ext.flag", false));
|
||||
}
|
||||
|
||||
#[pagetop::test]
|
||||
|
|
@ -72,7 +72,7 @@ async fn extra_or_returns_default_on_type_mismatch() {
|
|||
#[pagetop::test]
|
||||
async fn extra_or_default_returns_type_default_on_missing() {
|
||||
let props = Props::default();
|
||||
assert_eq!(props.extra_or_default::<bool>("ext.flag"), false);
|
||||
assert!(!props.extra_or_default::<bool>("ext.flag"));
|
||||
assert_eq!(props.extra_or_default::<i32>("ext.count"), 0);
|
||||
}
|
||||
|
||||
|
|
@ -93,7 +93,7 @@ async fn extra_or_else_calls_closure_on_missing() {
|
|||
async fn clone_preserves_extras() {
|
||||
let props = Props::default().with_prop(PropsOp::set_extra("ext.flag", true));
|
||||
let cloned = props.clone();
|
||||
assert_eq!(*cloned.extra::<bool>("ext.flag").unwrap(), true);
|
||||
assert!(*cloned.extra::<bool>("ext.flag").unwrap());
|
||||
}
|
||||
|
||||
#[pagetop::test]
|
||||
|
|
@ -103,7 +103,7 @@ async fn multiple_extras_with_different_types() {
|
|||
.with_prop(PropsOp::set_extra("ext.count", 42_u32))
|
||||
.with_prop(PropsOp::set_extra("ext.label", "hello".to_string()));
|
||||
|
||||
assert_eq!(*props.extra::<bool>("ext.flag").unwrap(), true);
|
||||
assert!(*props.extra::<bool>("ext.flag").unwrap());
|
||||
assert_eq!(*props.extra::<u32>("ext.count").unwrap(), 42);
|
||||
assert_eq!(props.extra::<String>("ext.label").unwrap(), "hello");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue