TeraEditingProtectionUITestSurface.swift (1013B)
1 #if DEBUG 2 import SwiftUI 3 4 /// The existing runtime-free shell test mode hosts the actual failure controls. 5 /// Production persistence and relaunch are qualified by the native FFI tests. 6 struct TeraEditingProtectionUITestSurface: View { 7 @StateObject private var protection = TeraEditingProtection() 8 @State private var editing = "Keep this unfinished text" 9 @State private var replacements = 0 10 11 var body: some View { 12 Form { 13 TextField("Editing", text: $editing) 14 .accessibilityIdentifier("tera.test.editing.value") 15 TeraEditingProtectionActions(protection: protection) 16 Button("Attempt replacement") { 17 protection.schedule(kind: .editing, save: { false }, apply: { 18 editing = "" 19 replacements += 1 20 return true 21 }) 22 } 23 .accessibilityIdentifier("tera.test.editing.replace") 24 Text(String(replacements)).accessibilityIdentifier("tera.test.editing.replacements") 25 } 26 } 27 } 28 #endif