From b2a7e5759a514abf99135bc1aafeae8cd2e9936c Mon Sep 17 00:00:00 2001 From: Joseph Montanaro Date: Wed, 18 Nov 2026 14:31:00 -0500 Subject: [PATCH] add UI tests for welcome and unlock flows --- Cargo.lock | 857 +++++++++++++++++++++++++++-- Cargo.toml | 1 + src/components/error_alert.rs | 13 + src/components/mod.rs | 2 + src/components/passphrase_input.rs | 9 +- src/db/config.rs | 3 +- src/main.rs | 159 +++++- src/screens/unlock.rs | 8 +- src/screens/welcome.rs | 10 +- 9 files changed, 1003 insertions(+), 59 deletions(-) create mode 100644 src/components/error_alert.rs diff --git a/Cargo.lock b/Cargo.lock index dc66661..50bb595 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -627,6 +627,12 @@ dependencies = [ "num-traits", ] +[[package]] +name = "atomic" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c59bdb34bc650a32731b31bd8f0829cc15d24a708ee31559e0bb34f2bc320cba" + [[package]] name = "atomic-waker" version = "1.1.2" @@ -764,7 +770,25 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34ddef2995421ab6a5c779542c81ee77c115206f4ad9d5a8e05f4ff49716a3dd" dependencies = [ - "bit-vec", + "bit-vec 0.9.1", +] + +[[package]] +name = "bit-set" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2f926cc3060f09db9ebc5b52823d85268d24bb917e472c0c4bea35780a7d" +dependencies = [ + "bit-vec 0.9.1", +] + +[[package]] +name = "bit-set" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56d87354e4229f54a44f7bf2435906a4656dba36026ab6eaca629a2c436a691c" +dependencies = [ + "bit-vec 0.10.2", ] [[package]] @@ -773,6 +797,16 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b71798fca2c1fe1086445a7258a4bc81e6e49dcd24c8d0dd9a1e57395b603f51" +[[package]] +name = "bit-vec" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72503af1e72be411d74ca45cd6b309878fcb35354e252fc2a3a8bda3a97082a0" +dependencies = [ + "borsh", + "serde", +] + [[package]] name = "bit_field" version = "0.10.3" @@ -873,6 +907,30 @@ dependencies = [ "piper", ] +[[package]] +name = "borsh" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "553c5d846a6ba5150c65e3b1b8ec073bcf1abc20f9b7220de384a4443ea4e20a" +dependencies = [ + "borsh-derive", + "bytes", + "cfg_aliases", +] + +[[package]] +name = "borsh-derive" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12cdfe656708a01f89b451a7d36466e6fe6c414de0aa18fc54f864f6f9ca9f56" +dependencies = [ + "once_cell", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 3.0.9", +] + [[package]] name = "bstr" version = "1.13.1" @@ -1197,6 +1255,15 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "convert_case" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "affbf0190ed2caf063e3def54ff444b449371d55c58e513a95ab98eca50adb49" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "core-foundation" version = "0.9.4" @@ -1400,6 +1467,15 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "crossbeam-queue" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03e8bd762f7479489c70ed6c768ddca99d7296857de437a68dcb2a94365b3fae" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "crossbeam-utils" version = "0.8.23" @@ -1477,7 +1553,7 @@ version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" dependencies = [ - "convert_case", + "convert_case 0.10.0", "proc-macro2", "quote", "rustc_version", @@ -1903,6 +1979,12 @@ version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48" +[[package]] +name = "fixedbitset" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5905ec755cc8386d7928353e4d356d2be3e89e81e5ca01fe630a1ca4d08dc175" + [[package]] name = "flate2" version = "1.1.10" @@ -2102,6 +2184,19 @@ dependencies = [ "futures-sink", ] +[[package]] +name = "futures-concurrency" +version = "7.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175cd8cca9e1d45b87f18ffa75088f2099e3c4fe5e2f83e42de112560bea8ea6" +dependencies = [ + "fixedbitset", + "futures-core", + "futures-lite", + "pin-project", + "smallvec", +] + [[package]] name = "futures-core" version = "0.3.34" @@ -2374,6 +2469,7 @@ dependencies = [ "chrono", "data-url", "futures", + "gpui-fast", "gpui-pre", "gpui-pre-macros", "gpui-pre-sum-tree", @@ -2414,6 +2510,7 @@ dependencies = [ "enum-iterator", "gpui-base", "gpui-component-macros", + "gpui-fast", "gpui-kit-assets", "gpui-pre", "gpui-pre-macros", @@ -2461,6 +2558,318 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "gpui-fast" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "895ff4c92ead42ca7e7f70213373f122f1482194b56d481eed5c768c85cc793b" +dependencies = [ + "accesskit", + "anyhow", + "async-channel", + "async-task", + "backtrace", + "bitflags 2.13.2", + "chrono", + "ctor", + "derive_more", + "embed-resource", + "etagere", + "futures", + "futures-concurrency", + "getrandom 0.3.4", + "gpui-fast-macros", + "gpui-pre-collections", + "gpui-pre-http-client", + "gpui-pre-refineable", + "gpui-pre-scheduler", + "gpui-pre-shared-string", + "gpui-pre-sum-tree", + "gpui-pre-util", + "heapless", + "image", + "inventory", + "itertools 0.14.0", + "libc", + "log", + "lyon", + "num_cpus", + "objc2-core-foundation", + "objc2-core-video", + "parking", + "parking_lot", + "pin-project", + "pollster 0.4.0", + "postage", + "profiling", + "proptest", + "rand 0.9.5", + "raw-window-handle", + "regex", + "resvg 0.46.0", + "schemars", + "seahash", + "serde", + "serde_json", + "slotmap", + "smallvec", + "spin 0.10.1", + "strum 0.28.0", + "taffy 0.15.0", + "thiserror 2.0.21", + "ttf-parser", + "url", + "usvg 0.46.0", + "uuid", + "waker-fn", + "web-time", + "windows 0.62.2", + "zed-scap", +] + +[[package]] +name = "gpui-fast-apple" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd9051d4ff1f981c8d11d536551dca5189446221dcfdeb0110c62af3a93da676" +dependencies = [ + "anyhow", + "async-task", + "block2 0.6.2", + "cbindgen", + "core-foundation 0.10.1", + "core-foundation-sys", + "core-graphics 0.24.0", + "core-text", + "derive_more", + "dispatch2", + "etagere", + "foreign-types", + "futures", + "gpui-fast", + "gpui-pre-collections", + "gpui-pre-util", + "image", + "libc", + "log", + "mach2", + "metal", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-core-text", + "objc2-core-video", + "objc2-foundation 0.3.2", + "objc2-metal 0.3.2", + "objc2-quartz-core 0.3.2", + "objc2-security", + "parking_lot", + "pathfinder_geometry", + "smallvec", + "thiserror 2.0.21", + "zed-font-kit", +] + +[[package]] +name = "gpui-fast-linux" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f20d5697fb19b0e447750ed61b96c030ba2224b01e51240166543e88fdb5536c" +dependencies = [ + "accesskit", + "accesskit_unix", + "anyhow", + "as-raw-xcb-connection", + "ashpd", + "bytemuck", + "calloop", + "calloop-wayland-source", + "filedescriptor", + "futures", + "gpui-fast", + "gpui-fast-wgpu", + "gpui-pre-collections", + "gpui-pre-http-client", + "gpui-pre-util", + "libc", + "log", + "notify-rust", + "oo7", + "open", + "parking_lot", + "raw-window-handle", + "smallvec", + "smol", + "strum 0.28.0", + "url", + "uuid", + "wayland-backend", + "wayland-client", + "wayland-cursor", + "wayland-protocols", + "wayland-protocols-plasma", + "wayland-protocols-wlr", + "x11rb", + "xkbcommon", + "zed-scap", + "zed-xim", +] + +[[package]] +name = "gpui-fast-macos" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1ba7c34a1549412fb33fff3c35330bd8462f16f4a8f77e1f9804a15eae8a098" +dependencies = [ + "accesskit", + "accesskit_macos", + "anyhow", + "block2 0.6.2", + "core-foundation 0.10.1", + "core-foundation-sys", + "core-graphics 0.24.0", + "ctor", + "dispatch2", + "foreign-types", + "futures", + "gpui-fast", + "gpui-fast-apple", + "gpui-pre-collections", + "gpui-pre-scheduler", + "gpui-pre-util", + "image", + "itertools 0.14.0", + "log", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-core-graphics", + "objc2-core-video", + "objc2-foundation 0.3.2", + "objc2-user-notifications", + "parking_lot", + "raw-window-handle", + "semver", + "smallvec", + "strum 0.28.0", + "uuid", +] + +[[package]] +name = "gpui-fast-macros" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb3d6ba41781dad8ea9f4b73e0eb122916e31dc9137c5af80eb06a5e750691" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "gpui-fast-platform" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2868731e97d39c951031bb98994f0813b27d7f2a9344cb4b3e62f343e1db3e1a" +dependencies = [ + "anyhow", + "console_error_panic_hook", + "gpui-fast", + "gpui-fast-linux", + "gpui-fast-macos", + "gpui-fast-web", + "gpui-fast-wgpu", + "gpui-fast-windows", + "gpui-pre-ios", +] + +[[package]] +name = "gpui-fast-web" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fe935ac901a3c9f679b2e15f6e7ef1414a35870603694b47709b660ae0e56a5" +dependencies = [ + "anyhow", + "async-channel", + "console_error_panic_hook", + "futures", + "gpui-fast", + "gpui-fast-wgpu", + "gpui-pre-http-client", + "gpui-pre-scheduler", + "js-sys", + "log", + "parking_lot", + "raw-window-handle", + "smallvec", + "unicode-properties", + "unicode-script", + "unicode-segmentation", + "uuid", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm_thread", + "web-sys", + "web-time", +] + +[[package]] +name = "gpui-fast-wgpu" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1557220ba04513682d8f08f3c0289ee098d42fc68b4349ddb5786af93e9a24d5" +dependencies = [ + "anyhow", + "bytemuck", + "cosmic-text", + "etagere", + "gpui-fast", + "gpui-pre-collections", + "gpui-pre-util", + "image", + "itertools 0.14.0", + "log", + "parking_lot", + "profiling", + "raw-window-handle", + "smallvec", + "swash", + "unicode-bidi", + "unicode-segmentation", + "web-sys", + "wgpu 30.0.1", + "zed-font-kit", +] + +[[package]] +name = "gpui-fast-windows" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca29f9d7985f6e5021eba769c853ab5776e45ddf041d9905db2a25e2c6d6cfff" +dependencies = [ + "accesskit", + "accesskit_windows", + "anyhow", + "dunce", + "etagere", + "futures", + "gpui-fast", + "gpui-pre-collections", + "gpui-pre-scheduler", + "gpui-pre-util", + "image", + "itertools 0.14.0", + "log", + "parking_lot", + "rand 0.9.5", + "raw-window-handle", + "smallvec", + "uuid", + "windows 0.62.2", + "windows-core 0.62.2", + "windows-numerics 0.3.1", + "windows-registry 0.6.1", +] + [[package]] name = "gpui-kit" version = "0.7.3" @@ -2469,6 +2878,8 @@ checksum = "0fac401f6b149bf33794da0942510240afd29b7b18556574e4cf17196b647066" dependencies = [ "gpui-base", "gpui-component", + "gpui-fast", + "gpui-fast-platform", "gpui-kit-assets", "gpui-pre", "gpui-pre-macros", @@ -2524,6 +2935,7 @@ dependencies = [ "embed-resource", "etagere", "futures", + "futures-concurrency", "getrandom 0.3.4", "gpui-pre-collections", "gpui-pre-http-client", @@ -2546,8 +2958,10 @@ dependencies = [ "parking", "parking_lot", "pin-project", - "pollster", + "pollster 0.4.0", + "postage", "profiling", + "proptest", "rand 0.9.5", "raw-window-handle", "regex", @@ -2560,13 +2974,14 @@ dependencies = [ "smallvec", "spin 0.10.1", "strum 0.28.0", - "taffy", + "taffy 0.13.0", "thiserror 2.0.21", "ttf-parser", "url", "usvg 0.46.0", "uuid", "waker-fn", + "web-time", "windows 0.62.2", "zed-scap", ] @@ -2654,6 +3069,28 @@ dependencies = [ "url", ] +[[package]] +name = "gpui-pre-ios" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13e735b73ae85ed188764287df4d24837045d71a122c51c2264aed8c38ffd51b" +dependencies = [ + "anyhow", + "block2 0.6.2", + "futures", + "gpui-pre", + "gpui-pre-apple", + "log", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "objc2-quartz-core 0.3.2", + "objc2-ui-kit", + "parking_lot", + "raw-window-handle", + "uuid", +] + [[package]] name = "gpui-pre-linux" version = "0.3.9" @@ -2764,6 +3201,7 @@ dependencies = [ "gpui-pre-linux", "gpui-pre-macos", "gpui-pre-web", + "gpui-pre-wgpu", "gpui-pre-windows", ] @@ -2920,6 +3358,7 @@ dependencies = [ "gpui-pre", "gpui-pre-collections", "gpui-pre-util", + "image", "itertools 0.14.0", "log", "parking_lot", @@ -2930,7 +3369,7 @@ dependencies = [ "unicode-bidi", "unicode-segmentation", "web-sys", - "wgpu", + "wgpu 29.0.4", "zed-font-kit", ] @@ -3074,6 +3513,9 @@ name = "hashbrown" version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" +dependencies = [ + "foldhash 0.2.0", +] [[package]] name = "hashlink" @@ -3436,7 +3878,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "525e9ff3e1a4be2fbea1fdf0e98686a6d98b4d8f937e1bf7402245af1909e8c3" dependencies = [ "byteorder-lite", - "quick-error", + "quick-error 2.0.1", ] [[package]] @@ -4190,7 +4632,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2bf919621e7975acb27d881bae2fb993e0d45c8e0446e85e6272971e00dc8df" dependencies = [ "arrayvec", - "bit-set", + "bit-set 0.9.1", "bitflags 2.13.2", "cfg-if", "cfg_aliases", @@ -4209,6 +4651,44 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "naga" +version = "30.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd0dd362bf26c0ffdd143df6da66a25d287e196eff482f117771010b207ad163" +dependencies = [ + "arrayvec", + "bit-set 0.10.0", + "bitflags 2.13.2", + "cfg-if", + "cfg_aliases", + "codespan-reporting", + "half", + "hashbrown 0.17.1", + "indexmap", + "libm", + "log", + "naga-types", + "num-traits", + "once_cell", + "rustc-hash 1.1.0", + "spirv", + "thiserror 2.0.21", + "unicode-ident", +] + +[[package]] +name = "naga-types" +version = "30.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14474170feb673cfb18b3565111a9869797cc1d290fb9ec969c53f5e1e231c6d" +dependencies = [ + "hashbrown 0.17.1", + "indexmap", + "rustc-hash 1.1.0", + "thiserror 2.0.21", +] + [[package]] name = "ndk-sys" version = "0.6.0+11769913" @@ -4594,7 +5074,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" dependencies = [ "bitflags 2.13.2", + "block2 0.6.2", "dispatch2", + "libc", "objc2 0.6.5", ] @@ -4757,6 +5239,7 @@ dependencies = [ "bitflags 2.13.2", "objc2 0.6.5", "objc2-core-foundation", + "objc2-core-graphics", "objc2-foundation 0.3.2", "objc2-metal 0.3.2", ] @@ -4770,6 +5253,20 @@ dependencies = [ "objc2-core-foundation", ] +[[package]] +name = "objc2-ui-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d87d638e33c06f577498cbcc50491496a3ed4246998a7fbba7ccb98b1e7eab22" +dependencies = [ + "bitflags 2.13.2", + "block2 0.6.2", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "objc2-quartz-core 0.3.2", +] + [[package]] name = "objc2-user-notifications" version = "0.3.2" @@ -5158,6 +5655,12 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "pollster" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5da3b0203fd7ee5720aa0b5e790b591aa5d3f41c3ed2c34a3a393382198af2f7" + [[package]] name = "pollster" version = "0.4.0" @@ -5188,6 +5691,21 @@ dependencies = [ "portable-atomic", ] +[[package]] +name = "postage" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af3fb618632874fb76937c2361a7f22afd393c982a2165595407edc75b06d3c1" +dependencies = [ + "atomic", + "crossbeam-queue", + "parking_lot", + "pin-project", + "pollster 0.2.5", + "static_assertions", + "thiserror 1.0.69", +] + [[package]] name = "potential_utf" version = "0.1.6" @@ -5261,6 +5779,39 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "proptest" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8530004ccb15eae51c7e40009fbe317f341f804db54dc033eec1c50be28cfa0" +dependencies = [ + "bit-set 0.11.1", + "bit-vec 0.10.2", + "bitflags 2.13.2", + "chacha20", + "core_detect", + "num-traits", + "proptest-macro", + "rand 0.10.3", + "rand_xorshift", + "regex-syntax", + "rusty-fork", + "tempfile", + "unarray", +] + +[[package]] +name = "proptest-macro" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e99782ea31698c2206c6887c1220d2f594b291c26cb9ec5b6d7cf175320bc212" +dependencies = [ + "convert_case 0.11.0", + "proc-macro2", + "quote", + "syn 3.0.9", +] + [[package]] name = "pulp" version = "0.22.3" @@ -5299,6 +5850,12 @@ dependencies = [ "bytemuck", ] +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + [[package]] name = "quick-error" version = "2.0.1" @@ -5476,6 +6033,15 @@ dependencies = [ "rand_core 0.10.1", ] +[[package]] +name = "rand_xorshift" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60aa6af80be32871323012e02e6e65f8a7cc7890931ae421d217ad8fe0df2ccf" +dependencies = [ + "rand_core 0.10.1", +] + [[package]] name = "range-alloc" version = "0.1.5" @@ -5532,7 +6098,7 @@ dependencies = [ "avif-serialize", "imgref", "loop9", - "quick-error", + "quick-error 2.0.1", "rav1e", "rayon", "rgb", @@ -5967,6 +6533,18 @@ version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" +[[package]] +name = "rusty-fork" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc6bf79ff24e648f6da1f8d1f011e9cac26491b619e6b9280f2b47f1774e6ee2" +dependencies = [ + "fnv", + "quick-error 1.2.3", + "tempfile", + "wait-timeout", +] + [[package]] name = "rustybuzz" version = "0.20.1" @@ -6677,6 +7255,17 @@ dependencies = [ "smallvec", ] +[[package]] +name = "taffy" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c8480887e8803986d96a7173729565520d4bbb721ad6b7ad6941a22897207aa" +dependencies = [ + "serde", + "slotmap", + "smallvec", +] + [[package]] name = "tao-core-video-sys" version = "0.2.0" @@ -6799,7 +7388,7 @@ dependencies = [ "fax", "flate2", "half", - "quick-error", + "quick-error 2.0.1", "weezl", "zune-jpeg 0.5.15", ] @@ -7118,6 +7707,12 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + [[package]] name = "unicase" version = "2.10.0" @@ -7162,9 +7757,9 @@ checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" [[package]] name = "unicode-properties" -version = "0.1.5" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "993ad287eb20e8ba755312801cfe1413e0f25d604075863acaddca10b04c1833" +checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0" [[package]] name = "unicode-script" @@ -7373,6 +7968,15 @@ dependencies = [ "libc", ] +[[package]] +name = "wait-timeout" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11" +dependencies = [ + "libc", +] + [[package]] name = "waker-fn" version = "1.2.0" @@ -7642,7 +8246,7 @@ dependencies = [ "hashbrown 0.16.1", "js-sys", "log", - "naga", + "naga 29.0.4", "parking_lot", "portable-atomic", "profiling", @@ -7652,9 +8256,39 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "wgpu-core", - "wgpu-hal", - "wgpu-types", + "wgpu-core 29.0.4", + "wgpu-hal 29.0.4", + "wgpu-types 29.0.4", +] + +[[package]] +name = "wgpu" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527ccdf43dd5b2e8676eed9984ce00e2bbb0a1b85b70c1969dcb6cd2eb55ab9e" +dependencies = [ + "arrayvec", + "bitflags 2.13.2", + "bytemuck", + "cfg-if", + "cfg_aliases", + "document-features", + "hashbrown 0.17.1", + "js-sys", + "log", + "naga 30.0.2", + "parking_lot", + "portable-atomic", + "profiling", + "raw-window-handle", + "smallvec", + "static_assertions", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "wgpu-core 30.0.2", + "wgpu-hal 30.0.2", + "wgpu-types 30.0.2", ] [[package]] @@ -7664,8 +8298,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2f519832254e56965a9940c4af57dcb75f702b6f6fa4a0b172f685395843a4d7" dependencies = [ "arrayvec", - "bit-set", - "bit-vec", + "bit-set 0.9.1", + "bit-vec 0.9.1", "bitflags 2.13.2", "bytemuck", "cfg_aliases", @@ -7673,7 +8307,7 @@ dependencies = [ "hashbrown 0.16.1", "indexmap", "log", - "naga", + "naga 29.0.4", "once_cell", "parking_lot", "portable-atomic", @@ -7682,13 +8316,48 @@ dependencies = [ "rustc-hash 1.1.0", "smallvec", "thiserror 2.0.21", - "wgpu-core-deps-apple", - "wgpu-core-deps-emscripten", - "wgpu-core-deps-wasm", - "wgpu-core-deps-windows-linux-android", - "wgpu-hal", - "wgpu-naga-bridge", - "wgpu-types", + "wgpu-core-deps-apple 29.0.4", + "wgpu-core-deps-emscripten 29.0.4", + "wgpu-core-deps-wasm 29.0.4", + "wgpu-core-deps-windows-linux-android 29.0.4", + "wgpu-hal 29.0.4", + "wgpu-naga-bridge 29.0.4", + "wgpu-types 29.0.4", +] + +[[package]] +name = "wgpu-core" +version = "30.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad661da2ee99f208c30090b585284b2ab5b8bf2358ddf2d2215592808ec62f1a" +dependencies = [ + "arrayvec", + "bit-set 0.10.0", + "bit-vec 0.9.1", + "bitflags 2.13.2", + "bytemuck", + "cfg_aliases", + "document-features", + "hashbrown 0.17.1", + "indexmap", + "log", + "naga 30.0.2", + "naga-types", + "once_cell", + "parking_lot", + "portable-atomic", + "profiling", + "raw-window-handle", + "rustc-hash 1.1.0", + "smallvec", + "thiserror 2.0.21", + "wgpu-core-deps-apple 30.0.2", + "wgpu-core-deps-emscripten 30.0.2", + "wgpu-core-deps-wasm 30.0.2", + "wgpu-core-deps-windows-linux-android 30.0.2", + "wgpu-hal 30.0.2", + "wgpu-naga-bridge 30.0.2", + "wgpu-types 30.0.2", ] [[package]] @@ -7697,7 +8366,16 @@ version = "29.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f5e39e26c4c0e07589e67d18546cf79ff45383659fc72fca4dd293358a0347f3" dependencies = [ - "wgpu-hal", + "wgpu-hal 29.0.4", +] + +[[package]] +name = "wgpu-core-deps-apple" +version = "30.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d3f2f24aee039ffe9ef527300daf6b7428c58edeefdaa1700f4fa0fd754df16" +dependencies = [ + "wgpu-hal 30.0.2", ] [[package]] @@ -7706,7 +8384,16 @@ version = "29.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "01e09be551dc939498bdd5f6b2c66e55ab275dad25825267a08605a80fc9f0af" dependencies = [ - "wgpu-hal", + "wgpu-hal 29.0.4", +] + +[[package]] +name = "wgpu-core-deps-emscripten" +version = "30.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55ccf093bd215ae9dc4f96df293e675513ac1f2569f8293a2911cc34ca3505d1" +dependencies = [ + "wgpu-hal 30.0.2", ] [[package]] @@ -7715,7 +8402,16 @@ version = "29.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af1fb1798be2a912497d4c224f72d39bb0cb34af50e8bcc29865bc339c943059" dependencies = [ - "wgpu-hal", + "wgpu-hal 29.0.4", +] + +[[package]] +name = "wgpu-core-deps-wasm" +version = "30.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b20f43aeb9962d05e61e3ccb717e2e27ba1b04e979d4ca7e361384f8ee03db56" +dependencies = [ + "wgpu-hal 30.0.2", ] [[package]] @@ -7724,7 +8420,16 @@ version = "29.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4e592c1bbef6ad047647ae6e666ebd8cee7a32bb4544d9700ec96cbf73230257" dependencies = [ - "wgpu-hal", + "wgpu-hal 29.0.4", +] + +[[package]] +name = "wgpu-core-deps-windows-linux-android" +version = "30.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1331b08fa2362c5d454eccc4448e6e4f01eccfea569a00e310adbfc4415f2bdc" +dependencies = [ + "wgpu-hal 30.0.2", ] [[package]] @@ -7736,7 +8441,7 @@ dependencies = [ "android_system_properties", "arrayvec", "ash", - "bit-set", + "bit-set 0.9.1", "bitflags 2.13.2", "block2 0.6.2", "bytemuck", @@ -7752,7 +8457,7 @@ dependencies = [ "libc", "libloading", "log", - "naga", + "naga 29.0.4", "ndk-sys", "objc2 0.6.5", "objc2-core-foundation", @@ -7774,8 +8479,64 @@ dependencies = [ "wasm-bindgen", "wayland-sys", "web-sys", - "wgpu-naga-bridge", - "wgpu-types", + "wgpu-naga-bridge 29.0.4", + "wgpu-types 29.0.4", + "windows 0.62.2", + "windows-core 0.62.2", + "windows-result 0.4.1", +] + +[[package]] +name = "wgpu-hal" +version = "30.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a57452fe453658e141aafdb09de1028afa498805fab518238ddf372a518813ff" +dependencies = [ + "android_system_properties", + "arrayvec", + "ash", + "bit-set 0.10.0", + "bitflags 2.13.2", + "block2 0.6.2", + "bytemuck", + "cfg-if", + "cfg_aliases", + "glow", + "glutin_wgl_sys", + "gpu-allocator", + "hashbrown 0.17.1", + "js-sys", + "khronos-egl", + "libc", + "libloading", + "log", + "naga 30.0.2", + "naga-types", + "ndk-sys", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", + "objc2-metal 0.3.2", + "objc2-quartz-core 0.3.2", + "once_cell", + "ordered-float", + "parking_lot", + "portable-atomic", + "portable-atomic-util", + "profiling", + "range-alloc", + "raw-window-handle", + "raw-window-metal", + "renderdoc-sys", + "smallvec", + "static_assertions", + "thiserror 2.0.21", + "wasm-bindgen", + "wayland-sys", + "web-sys", + "wgpu-naga-bridge 30.0.2", + "wgpu-types 30.0.2", "windows 0.62.2", "windows-core 0.62.2", "windows-result 0.4.1", @@ -7787,8 +8548,18 @@ version = "29.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95226013f547544b223281cd16a4fb549aa9dcb562adbda0faae4c73ffbbc161" dependencies = [ - "naga", - "wgpu-types", + "naga 29.0.4", + "wgpu-types 29.0.4", +] + +[[package]] +name = "wgpu-naga-bridge" +version = "30.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44a62ead68aad7cd40ac9e2cd2b8ec64f32dfbad2765f429b9fb74b8b735869f" +dependencies = [ + "naga 30.0.2", + "wgpu-types 30.0.2", ] [[package]] @@ -7805,6 +8576,22 @@ dependencies = [ "web-sys", ] +[[package]] +name = "wgpu-types" +version = "30.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9f6ee0bd50f5ab79fb8c25e3f33afb27126f034af4ba5909c7a0967058659e6" +dependencies = [ + "bitflags 2.13.2", + "bytemuck", + "js-sys", + "log", + "naga-types", + "raw-window-handle", + "static_assertions", + "web-sys", +] + [[package]] name = "which" version = "8.0.6" diff --git a/Cargo.toml b/Cargo.toml index 97465a2..1f758ee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,4 +23,5 @@ testresult = "0.4.2" thiserror = "2.0.21" [dev-dependencies] +gpui-kit = { version = "0.7.0", features = ["test-support"] } tempfile = "3.27.0" diff --git a/src/components/error_alert.rs b/src/components/error_alert.rs new file mode 100644 index 0000000..eb9f53d --- /dev/null +++ b/src/components/error_alert.rs @@ -0,0 +1,13 @@ +use gpui_kit::{App, InteractiveElement, IntoElement, Role, SharedString, StatefulInteractiveElement, TestSupportExt}; +use gpui_omarchy::{Status, alert}; + + +/// An error alert whose message is also its accessible label, +/// so screen readers announce it and UI tests can find it by its "error" ID. +pub fn error_alert(message: SharedString, cx: &App) -> impl IntoElement { + alert(message.clone(), Status::Error, cx) + .id("error") + .role(Role::Alert) + .aria_label(message) + .test_support() +} diff --git a/src/components/mod.rs b/src/components/mod.rs index 31b64d8..6fa717c 100644 --- a/src/components/mod.rs +++ b/src/components/mod.rs @@ -1,3 +1,5 @@ +mod error_alert; mod passphrase_input; +pub use error_alert::error_alert; pub use passphrase_input::{PassphraseInput, PassphraseInputEvent}; diff --git a/src/components/passphrase_input.rs b/src/components/passphrase_input.rs index 6e5b270..7e78be1 100644 --- a/src/components/passphrase_input.rs +++ b/src/components/passphrase_input.rs @@ -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, show: Entity, _subscriptions: Vec, @@ -29,7 +30,7 @@ pub enum PassphraseInputEvent { impl EventEmitter for PassphraseInput {} impl PassphraseInput { - pub fn new(show: Entity, window: &mut Window, cx: &mut Context) -> Self { + pub fn new(id: impl Into, show: Entity, window: &mut Window, cx: &mut Context) -> 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))), ) } diff --git a/src/db/config.rs b/src/db/config.rs index 1321880..a86ced2 100644 --- a/src/db/config.rs +++ b/src/db/config.rs @@ -13,7 +13,8 @@ impl Db { pub fn save_private_config(&self, config: &PrivateConfig) -> Result<(), CreddyError> { let json = serde_json::to_string(&config)?; let conn = self.connection.lock().unwrap(); - conn.execute("INSERT INTO config VALUES (?);", [&json])?; + // the migration seeds the only row, so this is always an update + conn.execute("UPDATE config SET value = ?;", [&json])?; Ok(()) } } diff --git a/src/main.rs b/src/main.rs index 6e60be3..d5d7da4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,6 @@ use gpui_kit::{ - AppContext, Context, IntoElement, ParentElement, Render, Styled, Window, WindowOptions, div, + App, AppContext, Context, IntoElement, ParentElement, Render, Styled, Window, WindowHandle, + WindowOptions, div, }; use gpui_omarchy::ActiveTheme; @@ -46,6 +47,20 @@ impl Render for CreddyApp { } } +/// Install the globals and open the main window. Tests call this too, so they get the same wiring. +fn launch(cx: &mut App, config: AppConfig, session: AppSession) -> WindowHandle { + gpui_omarchy::init(cx); + cx.set_global(config); + cx.set_global(session); + // refresh_windows() forces everything to re-render, which is kind of a nuclear solution, + // but these values aren't expected to change very frequently, so it shouldn't be a problem + cx.observe_global::(|cx| cx.refresh_windows()).detach(); + cx.observe_global::(|cx| cx.refresh_windows()).detach(); + + cx.open_window(WindowOptions::default(), |_, cx| cx.new(|_| CreddyApp {})) + .expect("open window") +} + fn main() { // todo: replace this with proper error handling let app_config = AppConfig::load().expect("failed to load config"); @@ -55,16 +70,138 @@ fn main() { gpui_kit::application() .with_assets(gpui_kit::assets::Assets) .run(|app| { - gpui_omarchy::init(app); - app.set_global(app_config); - app.set_global(app_session); - // refresh_windows() forces everything to re-render, which is kind of a nuclear solution, - // but these values aren't expected to change very frequently, so it shouldn't be a problem - app.observe_global::(|app| app.refresh_windows()).detach(); - app.observe_global::(|app| app.refresh_windows()).detach(); - - app.open_window(WindowOptions::default(), |_, cx| cx.new(|_| CreddyApp {})) - .expect("open window"); + launch(app, app_config, app_session); app.activate(true); }); } + + +#[cfg(test)] +mod tests { + use gpui_kit::{AnyWindowHandle, TestAppContext}; + use gpui_kit::test::TestWindowExt; + use super::*; + use crate::test_data::{TEST_PASSPHRASE, TestEnv}; + + /// Start the app against the test environment, as `main` would. + fn open_app(env: &TestEnv, cx: &mut TestAppContext) -> AnyWindowHandle { + let window = cx.update(|cx| launch(cx, env.config.clone(), AppSession::load(&env.config))); + // first frame, so that elements exist to be found + cx.update_window(window.into(), |_, window, cx| window.render_frame(cx)).unwrap(); + window.into() + } + + /// Do something in the window, then let any resulting tasks (e.g. the KDF) finish. + fn act(window: AnyWindowHandle, cx: &mut TestAppContext, f: impl FnOnce(&mut Window, &mut App)) { + cx.update_window(window, |_, window, cx| f(window, cx)).unwrap(); + cx.run_until_parked(); + cx.update_window(window, |_, window, cx| window.render_frame(cx)).unwrap(); + } + + /// Click into a field and type. + fn fill(window: AnyWindowHandle, id: &'static str, text: &str, cx: &mut TestAppContext) { + act(window, cx, |window, cx| { + window.click(id, cx); + window.input(text, cx); + }); + } + + fn click(window: AnyWindowHandle, id: &'static str, cx: &mut TestAppContext) { + act(window, cx, |window, cx| window.click(id, cx)); + } + + /// The message in the error alert, if one is showing. + fn error_message(window: AnyWindowHandle, cx: &mut TestAppContext) -> Option { + cx.update_window(window, |_, window, _| { + window.try_find("error").and_then(|e| e.label().map(String::from)) + }).unwrap() + } + + fn is_unlocked(cx: &TestAppContext) -> bool { + cx.read(|cx| matches!(cx.global::(), AppSession::Unlocked(_))) + } + + #[gpui_kit::test] + fn test_welcome_success(cx: &mut TestAppContext) { + let env = TestEnv::new().unwrap(); + let window = open_app(&env, cx); + + fill(window, "passphrase", TEST_PASSPHRASE, cx); + fill(window, "confirm", TEST_PASSPHRASE, cx); + click(window, "submit", cx); + + assert_eq!(error_message(window, cx), None); + assert!(is_unlocked(cx)); + assert!(env.config.db_path().exists()); + } + + #[gpui_kit::test] + fn test_welcome_mismatch(cx: &mut TestAppContext) { + let env = TestEnv::new().unwrap(); + let window = open_app(&env, cx); + + fill(window, "passphrase", TEST_PASSPHRASE, cx); + fill(window, "confirm", "something else", cx); + click(window, "submit", cx); + + assert_eq!(error_message(window, cx).as_deref(), Some("Passphrases do not match.")); + assert!(!is_unlocked(cx)); + assert!(!env.config.db_path().exists()); + } + + #[gpui_kit::test] + fn test_welcome_empty(cx: &mut TestAppContext) { + let env = TestEnv::new().unwrap(); + let window = open_app(&env, cx); + + click(window, "submit", cx); + + assert_eq!(error_message(window, cx).as_deref(), Some("Passphrase is empty.")); + assert!(!is_unlocked(cx)); + assert!(!env.config.db_path().exists()); + } + + #[gpui_kit::test] + fn test_unlock_success(cx: &mut TestAppContext) { + let env = TestEnv::new().unwrap(); + env.db().unwrap(); // create the db, then close it again so the app starts out locked + let window = open_app(&env, cx); + + fill(window, "passphrase", TEST_PASSPHRASE, cx); + click(window, "submit", cx); + + assert_eq!(error_message(window, cx), None); + assert!(is_unlocked(cx)); + } + + #[gpui_kit::test] + fn test_unlock_wrong_passphrase(cx: &mut TestAppContext) { + let env = TestEnv::new().unwrap(); + env.db().unwrap(); + let window = open_app(&env, cx); + + fill(window, "passphrase", "not the passphrase", cx); + click(window, "submit", cx); + + assert_eq!(error_message(window, cx).as_deref(), Some("Incorrect passphrase.")); + assert!(!is_unlocked(cx)); + } + + #[gpui_kit::test] + fn test_unlock_restores_private_config(cx: &mut TestAppContext) { + let env = TestEnv::new().unwrap(); + let mut saved = env.config.clone(); + saved.rehide_ms = 5000; + env.db().unwrap().save_private_config(&saved.private_config()).unwrap(); + + let window = open_app(&env, cx); + // before unlocking, only the defaults are available + assert_eq!(cx.read(|cx| cx.global::().rehide_ms), env.config.rehide_ms); + + fill(window, "passphrase", TEST_PASSPHRASE, cx); + click(window, "submit", cx); + + assert!(is_unlocked(cx)); + assert_eq!(cx.read(|cx| cx.global::().rehide_ms), 5000); + } +} diff --git a/src/screens/unlock.rs b/src/screens/unlock.rs index f234751..1b6c3f3 100644 --- a/src/screens/unlock.rs +++ b/src/screens/unlock.rs @@ -2,9 +2,9 @@ use gpui_kit::{ AppContext, BorrowAppContext, Context, Entity, FontWeight, IntoElement, ParentElement, Render, SharedString, Styled, Subscription, Task, Window, div, rems, }; -use gpui_omarchy::{ButtonVariant, Status, alert, button, focus_scope}; +use gpui_omarchy::{ButtonVariant, button, focus_scope}; -use crate::components::{PassphraseInput, PassphraseInputEvent}; +use crate::components::{PassphraseInput, PassphraseInputEvent, error_alert}; use crate::config::AppConfig; use crate::db::Db; use crate::error::CreddyError; @@ -24,7 +24,7 @@ impl UnlockScreen { pub fn new(window: &mut Window, cx: &mut Context) -> Self { // nothing else shares the show/hide flag, so it's private to this input let show = cx.new(|_| false); - let passphrase = cx.new(|cx| PassphraseInput::new(show, window, cx)); + let passphrase = cx.new(|cx| PassphraseInput::new("passphrase", show, window, cx)); passphrase.update(cx, |input, cx| input.focus(window, cx)); let submit = cx.subscribe_in(&passphrase, window, |this, _, event, window, cx| { @@ -125,7 +125,7 @@ impl Render for UnlockScreen { .font_weight(FontWeight::BOLD) .child("Please enter your passphrase"), ) - .children(self.error.clone().map(|e| alert(e, Status::Error, cx))) + .children(self.error.clone().map(|e| error_alert(e, cx))) .child(self.passphrase.clone()) .child( button("submit", "Submit", ButtonVariant::Primary, cx) diff --git a/src/screens/welcome.rs b/src/screens/welcome.rs index 6f82c11..67d0fc5 100644 --- a/src/screens/welcome.rs +++ b/src/screens/welcome.rs @@ -2,9 +2,9 @@ use gpui_kit::{ AppContext, Context, Entity, FontWeight, IntoElement, ParentElement, Render, SharedString, Styled, Subscription, Task,Window, div, rems, }; -use gpui_omarchy::{ActiveTheme, ButtonVariant, Status, alert, button, focus_scope}; +use gpui_omarchy::{ActiveTheme, ButtonVariant, button, focus_scope}; -use crate::components::{PassphraseInput, PassphraseInputEvent}; +use crate::components::{PassphraseInput, PassphraseInputEvent, error_alert}; use crate::config::AppConfig; use crate::db::Db; use crate::session::AppSession; @@ -26,8 +26,8 @@ pub struct WelcomeScreen { impl WelcomeScreen { pub fn new(window: &mut Window, cx: &mut Context) -> Self { let show = cx.new(|_| false); - let passphrase = cx.new(|cx| PassphraseInput::new(show.clone(), window, cx)); - let confirm = cx.new(|cx| PassphraseInput::new(show, window, cx)); + let passphrase = cx.new(|cx| PassphraseInput::new("passphrase", show.clone(), window, cx)); + let confirm = cx.new(|cx| PassphraseInput::new("confirm", show, window, cx)); passphrase.update(cx, |input, cx| input.focus(window, cx)); let mut _subscriptions = Vec::new(); @@ -162,7 +162,7 @@ impl Render for WelcomeScreen { .flex() .flex_col() .gap(rems(1.)) - .children(self.error.clone().map(|e| alert(e, Status::Error, cx))) + .children(self.error.clone().map(|e| error_alert(e, cx))) .child(field("Passphrase", &self.passphrase)) .child(field("Re-enter passphrase", &self.confirm)) .child(