Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rcancro committed Dec 2, 2021
1 parent 1ed7f41 commit 1564bb3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
15 changes: 15 additions & 0 deletions Tests/ASDisplayViewAccessibilityTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,25 @@
extern void SortAccessibilityElements(NSMutableArray *elements);

@interface ASDisplayViewAccessibilityTests : XCTestCase
@property (nonatomic) ASConfiguration *experimentalConfiguration;
@end

@implementation ASDisplayViewAccessibilityTests

- (void)setUp
{
[super setUp];
self.experimentalConfiguration = [ASConfiguration new];
self.experimentalConfiguration.experimentalFeatures = ASExperimentalEnableNodeIsHiddenFromAcessibility | ASExperimentalEnableAcessibilityElementsReturnNil |ASExperimentalDoNotCacheAccessibilityElements;
[ASConfigurationManager test_resetWithConfiguration:self.experimentalConfiguration];
}

- (void)tearDown
{
[super tearDown];
[ASConfigurationManager test_resetWithConfiguration:nil];
}

- (void)testAccessibilityElementsAccessors
{
// Setup nodes with accessibility info
Expand Down
3 changes: 2 additions & 1 deletion Tests/ASTextNode2Tests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ - (void)testTruncation

- (void)testAccessibility
{
XCTAssertTrue(_textNode.isAccessibilityElement, @"Should be an accessibility element");
XCTAssertFalse(_textNode.isAccessibilityElement, @"Should not be an accessibility element. It is a container");
XCTAssertTrue(_textNode.accessibilityElements.count > 0, @"Should have some accessibility elements");
XCTAssertTrue(_textNode.accessibilityTraits == UIAccessibilityTraitStaticText,
@"Should have static text accessibility trait, instead has %llu",
_textNode.accessibilityTraits);
Expand Down

0 comments on commit 1564bb3

Please sign in to comment.