mirror of
https://github.com/home-assistant/iOS.git
synced 2026-06-26 14:18:32 -05:00
<!-- Thank you for submitting a Pull Request and helping to improve Home Assistant. Please complete the following sections to help the processing and review of your changes. Please do not delete anything from this template. --> ## Summary <!-- Provide a brief summary of the changes you have made and most importantly what they aim to achieve --> - Reduce UIKit usage - Each server has it's own self-healing webview with connectivity handling ## Screenshots <!-- If this is a user-facing change not in the frontend, please include screenshots in light and dark mode. --> ## Link to pull request in Documentation repository <!-- Pull requests that add, change or remove functionality must have a corresponding pull request in the Companion App Documentation repository (https://github.com/home-assistant/companion.home-assistant). Please add the number of this pull request after the "#" --> Documentation: home-assistant/companion.home-assistant# ## Any other notes <!-- If there is any other information of note, like if this Pull Request is part of a bigger change, please include it here. --> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
34 lines
1.2 KiB
Swift
34 lines
1.2 KiB
Swift
@testable import HomeAssistant
|
|
@testable import Shared
|
|
import UIKit
|
|
import XCTest
|
|
|
|
@MainActor
|
|
final class HomeAssistantViewTests: XCTestCase {
|
|
func testMakeWebViewControllerUsesProvidedServerAndHasNoInitialURLWithoutRestoration() {
|
|
let server = Server.fake()
|
|
let representable = FrontendView(
|
|
server: server,
|
|
onWebViewController: { _ in },
|
|
overlayState: WebFrontendOverlayState()
|
|
)
|
|
|
|
let controller = representable.makeWebViewController()
|
|
|
|
XCTAssertIdentical(controller.server, server)
|
|
XCTAssertNil(controller.initialURL)
|
|
}
|
|
|
|
func testEachFrontendViewWiresItsControllerToItsOwnOverlayState() {
|
|
let overlayStateA = WebFrontendOverlayState()
|
|
let overlayStateB = WebFrontendOverlayState()
|
|
|
|
let controllerA = FrontendView(server: Server.fake(), overlayState: overlayStateA).makeWebViewController()
|
|
let controllerB = FrontendView(server: Server.fake(), overlayState: overlayStateB).makeWebViewController()
|
|
|
|
XCTAssertIdentical(controllerA.overlayState, overlayStateA)
|
|
XCTAssertIdentical(controllerB.overlayState, overlayStateB)
|
|
XCTAssertNotIdentical(controllerA.overlayState, controllerB.overlayState)
|
|
}
|
|
}
|