Skip to content

Commit 73bff8f

Browse files
committed
Added 'testSectionsAlwaysOpen' tests.
1 parent 42a9145 commit 73bff8f

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

Tests/Testing_Example/FZAccordionTableViewUnitTests/FZAccordionTableViewInitializationTests.m

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,33 @@ - (void)testInitialOpenSections {
5959
XCTAssert([self.tableView isSectionOpen:i], @"Section %d should be open.", (int)i);
6060
}
6161
}
62+
63+
#pragma mark - Property 'sectionsAlwaysOpen' Tests -
64+
65+
- (void)testSectionsAlwaysOpen {
66+
NSMutableArray *sectionsAlwaysOpen = [NSMutableArray new];
67+
for (NSInteger i = 0; i < self.mainViewController.sections.count; i++) {
68+
[sectionsAlwaysOpen addObject:@(i)];
69+
}
70+
self.tableView.sectionsAlwaysOpen = [NSSet setWithArray:sectionsAlwaysOpen];
71+
72+
[self.mainViewController connectTableView];
73+
74+
// Test that no matter which way you toggle the section, the section remains open.
75+
for (NSInteger i = 0; i < self.tableView.numberOfSections; i++) {
76+
77+
[self waitForHeaderViewInSection:i];
78+
[self.tableView toggleSection:i];
79+
80+
XCTAssert([self.tableView isSectionOpen:i], @"Section %d should be open.", (int)i);
81+
}
82+
for (NSInteger i = 0; i < self.tableView.numberOfSections; i++) {
83+
84+
[self waitForHeaderViewInSection:i];
85+
[self.tableView toggleSection:i];
86+
87+
XCTAssert([self.tableView isSectionOpen:i], @"Section %d should be open.", (int)i);
88+
}
89+
}
90+
6291
@end

0 commit comments

Comments
 (0)