Skip to content
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.

Add unit tests verifying that the presented controller's frame matches the expected frame #58

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

jverkoey
Copy link
Contributor

@jverkoey jverkoey commented Nov 13, 2017

This is a follow-up to #55.

Also fixes an existing test that said it was testing the non-animated route.

@jverkoey jverkoey requested a review from romoore November 13, 2017 21:40
Copy link

@romoore romoore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor feedback on naming.

}
}

final class PresentationTransition: NSObject, TransitionWithPresentation {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename to "TestingPresentationTransition"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

waitForExpectations(timeout: 0.1)

XCTAssertEqual(window.rootViewController!.presentedViewController, presentedViewController)
XCTAssertEqual(window.rootViewController!.presentedViewController?.view.bounds, window.bounds)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does make sense to check the view's frame against the window's bounds? Also, this test method name should be updated to reflect frame/bounds.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

func testNoFramesModifiedWhenThereIsAPresentationView() {
let presentedViewController = UIViewController()
let transition = PresentationTransition()
let presentationView = UIView()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: designated iniitalizer initWithFrame?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

override var frameOfPresentedViewInContainerView: CGRect {
if let presentationFrame = presentationFrame {
return presentationFrame
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hurts my head. I need to learn more swift.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants