Skip to content

Commit

Permalink
[CM-1261] Comments updated.
Browse files Browse the repository at this point in the history
  • Loading branch information
devyml committed Mar 22, 2023
1 parent 3a213b5 commit 320cf01
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Sources/YBottomSheet/BottomSheetController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ internal extension BottomSheetController {
}

@objc
func simulateDismiss() {
func simulateTapCloseButton() {
didTapCloseButton()
}
}
14 changes: 9 additions & 5 deletions Tests/YBottomSheetTests/BottomSheetControllerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
}
}

Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 320cf01

Please sign in to comment.