Cotton code
28 lines · 2.2 KB · SwiftRaw
import Foundationimport XCTest@testable import CottonUI/// Walker 298: while a thing was lifted VoiceOver still read the 38 buttons/// behind the dim — the host hid the page with SwiftUI's hide alone, which/// never reached the UIKit tile stacks the pages stand in — and the lifted/// thing itself was hidden, so only its rows were read.final class LiftIsModalToVoiceOverTests: XCTestCase {    /// RULE: while something is lifted only the lifted thing and its act rows are in the accessibility tree — the page under the dim leaves it with every UIKit arc and tile stack in it, and the lifted layer is modal — because a person on VoiceOver must hear what they lifted and what it offers, not the page they cannot touch behind the dim.    func testUnderALiftOnlyTheLiftedThingAndItsRowsAreRead() throws {        let host = SourceSweep.withoutComments(try SourceSweep.mustRead(            "apps/cotton/Sources/CottonUI/Slips/LiftedActs.swift", ownedBy: "phonefixes")).filter { !$0.isWhitespace }        XCTAssertTrue(host.contains("content.coveredUnread(lifted!=nil).coversTheTileStacks(lifted!=nil)"),                      "the page under a lift leaves the tree, its arcs and tile stacks with it")        XCTAssertTrue(host.contains("transformEnvironment(\\.fanPagesCovered){$0=$0||covered}"),                      "a lift covers every tile stack under it")        XCTAssertTrue(host.contains(".allowsHitTesting(false).accessibilityElement(children:.combine)"),                      "the lifted thing is read as itself")        XCTAssertTrue(host.contains(".accessibilityElement(children:.contain).accessibilityAddTraits(.isModal).accessibilityAction(.escape){lift.fold()}"),                      "the lifted layer is modal, and escape folds it")        // The tile stack hides a covered page from UIKit's tree.        let tiles = SourceSweep.withoutComments(try SourceSweep.mustRead(            "apps/cotton/Sources/CottonUI/Surfaces/Board/TilePage.swift", ownedBy: "phonefixes")).filter { !$0.isWhitespace }        XCTAssertTrue(tiles.contains("controller.view.accessibilityElementsHidden=covered||"),                      "a covered tile stack hides its pages from UIKit's tree")    }}