From f776c853c69c1d7f6065856c7073d3fc2fb311c1574724390a4d806456023d1f Mon Sep 17 00:00:00 2001 From: Yuvomi Mobile Contributors Date: Wed, 21 Oct 2026 07:18:42 +0200 Subject: [PATCH] test(ios): cover context erasure and native capability restrictions Add Apple-platform tests without presenting them as Linux results. Improve native dark-mode contrast and keep the portable policy suite separate from WebKit tests. Swift formatting and syntax checks pass; Xcode execution remains required. --- ios/Package.swift | 3 ++- ios/Sources/ContentView.swift | 6 +++++- ios/Tests/BrowserModelTests.swift | 28 ++++++++++++++++++++++++++++ ios/project.yml | 2 +- 4 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 ios/Tests/BrowserModelTests.swift diff --git a/ios/Package.swift b/ios/Package.swift index 84d3ad3..9272601 100644 --- a/ios/Package.swift +++ b/ios/Package.swift @@ -12,6 +12,7 @@ let package = Package( "AuthenticationView.swift", "BrowserModel.swift", "ContentView.swift", "ServerProbe.swift", "YuvomiApp.swift", "PrivacyInfo.xcprivacy", "Assets.xcassets", ], sources: ["ServerAddress.swift", "ServerMetadata.swift"]), - .testTarget(name: "YuvomiPolicyTests", dependencies: ["Yuvomi"], path: "Tests"), + .testTarget( + name: "YuvomiPolicyTests", dependencies: ["Yuvomi"], path: "Tests", exclude: ["BrowserModelTests.swift"]), ] ) diff --git a/ios/Sources/ContentView.swift b/ios/Sources/ContentView.swift index f6768b0..d7c47db 100644 --- a/ios/Sources/ContentView.swift +++ b/ios/Sources/ContentView.swift @@ -10,6 +10,7 @@ struct ContentView: View { @State private var settings = false @State private var erasing = false @Environment(\.scenePhase) private var scenePhase + @Environment(\.colorScheme) private var colorScheme var body: some View { NavigationStack { @@ -75,7 +76,10 @@ struct ContentView: View { } } .navigationTitle("Yuvomi Mobile").navigationBarTitleDisplayMode(.inline) - .tint(Color(red: 108 / 255, green: 58 / 255, blue: 237 / 255)) + .tint( + colorScheme == .dark + ? Color(red: 167 / 255, green: 139 / 255, blue: 250 / 255) + : Color(red: 108 / 255, green: 58 / 255, blue: 237 / 255)) } .task { if server == nil, let existing = try? ServerAddress(input) { diff --git a/ios/Tests/BrowserModelTests.swift b/ios/Tests/BrowserModelTests.swift new file mode 100644 index 0000000..53bf437 --- /dev/null +++ b/ios/Tests/BrowserModelTests.swift @@ -0,0 +1,28 @@ +import WebKit +import XCTest + +@testable import Yuvomi + +final class BrowserModelTests: XCTestCase { + @MainActor + func testMainViewHasNoNativeBridgeOrAutomaticPopupAccess() { + let model = BrowserModel() + XCTAssertFalse(model.web.configuration.preferences.javaScriptCanOpenWindowsAutomatically) + XCTAssertTrue(model.web.configuration.userContentController.userScripts.isEmpty) + XCTAssertTrue(model.web.configuration.websiteDataStore.isPersistent) + XCTAssertFalse(model.web.isInspectable) + } + + @MainActor + func testServerErasureReplacesHistoryContext() async { + let model = BrowserModel() + let previousView = model.web + await withCheckedContinuation { continuation in + model.erase { continuation.resume() } + } + XCTAssertFalse(previousView === model.web) + XCTAssertNil(model.server) + XCTAssertFalse(model.canGoBack) + XCTAssertNil(model.error) + } +} diff --git a/ios/project.yml b/ios/project.yml index 7fe4dc1..5be5548 100644 --- a/ios/project.yml +++ b/ios/project.yml @@ -26,7 +26,7 @@ targets: NSCameraUsageDescription: Take a photo to upload to your Yuvomi server. NSPhotoLibraryUsageDescription: Choose photos to upload to your Yuvomi server. NSLocalNetworkUsageDescription: Connect to the private Yuvomi server you configure. - ITSAppUsesNonExemptEncryption: NO + ITSAppUsesNonExemptEncryption: false UISupportedInterfaceOrientations: - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft