blob: 675b33b2b0f6010385778901a9406399e2855b5b [file] [log] [blame]
<!DOCTYPE html>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<body>
<div id="container"></div>
<script src="file:///gen/layout_test_data/mojo/public/js/mojo_bindings.js"></script>
<script src="file:///gen/third_party/blink/public/mojom/web_feature/web_feature.mojom.js"></script>
<script>
test(() => {
internals.clearUseCounter(document, blink.mojom.WebFeature.kARIAHelpAttribute);
var container = document.getElementById('container');
assert_false(internals.isUseCounted(document, blink.mojom.WebFeature.kARIAHelpAttribute));
container.setAttribute("aria-help", "helpful string");
assert_equals(container.getAttribute("aria-help"), "helpful string");
assert_true(internals.isUseCounted(document, blink.mojom.WebFeature.kARIAHelpAttribute));
},"AriaHelpAttribute should be counted in DOM.");
</script>
<div id="container2"></div>
<script>
test(() => {
internals.clearUseCounter(document, blink.mojom.WebFeature.kARIAHelpAttribute);
var divRoot = document.getElementById('container2');
let shadow = divRoot.attachShadow({mode: 'open'});
var paragraph = document.createElement('p');
shadow.appendChild(paragraph);
paragraph.setAttribute("aria-help", "helpful string");
assert_true(internals.isUseCounted(document, blink.mojom.WebFeature.kARIAHelpAttribute));
}, "AriaHelpAttribute should be counted in non-user agent shadow DOM.");
</script>
<div id="placeholder" role="searchbox"></div>
<input id="input-container"></input>
<script>
test(() => {
// Verify that aria-placeholder is counted in light DOM.
internals.clearUseCounter(document, blink.mojom.WebFeature.kAriaPlaceholderAttribute);
var domPlaceholder = document.getElementById('placeholder');
domPlaceholder.setAttribute('aria-placeholder', 'MM-DD-YYYY');
assert_true(internals.isUseCounted(document, blink.mojom.WebFeature.kARIAPlaceholderAttribute));
// <input type=datetime-local> generates shadow DOM and makes use of the aria-placeholder attribute.
internals.clearUseCounter(document, blink.mojom.WebFeature.kARIAPlaceholderAttribute);
assert_false(internals.isUseCounted(document, blink.mojom.WebFeature.kARIAPlaceholderAttribute), "Check that the attribute has been cleared.");
var input = document.getElementById('input-container');
input.setAttribute('type', 'datetime-local');
assert_not_equals(internals.shadowRoot(input).querySelector('[aria-placeholder]'), null, "Attribute should exist in UA shadow DOM");
assert_false(internals.isUseCounted(document, blink.mojom.WebFeature.kARIAPlaceholderAttribute), "Attribute should not be counted in UA shadow DOM.");
}, "Attributes should not be counted in user agent shadow DOM.");
</script>
</body>