@@ -24,13 +24,13 @@ extension RunnerTests {
2424 XCTAssertFalse ( fixtures . isEmpty )
2525 for fixture in fixtures {
2626 XCTAssertEqual (
27- RunnerAlertButtonChoice . buttonIndex ( for : fixture . labels , action : fixture . action ) ,
27+ RunnerAlertButtonChoice . buttonIndex ( for : fixture . labels , action : fixture . action , vocabulary : . english ) ,
2828 fixture . expected , fixture . name
2929 )
3030 if fixture . xctestPopupMarker == true {
3131 XCTAssertEqual (
3232 RunnerAlertButtonChoice . buttonIndex (
33- for : fixture . labels , action : fixture . action , popupMarkerSurface : true
33+ for : fixture . labels , action : fixture . action , popupMarkerSurface : true , vocabulary : . english
3434 ) ,
3535 fixture . xctestPopupMarkerExpected , fixture . name
3636 )
@@ -41,17 +41,17 @@ extension RunnerTests {
4141 func testAlertDismissPicksTheTrackingPromptDeclineLabel ( ) {
4242 // The App Tracking Transparency prompt, as iOS words it in English (#3627).
4343 XCTAssertEqual (
44- RunnerAlertButtonChoice . buttonIndex ( for : [ " Ask App Not to Track " , " Allow " ] , action : " dismiss " ) ,
44+ RunnerAlertButtonChoice . buttonIndex ( for : [ " Ask App Not to Track " , " Allow " ] , action : " dismiss " , vocabulary : . english ) ,
4545 0
4646 )
4747 XCTAssertEqual (
48- RunnerAlertButtonChoice . buttonIndex ( for : [ " Ask App Not to Track " , " Allow " ] , action : " accept " ) ,
48+ RunnerAlertButtonChoice . buttonIndex ( for : [ " Ask App Not to Track " , " Allow " ] , action : " accept " , vocabulary : . english ) ,
4949 1
5050 )
5151 // The list entry alone decides this shape: without it neither label is a recognized decline
5252 // and the choice must refuse rather than guess.
5353 XCTAssertEqual (
54- RunnerAlertButtonChoice . buttonIndex ( for : [ " Ask App Not to Track " , " Learn More " ] , action : " dismiss " ) ,
54+ RunnerAlertButtonChoice . buttonIndex ( for : [ " Ask App Not to Track " , " Learn More " ] , action : " dismiss " , vocabulary : . english ) ,
5555 0
5656 )
5757 }
@@ -70,19 +70,20 @@ extension RunnerTests {
7070 [ " Accept terms " , " Continue " ]
7171 ] {
7272 XCTAssertNil (
73- RunnerAlertButtonChoice . buttonIndex ( for : labels , action : " dismiss " ) ,
73+ RunnerAlertButtonChoice . buttonIndex ( for : labels , action : " dismiss " , vocabulary : . english ) ,
7474 " dismiss must fail without a tap rather than guess through \( labels ) "
7575 )
7676 }
7777 }
7878
7979 func testAlertDismissRefusesAPromptWhoseLabelsNeitherListRecognizes ( ) {
80- // A fully localized prompt: iOS localizes both buttons, so no label is claimed by either
81- // list, no position identifies the decline, and a guess could authorize (#3627).
80+ // A localized prompt outside the vocabulary: no label is claimed by either list, no
81+ // position identifies the decline, and a guess could authorize (#3627). Only the OS's own
82+ // translations in `RunnerAlertLabelVocabulary` make localized labels known.
8283 XCTAssertNil (
8384 RunnerAlertButtonChoice . buttonIndex (
8485 for : [ " Demander à l’app de ne pas suivre " , " Autoriser le suivi " ] ,
85- action : " dismiss "
86+ action : " dismiss " , vocabulary : . english
8687 ) ,
8788 " dismiss must fail without a tap rather than guess through a localized prompt "
8889 )
@@ -93,25 +94,25 @@ extension RunnerTests {
9394 // surface keeps base's close-by-last-element behavior. No consent prompt can carry it, so
9495 // nothing else gains a positional tap.
9596 XCTAssertEqual (
96- RunnerAlertButtonChoice . buttonIndex ( for : [ " Close popover " ] , action : " dismiss " , popupMarkerSurface : true ) ,
97+ RunnerAlertButtonChoice . buttonIndex ( for : [ " Close popover " ] , action : " dismiss " , popupMarkerSurface : true , vocabulary : . english ) ,
9798 0
9899 )
99100 XCTAssertEqual (
100101 RunnerAlertButtonChoice . buttonIndex (
101- for : [ " Details " , " Close popover " ] , action : " dismiss " , popupMarkerSurface : true
102+ for : [ " Details " , " Close popover " ] , action : " dismiss " , popupMarkerSurface : true , vocabulary : . english
102103 ) ,
103104 1
104105 )
105106 XCTAssertNil (
106- RunnerAlertButtonChoice . buttonIndex ( for : [ " Close popover " ] , action : " dismiss " , popupMarkerSurface : false ) ,
107+ RunnerAlertButtonChoice . buttonIndex ( for : [ " Close popover " ] , action : " dismiss " , popupMarkerSurface : false , vocabulary : . english ) ,
107108 " an unlabeled-by-the-list prompt without the marker still refuses "
108109 )
109110 }
110111
111112 func testAlertDismissRefusesAPromptWhoseEveryButtonIsAffirmative ( ) {
112113 for labels in [ [ " Allow " ] , [ " Allow " , " OK " ] , [ " Yes " , " Continue " , " Done " ] ] {
113114 XCTAssertNil (
114- RunnerAlertButtonChoice . buttonIndex ( for : labels , action : " dismiss " ) ,
115+ RunnerAlertButtonChoice . buttonIndex ( for : labels , action : " dismiss " , vocabulary : . english ) ,
115116 " dismiss must fail without a tap rather than authorize through \( labels ) "
116117 )
117118 }
@@ -121,15 +122,15 @@ extension RunnerTests {
121122 /// accept takes the label its own list claims even when a decline is present.
122123 func testAlertDismissStillPicksTheKnownCancelLabelAndAcceptStillTakesOK ( ) {
123124 XCTAssertEqual (
124- RunnerAlertButtonChoice . buttonIndex ( for : [ " Cancel " , " OK " ] , action : " dismiss " ) ,
125+ RunnerAlertButtonChoice . buttonIndex ( for : [ " Cancel " , " OK " ] , action : " dismiss " , vocabulary : . english ) ,
125126 0
126127 )
127128 XCTAssertEqual (
128- RunnerAlertButtonChoice . buttonIndex ( for : [ " Don’t Allow " , " Allow " ] , action : " dismiss " ) ,
129+ RunnerAlertButtonChoice . buttonIndex ( for : [ " Don’t Allow " , " Allow " ] , action : " dismiss " , vocabulary : . english ) ,
129130 0
130131 )
131132 XCTAssertEqual (
132- RunnerAlertButtonChoice . buttonIndex ( for : [ " Cancel " , " OK " ] , action : " accept " ) ,
133+ RunnerAlertButtonChoice . buttonIndex ( for : [ " Cancel " , " OK " ] , action : " accept " , vocabulary : . english ) ,
133134 1
134135 )
135136 }
@@ -139,10 +140,10 @@ extension RunnerTests {
139140 func testAlertAcceptKeepsItsGuardsOnTheDeclineLabelsItMustNotTake ( ) {
140141 // A lone declining button is not an acceptance, and with a choice, accept takes the first
141142 // label the accept list claims.
142- XCTAssertNil ( RunnerAlertButtonChoice . buttonIndex ( for : [ " Ask App Not to Track " ] , action : " accept " ) )
143- XCTAssertNil ( RunnerAlertButtonChoice . buttonIndex ( for : [ " Cancel " ] , action : " accept " ) )
143+ XCTAssertNil ( RunnerAlertButtonChoice . buttonIndex ( for : [ " Ask App Not to Track " ] , action : " accept " , vocabulary : . english ) )
144+ XCTAssertNil ( RunnerAlertButtonChoice . buttonIndex ( for : [ " Cancel " ] , action : " accept " , vocabulary : . english ) )
144145 XCTAssertEqual (
145- RunnerAlertButtonChoice . buttonIndex ( for : [ " Not now " , " Confirm purchase " ] , action : " accept " ) ,
146+ RunnerAlertButtonChoice . buttonIndex ( for : [ " Not now " , " Confirm purchase " ] , action : " accept " , vocabulary : . english ) ,
146147 1
147148 )
148149 }
0 commit comments