File tree Expand file tree Collapse file tree 3 files changed +39
-1
lines changed
Classes/ViewRelated/Orders/Order Creation
WooCommerceTests/ViewRelated/Orders/Order Creation Expand file tree Collapse file tree 3 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ private extension AddOrderCoordinator {
6363 case . quick:
6464 presentSimplePaymentsAmountController ( )
6565 case . full:
66- // TODO: start full order creation flow
66+ presentNewOrderController ( )
6767 return
6868 }
6969 }
@@ -80,4 +80,12 @@ private extension AddOrderCoordinator {
8080
8181 ServiceLocator . analytics. track ( event: WooAnalyticsEvent . SimplePayments. simplePaymentsFlowStarted ( ) )
8282 }
83+
84+ /// Presents `NewOrderHostingController`.
85+ ///
86+ func presentNewOrderController( ) {
87+ let viewController = NewOrderHostingController ( )
88+ let newOrderNC = WooNavigationController ( rootViewController: viewController)
89+ navigationController. present ( newOrderNC, animated: true )
90+ }
8391}
Original file line number Diff line number Diff line change 11import SwiftUI
22
3+ /// Hosting controller that wraps an `NewOrder` view.
4+ ///
5+ final class NewOrderHostingController : UIHostingController < NewOrder > {
6+
7+ init ( ) {
8+ super. init ( rootView: NewOrder ( ) )
9+ }
10+
11+ required dynamic init ? ( coder aDecoder: NSCoder ) {
12+ fatalError ( " init(coder:) has not been implemented " )
13+ }
14+ }
15+
316/// View to create a new manual order
417///
518struct NewOrder : View {
Original file line number Diff line number Diff line change @@ -66,6 +66,23 @@ final class AddOrderCoordinatorTests: XCTestCase {
6666 assertThat ( presentedNC, isAnInstanceOf: WooNavigationController . self)
6767 assertThat ( presentedNC? . topViewController, isAnInstanceOf: SimplePaymentsAmountHostingController . self)
6868 }
69+
70+ func test_it_opens_order_creation_when_its_only_available_type( ) throws {
71+ // Given
72+ let coordinator = makeAddProductCoordinator ( isOrderCreationEnabled: true ,
73+ shouldShowSimplePaymentsButton: false )
74+
75+ // When
76+ coordinator. start ( )
77+ waitUntil {
78+ coordinator. navigationController. presentedViewController != nil
79+ }
80+
81+ // Then
82+ let presentedNC = coordinator. navigationController. presentedViewController as? UINavigationController
83+ assertThat ( presentedNC, isAnInstanceOf: WooNavigationController . self)
84+ assertThat ( presentedNC? . topViewController, isAnInstanceOf: NewOrderHostingController . self)
85+ }
6986}
7087
7188private extension AddOrderCoordinatorTests {
You can’t perform that action at this time.
0 commit comments