Commit 49d09037 authored by Jack Steinberg's avatar Jack Steinberg Committed by Commit Bot

Add reflection testing to toast open and type IDL attributes

Bug: 972945
Change-Id: I66a9384caae890e5e2ab99d617af315d080c80b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1714190
Commit-Queue: Jack Steinberg <jacksteinberg@chromium.org>
Reviewed-by: default avatarFergal Daly <fergal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#680149}
parent 703fea9c
......@@ -100,11 +100,6 @@ testToastElement((toast) => {
assertToastNotShown(toast);
}, 'setting `toast.open` to some falsy value on a shown toast will hide the toast');
testToastElement((toast) => {
toast.toggleAttribute('open');
assert_true(toast.open);
}, 'toggling `open` on a hidden toast sets `toast.open` to true');
testToastElementAsync((t, toast) => {
toast.toggleAttribute('open', true);
......@@ -124,36 +119,6 @@ testToastElement((toast) => {
assert_equals(toast.type, '');
}, 'default type is empty string without attribute present');
testToastElement((toast) => {
toast.type = 'warning';
assert_equals(toast.getAttribute('type'), 'warning');
assert_equals(toast.type, 'warning');
}, 'setting type property to an enumerated value changes the type attribute to that value');
testToastElement((toast) => {
toast.type = 'WaRnInG';
assert_equals(toast.getAttribute('type'), 'WaRnInG');
assert_equals(toast.type, 'warning');
}, 'setting type property to an enumerated value is case-insensitive');
testToastElement((toast) => {
toast.type = ' WaRnInG ';
assert_equals(toast.getAttribute('type'), ' WaRnInG ');
assert_equals(toast.type, '');
}, 'setting type property to an enumerated value with whitespace does not work');
testToastElement((toast) => {
toast.type = 'test';
assert_equals(toast.type, '');
assert_equals(toast.getAttribute('type'), 'test');
}, 'setting type to a non-enumerated value sets the type property to empty string');
testToastElement((toast) => {
toast.setAttribute('type', 'test');
assert_equals(toast.type, '');
assert_equals(toast.getAttribute('type'), 'test');
}, 'setting type attribute to a non-enumerated value sets the type property to empty string');
testToastElement((toast) => {
toast.type = 'info';
assert_equals(toast.type, '');
......
<!doctype html>
<title>HTML5 reflection tests: std-toast</title>
<meta name=timeout content=long>
<div id=log></div>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/html/dom/original-harness.js"></script>
<script src="/html/dom/new-harness.js"></script>
<script type="module">
import 'std:elements/toast';
const toastElement = {
'std-toast': {
open: 'boolean',
type: {type: 'enum', keywords: ['success', 'error', 'warning']},
},
};
mergeElements(toastElement);
</script>
<script src="/html/dom/reflection.js" defer></script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment