Cotton code
26 lines · 2.0 KB · SwiftRaw
import Foundationimport XCTest@testable import CottonUI/// Walker 298: with a person's page open over the People list, the list/// beneath — its headers, the A–Z index, every tile, the duplicate Search/// and Every-act buttons — was still announced. The tile stack hid the/// pages beneath only by each page's `accessibilityElementsHidden`, which/// the walker's reader ignored through SwiftUI's bridge (as the fan's arc/// found, `FanArcView`).final class CoveredPageLeavesTheTreeTests: XCTestCase {    /// RULE: over an open record the accessibility tree holds the record's page only — the card's stack names its top page as its one accessibility element (none while a sheet covers it) and says the screen changed — because a page a person cannot see must not be read under the one they opened.    func testTheTreeOverAnOpenRecordHoldsTheRecordPageOnly() throws {        let tiles = SourceSweep.withoutComments(try SourceSweep.mustRead(            "apps/cotton/Sources/CottonUI/Surfaces/Board/TilePage.swift", ownedBy: "phonefixes")).filter { !$0.isWhitespace }        let reads = try XCTUnwrap(tiles.range(of: "funcreadsTop(){"))        let body = String(tiles[reads.upperBound...].prefix(700))        XCTAssertTrue(body.contains("controller.view.accessibilityElementsHidden=covered||controller!==viewControllers.last"),                      "every page under the top one is hidden")        XCTAssertTrue(body.contains("lettop=covered?nil:viewControllers.last?.view"), "the top page alone is readable, none while covered")        XCTAssertTrue(body.contains("view.accessibilityElements=readable"), "the stack names its one readable page itself")        XCTAssertTrue(body.contains("UIAccessibility.post(notification:.screenChanged,argument:top)"), "and says the screen changed")        XCTAssertTrue(tiles.contains("didShowshown:UIViewController,animated:Bool){readsTop()"), "after every push and pop")        XCTAssertTrue(tiles.contains("didSet{ifcovered!=oldValue{readsTop()}}"), "and whenever a sheet covers it")    }}