Skip to content
This repository was archived by the owner on Nov 3, 2025. It is now read-only.

Commit bf61ff0

Browse files
committed
fix/uiaccessibilityPerformEscape
1 parent 8dc7ae1 commit bf61ff0

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
//
2+
// UIAccessiblityPerformEscapeTests.swift
3+
// PanModalTests
4+
//
5+
// Created by Sungdoo on 2022/03/17.
6+
// Copyright © 2022 Detail. All rights reserved.
7+
//
8+
9+
import XCTest
10+
import PanModal
11+
12+
class UIAccessiblityPerformEscapeTests: XCTestCase {
13+
14+
class MockViewController: UIViewController, PanModalPresentable {
15+
var panScrollable: UIScrollView? { return nil }
16+
}
17+
18+
override func setUpWithError() throws {
19+
// Put setup code here. This method is called before the invocation of each test method in the class.
20+
}
21+
22+
override func tearDownWithError() throws {
23+
// Put teardown code here. This method is called after the invocation of each test method in the class.
24+
}
25+
26+
func testAccessibilityPerformEscape() throws {
27+
28+
let presenterViewController = UIApplication.shared.keyWindow?.rootViewController
29+
let panModal: UIViewController & PanModalPresentable = MockViewController()
30+
31+
presenterViewController?.presentPanModal(panModal)
32+
XCTAssertNotNil(presenterViewController?.presentedViewController, "panModal should have been presented")
33+
34+
let presentDidFisnish = XCTestExpectation()
35+
let dismissDidFinish = XCTestExpectation()
36+
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
37+
38+
let panContainerView = panModal.view.superview
39+
presentDidFisnish.fulfill()
40+
panContainerView?.accessibilityPerformEscape()
41+
42+
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
43+
XCTAssertNil(presenterViewController?.presentedViewController, "panModal should have been dismissed")
44+
dismissDidFinish.fulfill()
45+
}
46+
}
47+
48+
wait(for: [presentDidFisnish, dismissDidFinish], timeout: 10)
49+
}
50+
}

0 commit comments

Comments
 (0)