mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Update web-platform-tests to revision 9a4d479ed1347eb9184abc70d628a6da2297657a
This commit is contained in:
parent
b6cc0f60a9
commit
effeb278b6
120 changed files with 3731 additions and 298 deletions
|
@ -2,10 +2,10 @@ import { showToast, StdToastElement } from 'std:elements/toast';
|
|||
|
||||
// helper functions to keep tests from bleeding into each other
|
||||
|
||||
const runTest = (testFn, name, toast) => {
|
||||
const runTest = (testFn, name, toast, action) => {
|
||||
try {
|
||||
test(() => {
|
||||
testFn(toast);
|
||||
testFn(toast, action);
|
||||
}, name);
|
||||
} finally {
|
||||
toast.remove();
|
||||
|
@ -41,6 +41,17 @@ export const testShowToast = (testFn, name) => {
|
|||
runTest(testFn, name, toast);
|
||||
};
|
||||
|
||||
export const testActionToast = (testFn, name) => {
|
||||
const toast = new StdToastElement('Message', {});
|
||||
const action = document.createElement('button');
|
||||
action.setAttribute('slot', 'action');
|
||||
action.textContent = 'action';
|
||||
toast.appendChild(action);
|
||||
document.querySelector('main').appendChild(toast);
|
||||
|
||||
runTest(testFn, name, toast, action);
|
||||
};
|
||||
|
||||
export const assertToastShown = (toast) => {
|
||||
assert_not_equals(window.getComputedStyle(toast).display, 'none');
|
||||
assert_true(toast.hasAttribute('open'));
|
||||
|
@ -59,6 +70,20 @@ export const assertActionButtonOnToast = (action, toast) => {
|
|||
assert_equals(action, toast.querySelector('button'));
|
||||
};
|
||||
|
||||
export const assertComputedStyleMapsEqual = (element1, element2) => {
|
||||
assert_greater_than(element1.computedStyleMap().size, 0);
|
||||
for (const [styleProperty, baseStyleValues] of element1.computedStyleMap()) {
|
||||
const refStyleValues = element2.computedStyleMap().getAll(styleProperty);
|
||||
assert_equals(baseStyleValues.length, refStyleValues.length, `${styleProperty} length`);
|
||||
|
||||
for (let i = 0; i < baseStyleValues.length; ++i) {
|
||||
const baseStyleValue = baseStyleValues[i];
|
||||
const refStyleValue = refStyleValues[i];
|
||||
assert_equals(baseStyleValue.toString(), refStyleValue.toString(), `diff at value ${styleProperty}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class EventCollector {
|
||||
events = [];
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue