diff --git a/Sources/YBottomSheet/BottomSheetController.swift b/Sources/YBottomSheet/BottomSheetController.swift index d108532..f9f08c7 100644 --- a/Sources/YBottomSheet/BottomSheetController.swift +++ b/Sources/YBottomSheet/BottomSheetController.swift @@ -383,7 +383,7 @@ internal extension BottomSheetController { } @objc - func simulateDismiss() { + func simulateTapCloseButton() { didTapCloseButton() } } diff --git a/Tests/YBottomSheetTests/BottomSheetControllerTests.swift b/Tests/YBottomSheetTests/BottomSheetControllerTests.swift index 61f60c9..5bfbd35 100644 --- a/Tests/YBottomSheetTests/BottomSheetControllerTests.swift +++ b/Tests/YBottomSheetTests/BottomSheetControllerTests.swift @@ -314,12 +314,12 @@ final class BottomSheetControllerTests: XCTestCase { XCTAssertTrue(sut.isDismissed) } - func test_onDidDismiss() { + func test_dismissOnCloseButtonTapped() { let sut = SpyBottomSheetController(title: "", childView: UIView()) XCTAssertFalse(sut.isDismissed) - sut.simulateDismiss() + sut.simulateTapCloseButton() XCTAssertTrue(sut.isDismissed) } @@ -334,10 +334,14 @@ final class BottomSheetControllerTests: XCTestCase { sut.simulateOnDimmerTap() sut.simulateOnSwipeDown() + _ = sut.accessibilityPerformEscape() XCTAssertFalse(sut.onSwipeDown) XCTAssertFalse(sut.onDimmerTapped) - XCTAssertFalse(sut.isDismissed) + + // tap close button always dismisses + sut.simulateTapCloseButton() + XCTAssertTrue(sut.isDismissed) } } @@ -385,8 +389,8 @@ final class SpyBottomSheetController: BottomSheetController { var onDimmerTapped = false var onDragging = false - override func simulateDismiss() { - super.simulateDismiss() + override func simulateTapCloseButton() { + super.simulateTapCloseButton() isDismissed = true }