-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Lazar Otasevic
committed
Sep 9, 2024
1 parent
08ed7e9
commit 6da8ad8
Showing
2 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
Sources/ViewInspection/Elements/Extensions/_SecureField.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import SwiftUI | ||
|
||
extension InspectableType._SecureField { | ||
var text: Binding<String> { | ||
get throws { | ||
try node.one(.binding).tryCast() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import SwiftUI | ||
import XCTest | ||
@testable import ViewInspection | ||
|
||
@MainActor final class Test_SecureField: XCTestCase { | ||
func test_SecureField() throws { | ||
let binding = Binding.variable("") | ||
let secureField = try SecureField("", text: binding).snap.one(.secureField) | ||
XCTAssertEqual(binding.wrappedValue, "") | ||
try secureField.text.wrappedValue = "password123" | ||
XCTAssertEqual(binding.wrappedValue, "password123") | ||
} | ||
} |