Fix password visibility icon state
This commit is contained in:
@@ -8399,6 +8399,28 @@ func TestUIPasswordRevealTogglesDisplayedPasswordAndLockResetsIt(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestUIPasswordTogglePresentationMatchesVisibility(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
u := newUIWithModel("desktop", vault.Model{})
|
||||
|
||||
icon, desc := u.passwordTogglePresentation(false)
|
||||
if icon != u.eyeOffIcon {
|
||||
t.Fatal("passwordTogglePresentation(false) should use slashed eye icon")
|
||||
}
|
||||
if desc != "Show password" {
|
||||
t.Fatalf("passwordTogglePresentation(false) desc = %q, want %q", desc, "Show password")
|
||||
}
|
||||
|
||||
icon, desc = u.passwordTogglePresentation(true)
|
||||
if icon != u.eyeIcon {
|
||||
t.Fatal("passwordTogglePresentation(true) should use unslashed eye icon")
|
||||
}
|
||||
if desc != "Hide password" {
|
||||
t.Fatalf("passwordTogglePresentation(true) desc = %q, want %q", desc, "Hide password")
|
||||
}
|
||||
}
|
||||
|
||||
type memoryClipboardWriter struct {
|
||||
content string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user