From c1472897f90758ab4673ec42e3af4158af9f7dbf Mon Sep 17 00:00:00 2001 From: Neeraj Baid Date: Sat, 9 May 2015 17:05:04 -0700 Subject: [PATCH] Add tests for custom delimiters. --- .../VENTokenFieldSampleTests.m | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/VENTokenFieldSampleTests/VENTokenFieldSampleTests.m b/VENTokenFieldSampleTests/VENTokenFieldSampleTests.m index 2f95fcb..7061db3 100644 --- a/VENTokenFieldSampleTests/VENTokenFieldSampleTests.m +++ b/VENTokenFieldSampleTests/VENTokenFieldSampleTests.m @@ -28,14 +28,24 @@ - (void)testBasicFlow [tester enterTextIntoCurrentFirstResponder:@"Octocat\n"]; [tester waitForViewWithAccessibilityLabel:@"Octocat,"]; + [tester enterTextIntoCurrentFirstResponder:@"Steven,"]; + [tester waitForViewWithAccessibilityLabel:@"Steven,"]; + + [tester enterTextIntoCurrentFirstResponder:@"Andy;"]; + [tester waitForViewWithAccessibilityLabel:@"Andy,"]; + // Make sure everything else is still there. [tester waitForViewWithAccessibilityLabel:@"Ayaka,"]; [tester waitForViewWithAccessibilityLabel:@"Mark,"]; + [tester waitForViewWithAccessibilityLabel:@"Neeraj,"]; + [tester waitForViewWithAccessibilityLabel:@"Octocat,"]; + [tester waitForViewWithAccessibilityLabel:@"Steven,"]; + [tester waitForViewWithAccessibilityLabel:@"Andy,"]; // Delete [tester enterTextIntoCurrentFirstResponder:@"\b"]; [tester enterTextIntoCurrentFirstResponder:@"\b"]; - [tester waitForAbsenceOfViewWithAccessibilityLabel:@"Octocat,"]; + [tester waitForAbsenceOfViewWithAccessibilityLabel:@"Andy,"]; // Clear remaining names to reset state for next test [tester tapViewWithAccessibilityLabel:@"To"]; @@ -45,6 +55,10 @@ - (void)testBasicFlow [tester enterTextIntoCurrentFirstResponder:@"\b"]; [tester enterTextIntoCurrentFirstResponder:@"\b"]; [tester enterTextIntoCurrentFirstResponder:@"\b"]; + [tester enterTextIntoCurrentFirstResponder:@"\b"]; + [tester enterTextIntoCurrentFirstResponder:@"\b"]; + [tester enterTextIntoCurrentFirstResponder:@"\b"]; + [tester enterTextIntoCurrentFirstResponder:@"\b"]; } - (void)testResignFirstResponder @@ -81,12 +95,18 @@ - (void)testResignFirstResponderAndCollapse [tester enterTextIntoCurrentFirstResponder:@"Octocat\n"]; [tester waitForViewWithAccessibilityLabel:@"Octocat,"]; + [tester enterTextIntoCurrentFirstResponder:@"Steven,"]; + [tester waitForViewWithAccessibilityLabel:@"Steven,"]; + + [tester enterTextIntoCurrentFirstResponder:@"Andy;"]; + [tester waitForViewWithAccessibilityLabel:@"Andy,"]; + [tester tapViewWithAccessibilityLabel:@"Resign First Responder"]; [tester waitForAbsenceOfSoftwareKeyboard]; [tester tapViewWithAccessibilityLabel:@"Collapse token field"]; // Confirm the collapse label - [tester waitForViewWithAccessibilityLabel:@"4 people"]; + [tester waitForViewWithAccessibilityLabel:@"6 people"]; // Remove one name and check again [tester tapScreenAtPoint:tokenField.center]; @@ -96,7 +116,7 @@ - (void)testResignFirstResponderAndCollapse [tester tapViewWithAccessibilityLabel:@"Resign First Responder"]; [tester waitForAbsenceOfSoftwareKeyboard]; [tester tapViewWithAccessibilityLabel:@"Collapse token field"]; - [tester waitForViewWithAccessibilityLabel:@"3 people"]; + [tester waitForViewWithAccessibilityLabel:@"5 people"]; } @end