Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(991)

Unified Diff: third_party/WebKit/Source/web/tests/AccessibilityObjectModelTest.cpp

Issue 2967193003: Relation list properties for Accessibility Object Model phase 1 (Closed)
Patch Set: Get rid of accidental duplication in inspector output Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/accessibility/AXObject.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/tests/AccessibilityObjectModelTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/AccessibilityObjectModelTest.cpp b/third_party/WebKit/Source/web/tests/AccessibilityObjectModelTest.cpp
index 1622da198469fc57d3212b66a099bb9412cff109..ac9a4f63ee2e92c209657d100c9e494e6e7c5d95 100644
--- a/third_party/WebKit/Source/web/tests/AccessibilityObjectModelTest.cpp
+++ b/third_party/WebKit/Source/web/tests/AccessibilityObjectModelTest.cpp
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "core/dom/AccessibleNode.h"
+#include "core/dom/AccessibleNodeList.h"
#include "core/html/HTMLBodyElement.h"
#include "core/testing/sim/SimRequest.h"
#include "core/testing/sim/SimTest.h"
@@ -342,6 +343,41 @@ TEST_F(AccessibilityObjectModelTest, SparseAttributes) {
->RoleValue());
}
+TEST_F(AccessibilityObjectModelTest, LabeledBy) {
+ SimRequest main_resource("https://example.com/", "text/html");
+ LoadURL("https://example.com/");
+ main_resource.Complete(
+ "<input id=target aria-labelledby='l1 l2'>"
+ "<label id=l1>Label 1</label>"
+ "<label id=l2>Label 2</label>"
+ "<label id=l3>Label 3</label>");
+
+ auto* target = GetDocument().getElementById("target");
+ auto* l1 = GetDocument().getElementById("l1");
+ auto* l2 = GetDocument().getElementById("l2");
+ auto* l3 = GetDocument().getElementById("l3");
+
+ HeapVector<Member<Element>> labeled_by;
+ ASSERT_TRUE(AccessibleNode::GetPropertyOrARIAAttribute(
+ target, AOMRelationListProperty::kLabeledBy, labeled_by));
+ ASSERT_EQ(2U, labeled_by.size());
+ ASSERT_EQ(l1, labeled_by[0]);
+ ASSERT_EQ(l2, labeled_by[1]);
+
+ AccessibleNodeList* node_list = target->accessibleNode()->labeledBy();
+ ASSERT_EQ(nullptr, node_list);
+
+ node_list = new AccessibleNodeList();
+ node_list->add(l3->accessibleNode());
+ target->accessibleNode()->setLabeledBy(node_list);
+
+ labeled_by.clear();
+ ASSERT_TRUE(AccessibleNode::GetPropertyOrARIAAttribute(
+ target, AOMRelationListProperty::kLabeledBy, labeled_by));
+ ASSERT_EQ(1U, labeled_by.size());
+ ASSERT_EQ(l3, labeled_by[0]);
+}
+
} // namespace
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/modules/accessibility/AXObject.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698