79423e3511
El bug de los pasos 5 y 6 era invisible a los tests unitarios: el contrato de datos estaba bien, lo que fallaba era que la vista se desmontaba antes de pintar el aha moment y el paywall. Hace falta recorrer la UI de verdad. Anade el target MealMoodUITests (solo simulador, sin firma) y un test que hace el onboarding entero en instalacion limpia y comprueba que Week Ready y el paywall aparecen antes de la Home. Los CTA del onboarding llevan ahora accessibilityIdentifier para que el test no dependa de los textos, que estan en 6 idiomas. Validado en los dos sentidos: pasa con el fix, y revirtiendo temporalmente markFinished: false falla en la asercion de Week Ready. Suite completa: 27 tests. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Ks8uUcMA9mjypVK7F2Pkt
52 lines
1.8 KiB
Swift
52 lines
1.8 KiB
Swift
import SwiftUI
|
|
|
|
struct WeekendsStepView: View {
|
|
@Binding var includeWeekends: Bool
|
|
var onNext: () -> Void
|
|
|
|
var body: some View {
|
|
VStack(spacing: 24) {
|
|
Text("weekends_title")
|
|
.font(.mealMoodH1)
|
|
.foregroundColor(.mealMoodTextPrimary)
|
|
.multilineTextAlignment(.leading)
|
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
.padding(.horizontal, 24)
|
|
.padding(.top, 12)
|
|
|
|
VStack(spacing: 16) {
|
|
HStack {
|
|
VStack(alignment: .leading, spacing: 4) {
|
|
Text("weekends_toggle")
|
|
.font(.mealMoodBody)
|
|
.foregroundColor(.mealMoodTextPrimary)
|
|
}
|
|
Spacer()
|
|
Toggle("", isOn: $includeWeekends)
|
|
.tint(.mealMoodCoral)
|
|
.labelsHidden()
|
|
}
|
|
.padding(16)
|
|
.background(Color.mealMoodSurface)
|
|
.cornerRadius(14)
|
|
.overlay(
|
|
RoundedRectangle(cornerRadius: 14)
|
|
.stroke(Color(hex: "#F0F0F0"), lineWidth: 1)
|
|
)
|
|
}
|
|
.padding(.horizontal, 24)
|
|
|
|
Text("weekends_note")
|
|
.font(.mealMoodSmall)
|
|
.foregroundColor(.mealMoodTextSecondary)
|
|
|
|
PrimaryButton(title: String(localized: "onboarding_continue"), action: onNext)
|
|
.accessibilityIdentifier("onboarding_cta_weekends")
|
|
.padding(.horizontal, 24)
|
|
.padding(.top, 8)
|
|
.padding(.bottom, 40)
|
|
}
|
|
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top)
|
|
}
|
|
}
|