Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ impl Screen {
Screen::NetworkChooserScreen(_) => ScreenType::NetworkChooser,
Screen::AddKeyScreen(screen) => ScreenType::AddKeyScreen(screen.identity.clone()),
Screen::DocumentQueryScreen(_) => ScreenType::DocumentQuery,
Screen::AddNewIdentityScreen(_) => ScreenType::AddExistingIdentity,
Screen::AddNewIdentityScreen(_) => ScreenType::AddNewIdentity,
Screen::TopUpIdentityScreen(screen) => {
ScreenType::TopUpIdentity(screen.identity.clone())
}
Expand Down
23 changes: 23 additions & 0 deletions tests/kittest/identity_hub_onboarding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,26 @@ fn onboarding_island_fills_panel_width() {
);
});
}

/// The "create" screen must report its own `ScreenType`, not the "load
/// existing" one — `Screen`'s `PartialEq` compares by `ScreenType`, so a
/// mismatch makes the two identity entry screens indistinguishable.
#[test]
fn add_identity_screens_report_their_own_screen_type() {
use dash_evo_tool::ui::ScreenType;

with_isolated_data_dir(|| {
let harness = mount_app(RootScreenType::RootScreenIdentityHub);
let app_context = harness.state().current_app_context().clone();

let create = ScreenType::AddNewIdentity.create_screen(&app_context);
let load = ScreenType::AddExistingIdentity.create_screen(&app_context);

assert_eq!(create.screen_type(), ScreenType::AddNewIdentity);
assert_eq!(load.screen_type(), ScreenType::AddExistingIdentity);
assert!(
create != load,
"create and load screens must not compare equal"
);
});
}
Loading