Files
swift-composable-architectu…/Examples/Integration/IntegrationUITests/Legacy/EscapedWithViewStoreTests.swift
Stephen Celis f02fab5000 Allow an alert to present another alert (#3309)
* Allow an alert to present another alert

When we added support for vanilla SwiftUI modifiers, we lost the ability
to present one alert after another because `nil` writes to the alert
bindings unconditionally dismissed the feature, even if the feature was
freshly presented.

This fixes things by suppressing dismissal when the identity of a
presented item has changed.

Fix #3272.

* wip
2024-08-26 15:19:08 -07:00

41 lines
1.3 KiB
Swift

import Integration
import TestCases
import XCTest
final class EscapedWithViewStoreTests: BaseIntegrationTests {
@MainActor
override func setUpWithError() throws {
try super.setUpWithError()
self.app.buttons["Legacy"].tap()
app.collectionViews.buttons[TestCase.Legacy.escapedWithViewStore.rawValue].tap()
}
@MainActor
func testExample() async throws {
XCTAssertEqual(app.staticTexts["Label"].value as? String, "10")
XCTAssertEqual(app.staticTexts["EscapedLabel"].value as? String, "10")
app.buttons["Button"].tap()
XCTAssertEqual(app.staticTexts["Label"].value as? String, "11")
XCTAssertEqual(app.staticTexts["EscapedLabel"].value as? String, "11")
let stepper = app.steppers["Stepper"]
stepper.buttons["Increment"].tap()
stepper.buttons["Increment"].tap()
stepper.buttons["Increment"].tap()
stepper.buttons["Increment"].tap()
XCTAssertEqual(app.staticTexts["Label"].value as? String, "15")
XCTAssertEqual(app.staticTexts["EscapedLabel"].value as? String, "15")
stepper.buttons["Decrement"].tap()
stepper.buttons["Decrement"].tap()
stepper.buttons["Decrement"].tap()
XCTAssertEqual(app.staticTexts["Label"].value as? String, "12")
XCTAssertEqual(app.staticTexts["EscapedLabel"].value as? String, "12")
}
}