Skip to content

Commit

Permalink
Add tests for custom delimiters.
Browse files Browse the repository at this point in the history
  • Loading branch information
Neeraj Baid committed May 10, 2015
1 parent 07b4fd2 commit c147289
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions VENTokenFieldSampleTests/VENTokenFieldSampleTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -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"];
Expand All @@ -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
Expand Down Expand Up @@ -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];
Expand All @@ -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

0 comments on commit c147289

Please sign in to comment.