add UI tests for welcome and unlock flows
This commit is contained in:
1 parent
5999aba0a5
commit
b2a7e5759a
9 files changed
+1003
-59
No files matched your search
@@ -12,6 +12,7 @@ use gpui_omarchy::{ButtonVariant, icon_button, input};
|
||||
/// The `show` flag is passed in from outside so that it can be shared
|
||||
/// (e.g. passphrase and confirm-passphrase inputs should share it).
|
||||
pub struct PassphraseInput {
|
||||
id: SharedString,
|
||||
state: Entity<InputState>,
|
||||
show: Entity<bool>,
|
||||
_subscriptions: Vec<Subscription>,
|
||||
@@ -29,7 +30,7 @@ pub enum PassphraseInputEvent {
|
||||
impl EventEmitter<PassphraseInputEvent> for PassphraseInput {}
|
||||
|
||||
impl PassphraseInput {
|
||||
pub fn new(show: Entity<bool>, window: &mut Window, cx: &mut Context<Self>) -> Self {
|
||||
pub fn new(id: impl Into<SharedString>, show: Entity<bool>, window: &mut Window, cx: &mut Context<Self>) -> Self {
|
||||
let masked = !*show.read(cx);
|
||||
let state = cx.new(|cx| {
|
||||
InputState::new(window, cx)
|
||||
@@ -56,6 +57,7 @@ impl PassphraseInput {
|
||||
});
|
||||
|
||||
Self {
|
||||
id: id.into(),
|
||||
state,
|
||||
show,
|
||||
_subscriptions: vec![sync_mask, forward],
|
||||
@@ -87,10 +89,11 @@ impl Render for PassphraseInput {
|
||||
(IconName::Eye, "Show passphrase")
|
||||
};
|
||||
|
||||
input("passphrase", &self.state, window, cx)
|
||||
let toggle_id = SharedString::from(format!("{}-toggle-show", self.id));
|
||||
input(self.id.clone(), &self.state, window, cx)
|
||||
.w_full()
|
||||
.suffix(
|
||||
icon_button("toggle-show", icon, label, ButtonVariant::Secondary, cx)
|
||||
icon_button(toggle_id, icon, label, ButtonVariant::Secondary, cx)
|
||||
.on_click(cx.listener(|this, _, _, cx| this.toggle_show(cx))),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user