feat: Begins equipment settings form tests.
This commit is contained in:
@@ -91,15 +91,15 @@ public struct EquipmentSettingsForm {
|
||||
switch action {
|
||||
|
||||
case .binding(\.maxStaticPressure):
|
||||
handleStaticPressure(\.maximum, \.maxStaticPressure, &state)
|
||||
state.sharedSettings.handleStaticPressure(\.maximum, state.maxStaticPressure)
|
||||
return .none
|
||||
|
||||
case .binding(\.minStaticPressure):
|
||||
handleStaticPressure(\.minimum, \.minStaticPressure, &state)
|
||||
state.sharedSettings.handleStaticPressure(\.maximum, state.minStaticPressure)
|
||||
return .none
|
||||
|
||||
case .binding(\.ratedStaticPressure):
|
||||
handleStaticPressure(\.rated, \.ratedStaticPressure, &state)
|
||||
state.sharedSettings.handleStaticPressure(\.rated, state.ratedStaticPressure)
|
||||
return .none
|
||||
|
||||
case .binding:
|
||||
@@ -132,19 +132,18 @@ public struct EquipmentSettingsForm {
|
||||
}
|
||||
.ifLet(\.$destination, action: \.destination)
|
||||
}
|
||||
|
||||
private func handleStaticPressure(
|
||||
_ staticKeyPath: WritableKeyPath<RatedStaticPressures, Double>,
|
||||
_ stateKeyPath: KeyPath<State, Double?>,
|
||||
_ state: inout State
|
||||
) {
|
||||
let value = state[keyPath: stateKeyPath]
|
||||
state.sharedSettings.equipmentMetadata.ratedStaticPressures[keyPath: staticKeyPath] = value ?? 0
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension SharedPressureEstimationState {
|
||||
mutating func handleStaticPressure(
|
||||
_ keyPath: WritableKeyPath<RatedStaticPressures, Double>,
|
||||
_ value: Double?
|
||||
) {
|
||||
equipmentMetadata.ratedStaticPressures[keyPath: keyPath] = value ?? 0
|
||||
}
|
||||
}
|
||||
|
||||
@ViewAction(for: EquipmentSettingsForm.self)
|
||||
public struct EquipmentSettingsFormView: View {
|
||||
|
||||
@@ -256,12 +255,6 @@ public struct EquipmentSettingsFormView: View {
|
||||
|
||||
Section {
|
||||
VStack(alignment: .leading) {
|
||||
// HStack {
|
||||
// TextLabel("Includes Filter Drop")
|
||||
// Spacer()
|
||||
// Toggle("Includes Filter Drop", isOn: $store.includesFilterDrop)
|
||||
// }
|
||||
// if store.includesFilterDrop {
|
||||
HStack {
|
||||
TextLabel("Filter Drop")
|
||||
Spacer()
|
||||
@@ -273,7 +266,6 @@ public struct EquipmentSettingsFormView: View {
|
||||
.decimalPad()
|
||||
.padding(.leading, 40)
|
||||
}
|
||||
// }
|
||||
}
|
||||
} header: {
|
||||
header(infoView: .manufacturersIncludedFilterPressureDrop) {
|
||||
|
||||
Reference in New Issue
Block a user