@@ -343,6 +343,51 @@ final class BottomSheetControllerTests: XCTestCase {
343343 sut. simulateTapCloseButton ( )
344344 XCTAssertTrue ( sut. isDismissed)
345345 }
346+
347+ func test_backgroundColor_copiedFromChild( ) {
348+ let color : UIColor = . systemPurple
349+ let view = UIView ( )
350+ view. backgroundColor = color
351+ let sut = makeSUT ( view: view)
352+ let traits = UITraitCollection ( preferredContentSizeCategory: . large)
353+ XCTAssertNotNil ( view. backgroundColor)
354+
355+ sut. loadViewIfNeeded ( )
356+
357+ XCTAssertEqual (
358+ sut. sheetView. backgroundColor? . resolvedColor ( with: traits) ,
359+ color. resolvedColor ( with: traits)
360+ )
361+ XCTAssertNil ( view. backgroundColor)
362+ }
363+
364+ func test_clearBackgroundColor_notCopiedFromChild( ) {
365+ let view = UIView ( )
366+ view. backgroundColor = . clear
367+ let sut = makeSUT ( view: view)
368+ let traits = UITraitCollection ( preferredContentSizeCategory: . large)
369+
370+ sut. loadViewIfNeeded ( )
371+
372+ XCTAssertEqual (
373+ sut. sheetView. backgroundColor? . resolvedColor ( with: traits) ,
374+ UIColor . systemBackground. resolvedColor ( with: traits)
375+ )
376+ }
377+
378+ func test_nilBackgroundColor_notCopiedFromChild( ) {
379+ let view = UIView ( )
380+ view. backgroundColor = nil
381+ let sut = makeSUT ( view: view)
382+ let traits = UITraitCollection ( preferredContentSizeCategory: . large)
383+
384+ sut. loadViewIfNeeded ( )
385+
386+ XCTAssertEqual (
387+ sut. sheetView. backgroundColor? . resolvedColor ( with: traits) ,
388+ UIColor . systemBackground. resolvedColor ( with: traits)
389+ )
390+ }
346391}
347392
348393private extension BottomSheetControllerTests {
0 commit comments