forked from TextureGroup/Texture
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…oup#1069) * Refactored `accessibleElements` to `accessibilityElements`, and removed the re-definition of the property. With this refactor, the field can now be used as a single access point into the accessibility elements of a view. Also, removing the re-definition of the property in _ASDisplayViewAccessibility.h enables us to make use of the field and its associated helper methods directly from the `UIAccessibilityContainer` API rather than rolling our own implementation. * Added tests for the accessors to ASDisplayView.accessibilityElements. * Commented out tests for older a11y accessors & added relevant warnings. Also added assertions that the getter and setter for the accessibilityElements property are used only on the main thread.
- Loading branch information
1 parent
449f23b
commit 6866204
Showing
7 changed files
with
72 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// | ||
// ASDisplayViewAccessibilityTests.mm | ||
// Texture | ||
// | ||
// Copyright (c) 2018-present, Pinterest, Inc. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
|
||
#import <XCTest/XCTest.h> | ||
|
||
#import <AsyncDisplayKit/ASDisplayNode.h> | ||
#import <AsyncDisplayKit/ASDisplayNode+Beta.h> | ||
|
||
@interface ASDisplayViewAccessibilityTests : XCTestCase | ||
@end | ||
|
||
@implementation ASDisplayViewAccessibilityTests | ||
|
||
- (void)testAccessibilityElementsAccessors | ||
{ | ||
// Setup nodes with accessibility info | ||
ASDisplayNode *node = nil; | ||
ASDisplayNode *subnode = nil; | ||
node = [[ASDisplayNode alloc] init]; | ||
subnode = [[ASDisplayNode alloc] init]; | ||
NSString *label = @"foo"; | ||
subnode.isAccessibilityElement = YES; | ||
subnode.accessibilityLabel = label; | ||
[node addSubnode:subnode]; | ||
XCTAssertEqualObjects([node.view.accessibilityElements.firstObject accessibilityLabel], label); | ||
// NOTE: The following tests will fail unless accessibility is enabled, e.g. by turning the | ||
// accessibility inspector on. See https://github.com/TextureGroup/Texture/pull/1069 for details. | ||
/*XCTAssertEqualObjects([[node.view accessibilityElementAtIndex:0] accessibilityLabel], label); | ||
XCTAssertEqual(node.view.accessibilityElementCount, 1); | ||
XCTAssertEqual([node.view indexOfAccessibilityElement:node.view.accessibilityElements.firstObject], 0);*/ | ||
} | ||
|
||
@end |