- CurrentUser pasa de enum a struct con `id` opcional (anónimo = None) y preferencias de idioma, zona horaria y tema validadas en `with_*()`. - `RequestLocale` tiene en cuenta el idioma preferido del usuario, y Context usa su tema si lo tiene (`default_theme()` en otro caso). - Nuevos componentes `form::SelectLanguage`, `form::SelectTheme` y `form::SelectTimezone`, con `Timezone::supported_by_region()` para listar y validar las zonas IANA ofrecidas.
14 lines
520 B
Rust
14 lines
520 B
Rust
// With only the default theme enabled. See `component_form_select_theme.rs` for several themes.
|
|
|
|
use pagetop::prelude::*;
|
|
|
|
#[pagetop::test]
|
|
async fn single_theme_is_shown_disabled_and_selected() {
|
|
Application::new().await;
|
|
let mut field = form::SelectTheme::new().with_name("theme");
|
|
let html = field.render(&mut Context::default()).await.into_string();
|
|
|
|
assert!(html.contains("disabled"));
|
|
assert!(html.contains(r#"<option value="Basic" selected>"#));
|
|
assert!(!html.contains(r#"value="""#));
|
|
}
|