import Foundation import XCTest @testable import CottonUI /// No bottom sheets (row E of the deck faces, 23 Oct 2026; the owner: sheets are /// out of the design). What a sheet carried opens as a card (`cottonCard`); /// the system's own pickers keep theirs (`photosPicker`, `fileImporter`, the /// camera's cover) and the share sheet is UIKit's. final class NoBottomSheetsTests: XCTestCase { /// RULE: nothing in CottonUI presents a SwiftUI sheet or sizes one — every form, picker and flow a sheet carried opens as a card on its page (`CardLayer`). func testNothingInCottonUIPresentsASheet() throws { let presents = #"\.sheet\s*\(\s*(isPresented|item)\s*:|\bpresentationDetents\s*\(|\binteractiveDismissDisabled\s*\(\s*\)"# XCTAssertFalse(try SourceSweep.matches(presents, in: "x.sheet(isPresented: $on) {}").isEmpty) XCTAssertTrue(try SourceSweep.matches(presents, in: "Rectangle().fill(theme.sheet(.cream))").isEmpty) let files = try SourceSweep.swiftSources().filter { $0.name.hasPrefix("CottonUI/") } XCTAssertFalse(files.isEmpty) for file in files { let hits = try SourceSweep.matches(presents, in: SourceSweep.withoutComments(file.text)) XCTAssertTrue(hits.isEmpty, "\(file.name) presents a sheet: \(hits)") } } func testACardTakesTheSmallestHeightItsSheetNamed() { XCTAssertEqual(CardLayerKnobs.height([.content]), .content) XCTAssertEqual(CardLayerKnobs.height([.half, .tall]), .half) XCTAssertEqual(CardLayerKnobs.height([.tall]), .tall) } }