mirror of
https://github.com/pointfreeco/swift-composable-architecture.git
synced 2025-12-20 09:11:33 +01:00
Fix tutorials (#2355)
* add deleted code * fix compile error * fix doc link * add for alert
This commit is contained in:
@@ -21,6 +21,8 @@ struct ContactsFeature: Reducer {
|
||||
return .none
|
||||
|
||||
case let .addContact(.presented(.delegate(.saveContact(contact)))):
|
||||
// guard let contact = state.addContact?.contact
|
||||
// else { return .none }
|
||||
state.contacts.append(contact)
|
||||
state.addContact = nil
|
||||
return .none
|
||||
|
||||
@@ -22,7 +22,7 @@ final class ContactsFeatureTests: XCTestCase {
|
||||
AlertState {
|
||||
TextState("Are you sure?")
|
||||
} actions: {
|
||||
ButtonState(role: .destructive, action: .confirmDeletion(id: id)) {
|
||||
ButtonState(role: .destructive, action: .confirmDeletion(id: UUID(1))) {
|
||||
TextState("Delete")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ final class ContactsFeatureTests: XCTestCase {
|
||||
}
|
||||
|
||||
await store.send(.deleteButtonTapped(id: UUID(1))) {
|
||||
state.destination = .alert(.deleteConfirmation(id: UUID(1)))
|
||||
$0.destination = .alert(.deleteConfirmation(id: UUID(1)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ final class ContactsFeatureTests: XCTestCase {
|
||||
}
|
||||
|
||||
await store.send(.deleteButtonTapped(id: UUID(1))) {
|
||||
state.destination = .alert(.deleteConfirmation(id: UUID(1)))
|
||||
$0.destination = .alert(.deleteConfirmation(id: UUID(1)))
|
||||
}
|
||||
await store.send(.destination(.presented(.alert(.confirmDeletion(id: UUID(1)))))) {
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@
|
||||
Next we want to assert that sometime after the user taps the "Save" button that the
|
||||
contact is added to the array and the child feature is dismissed. However, we cannot assert
|
||||
on that until all the actions have been received, and so we can do that by using
|
||||
``ComposableArchitecture/TestStore/skipReceivedActions(strict:file:line:)-a4ri``.
|
||||
``ComposableArchitecture/TestStore/skipreceivedactions(strict:file:line:)``.
|
||||
|
||||
@Code(name: "ContactsFeatureTests.swift", file: 02-03-02-code-0005)
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ struct ContactDetailFeature: Reducer {
|
||||
return .none
|
||||
}
|
||||
}
|
||||
.ifLet(\.$alert, action: /Action.alert)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user