✨ (user): Añade el menú de cuenta AccountMenu

This commit is contained in:
Manuel Cillero 2026-09-26 16:57:57 +02:00
parent 165cb49880
commit 9e2fc2ccfa
10 changed files with 207 additions and 96 deletions

View file

@ -0,0 +1,25 @@
// Verifies the account menu offered to an anonymous user. The authenticated menu needs a logged-in
// user and an initialized admin registry, so it is not covered here.
use pagetop_user::prelude::*;
use pagetop::prelude::*;
#[pagetop::test]
async fn anonymous_user_gets_the_login_and_register_links() {
let mut cx = Context::default();
let html = account_menu(&cx).render(&mut cx).await.into_string();
assert!(html.contains(r#"href="/user/login""#));
assert!(html.contains(r#"href="/user/register""#));
assert!(!html.contains("dropdown"));
}
#[pagetop::test]
async fn component_renders_the_same_menu_as_the_function() {
let mut cx = Context::default();
let from_fn = account_menu(&cx).render(&mut cx).await.into_string();
let from_component = AccountMenu::new().render(&mut cx).await.into_string();
assert_eq!(from_fn, from_component);
}