mirror of
https://github.com/servo/servo.git
synced 2025-08-13 17:35:36 +01:00
Update web-platform-tests to revision 78f764c05c229883e87ad135c7153051a66e2851
This commit is contained in:
parent
55347aa39f
commit
bf84a079f9
1983 changed files with 58006 additions and 31437 deletions
|
@ -328,7 +328,9 @@ test(function () {
|
|||
});
|
||||
customElements.define('element-with-attribute-changed-callback', proxy);
|
||||
assert_array_equals(prototypeCalls, [1, 'connectedCallback', 2, 'disconnectedCallback', 3, 'adoptedCallback', 4, 'attributeChangedCallback']);
|
||||
assert_array_equals(constructorCalls, [0, 'prototype', 5, 'observedAttributes']);
|
||||
assert_array_equals(constructorCalls, [0, 'prototype',
|
||||
5, 'observedAttributes',
|
||||
6, 'disabledFeatures']);
|
||||
}, 'customElements.define must get "observedAttributes" property on the constructor prototype when "attributeChangedCallback" is present');
|
||||
|
||||
test(function () {
|
||||
|
@ -388,6 +390,53 @@ test(function () {
|
|||
customElements.define('element-without-callback-with-invalid-observed-attributes', constructor);
|
||||
}, 'customElements.define must not throw even if "observedAttributes" fails to convert if "attributeChangedCallback" is not defined');
|
||||
|
||||
test(function () {
|
||||
var constructor = function () {}
|
||||
var calls = [];
|
||||
var proxy = new Proxy(constructor, {
|
||||
get: function (target, name) {
|
||||
calls.push(name);
|
||||
if (name == 'disabledFeatures')
|
||||
throw {name: 'expectedError'};
|
||||
return target[name];
|
||||
}
|
||||
});
|
||||
assert_throws({'name': 'expectedError'}, () => customElements.define('element-with-throwing-disabled-features', proxy));
|
||||
assert_array_equals(calls, ['prototype', 'disabledFeatures'],
|
||||
'customElements.define must get "prototype" and "disabledFeatures" on the constructor');
|
||||
}, 'customElements.define must rethrow an exception thrown while getting disabledFeatures on the constructor prototype');
|
||||
|
||||
test(function () {
|
||||
var constructor = function () {}
|
||||
var calls = [];
|
||||
var proxy = new Proxy(constructor, {
|
||||
get: function (target, name) {
|
||||
calls.push(name);
|
||||
if (name == 'disabledFeatures')
|
||||
return 1;
|
||||
return target[name];
|
||||
}
|
||||
});
|
||||
assert_throws({'name': 'TypeError'}, () => customElements.define('element-with-invalid-disabled-features', proxy));
|
||||
assert_array_equals(calls, ['prototype', 'disabledFeatures'],
|
||||
'customElements.define must get "prototype" and "disabledFeatures" on the constructor');
|
||||
}, 'customElements.define must rethrow an exception thrown while converting the value of disabledFeatures to sequence<DOMString>');
|
||||
|
||||
test(function () {
|
||||
var constructor = function () {}
|
||||
constructor.disabledFeatures = {[Symbol.iterator]: function *() {
|
||||
yield 'foo';
|
||||
throw {name: 'SomeError'};
|
||||
}};
|
||||
assert_throws({'name': 'SomeError'}, () => customElements.define('element-with-generator-disabled-features', constructor));
|
||||
}, 'customElements.define must rethrow an exception thrown while iterating over disabledFeatures to sequence<DOMString>');
|
||||
|
||||
test(function () {
|
||||
var constructor = function () {}
|
||||
constructor.disabledFeatures = {[Symbol.iterator]: 1};
|
||||
assert_throws({'name': 'TypeError'}, () => customElements.define('element-with-disabled-features-with-uncallable-iterator', constructor));
|
||||
}, 'customElements.define must rethrow an exception thrown while retrieving Symbol.iterator on disabledFeatures');
|
||||
|
||||
test(function () {
|
||||
class MyCustomElement extends HTMLElement {};
|
||||
customElements.define('my-custom-element', MyCustomElement);
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Custom Elements: CEReactions on HTMLLIElement interface</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com">
|
||||
<meta name="assert"
|
||||
content="value of HTMLLIElement interface must have CEReactions">
|
||||
<meta name="help" content="https://html.spec.whatwg.org/#the-li-element">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../resources/custom-elements-helpers.js"></script>
|
||||
<script src="./resources/reactions.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
|
||||
function getParentElement(parentElementName) {
|
||||
let parentElement = document.createElement(parentElementName);
|
||||
document.body.appendChild(parentElement);
|
||||
return parentElement;
|
||||
}
|
||||
|
||||
testReflectAttributeWithParentNode(
|
||||
'value', 'value', '3',
|
||||
'5', 'value on HTMLLIElement in ol', 'li',
|
||||
() => getParentElement('ol'), HTMLLIElement
|
||||
);
|
||||
testReflectAttributeWithParentNode(
|
||||
'value', 'value', '3',
|
||||
'5', 'value on HTMLLIElement in ul', 'li',
|
||||
() => getParentElement('ul'), HTMLLIElement
|
||||
);
|
||||
testReflectAttributeWithParentNode(
|
||||
'value', 'value', '3',
|
||||
'5', 'value on HTMLLIElement in menu', 'li',
|
||||
() => getParentElement('menu'), HTMLLIElement
|
||||
);
|
||||
|
||||
</script>
|
||||
</body>
|
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Custom Elements: CEReactions on HTMLLabelElement interface</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com">
|
||||
<meta name="assert"
|
||||
content="htmlFor of HTMLLabelElement interface must have CEReactions">
|
||||
<meta name="help" content="https://html.spec.whatwg.org/#the-label-element">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../resources/custom-elements-helpers.js"></script>
|
||||
<script src="./resources/reactions.js"></script>
|
||||
|
||||
<form id="form">
|
||||
<input type="radio" name="gender" id="male" value="male">
|
||||
<input type="radio" name="gender" id="female" value="female">
|
||||
</form>
|
||||
<script>
|
||||
|
||||
function getParentElement() {
|
||||
let parentElement = document.getElementById("form");
|
||||
return parentElement;
|
||||
}
|
||||
|
||||
testReflectAttributeWithParentNode(
|
||||
'htmlFor', 'for', 'male',
|
||||
'female', 'htmlFor on HTMLLabelElement', 'label',
|
||||
getParentElement, HTMLLabelElement
|
||||
);
|
||||
|
||||
</script>
|
|
@ -0,0 +1,107 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Custom Elements: CEReactions on HTMLMediaElement interface</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com">
|
||||
<meta name="assert" content="src, crossOrigin, preload, autoplay, loop,
|
||||
controls, defaultMuted of HTMLMediaElement interface must have CEReactions">
|
||||
<meta name="help" content="https://html.spec.whatwg.org/#media-elements">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../resources/custom-elements-helpers.js"></script>
|
||||
<script src="./resources/reactions.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
|
||||
function getParentElement() {
|
||||
return document.body;
|
||||
}
|
||||
|
||||
function setAttributes(instance, value) {
|
||||
instance.setAttribute('src', value);
|
||||
}
|
||||
|
||||
testReflectAttribute(
|
||||
'src', 'src', '/media/sound_0.mp3',
|
||||
'/media/sound_5.mp3', 'src on HTMLMediaElement in audio', 'audio',
|
||||
HTMLAudioElement
|
||||
);
|
||||
testReflectAttributeWithDependentAttributes(
|
||||
'crossOrigin', 'crossorigin', 'use-credentials',
|
||||
'anonymous', 'crossOrigin on HTMLMediaElement in audio', 'audio',
|
||||
getParentElement, instance => setAttributes(instance, '/media/sound_5.mp3'),
|
||||
HTMLAudioElement
|
||||
);
|
||||
testReflectAttributeWithDependentAttributes(
|
||||
'preload', 'preload', 'auto',
|
||||
'none', 'preload on HTMLMediaElement in audio', 'audio',
|
||||
getParentElement, instance => setAttributes(instance, '/media/sound_5.mp3'),
|
||||
HTMLAudioElement
|
||||
);
|
||||
testReflectBooleanAttributeWithDependentAttributes(
|
||||
'autoplay', 'autoplay', 'autoplay on HTMLMediaElement in audio',
|
||||
'audio', getParentElement,
|
||||
instance => setAttributes(instance, '/media/sound_5.mp3'),
|
||||
HTMLAudioElement
|
||||
);
|
||||
testReflectBooleanAttributeWithDependentAttributes(
|
||||
'loop', 'loop', 'loop on HTMLMediaElement in audio',
|
||||
'audio', getParentElement,
|
||||
instance => setAttributes(instance, '/media/sound_5.mp3'), HTMLAudioElement
|
||||
);
|
||||
testReflectBooleanAttributeWithDependentAttributes(
|
||||
'controls', 'controls', 'controls on HTMLMediaElement in audio',
|
||||
'audio', getParentElement,
|
||||
instance => setAttributes(instance, '/media/sound_5.mp3'),
|
||||
HTMLAudioElement
|
||||
);
|
||||
testReflectBooleanAttributeWithDependentAttributes(
|
||||
'defaultMuted', 'muted', 'defaultMuted on HTMLMediaElement in audio',
|
||||
'audio', getParentElement,
|
||||
instance => setAttributes(instance, '/media/sound_5.mp3'),
|
||||
HTMLAudioElement
|
||||
);
|
||||
|
||||
testReflectAttribute(
|
||||
'src', 'src', '/media/video.ogv',
|
||||
'/media/movie_5.mp4', 'src on HTMLMediaElement in video', 'video',
|
||||
HTMLVideoElement
|
||||
);
|
||||
testReflectAttributeWithDependentAttributes(
|
||||
'crossOrigin', 'crossorigin', 'use-credentials',
|
||||
'anonymous', 'crossOrigin on HTMLMediaElement in video', 'video',
|
||||
getParentElement, instance => setAttributes(instance, '/media/movie_5.mp4'),
|
||||
HTMLVideoElement
|
||||
);
|
||||
testReflectAttributeWithDependentAttributes(
|
||||
'preload', 'preload', 'auto',
|
||||
'none', 'preload on HTMLMediaElement in video', 'video',
|
||||
getParentElement, instance => setAttributes(instance, '/media/movie_5.mp4'),
|
||||
HTMLVideoElement
|
||||
);
|
||||
testReflectBooleanAttributeWithDependentAttributes(
|
||||
'autoplay', 'autoplay', 'autoplay on HTMLMediaElement in video',
|
||||
'video', getParentElement,
|
||||
instance => setAttributes(instance, '/media/movie_5.mp4'),
|
||||
HTMLVideoElement
|
||||
);
|
||||
testReflectBooleanAttributeWithDependentAttributes(
|
||||
'loop', 'loop', 'loop on HTMLMediaElement in video',
|
||||
'video', getParentElement,
|
||||
instance => setAttributes(instance, '/media/movie_5.mp4'),
|
||||
HTMLVideoElement
|
||||
);
|
||||
testReflectBooleanAttributeWithDependentAttributes(
|
||||
'controls', 'controls', 'controls on HTMLMediaElement in video',
|
||||
'video', getParentElement,
|
||||
instance => setAttributes(instance, '/media/movie_5.mp4'),
|
||||
HTMLVideoElement
|
||||
);
|
||||
testReflectBooleanAttributeWithDependentAttributes(
|
||||
'defaultMuted', 'muted', 'defaultMuted on HTMLMediaElement in video',
|
||||
'video', getParentElement,
|
||||
instance => setAttributes(instance, '/media/movie_5.mp4'),
|
||||
HTMLVideoElement
|
||||
);
|
||||
|
||||
</script>
|
||||
</body>
|
|
@ -0,0 +1,77 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Custom Elements: CEReactions on HTMLMetaElement interface</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com">
|
||||
<meta name="assert" content="name, httpEquiv, content of
|
||||
HTMLMetaElement interface must have CEReactions">
|
||||
<meta name="help" content="https://html.spec.whatwg.org/#the-meta-element">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../resources/custom-elements-helpers.js"></script>
|
||||
<script src="./resources/reactions.js"></script>
|
||||
|
||||
<script>
|
||||
|
||||
function getParentElement() {
|
||||
return document.head;
|
||||
}
|
||||
|
||||
function setAttributes(instance, attribute, value) {
|
||||
instance.setAttribute(attribute, value);
|
||||
}
|
||||
|
||||
testReflectAttributeWithDependentAttributes(
|
||||
'name', 'name', 'description',
|
||||
'keywords', 'name on HTMLMetaElement', 'meta',
|
||||
getParentElement,
|
||||
instance => setAttributes(instance, 'content', 'HTMLMetaElement'),
|
||||
HTMLMetaElement
|
||||
);
|
||||
testReflectAttributeWithDependentAttributes(
|
||||
'content', 'content', 'name1',
|
||||
'name2', 'content on HTMLMetaElement', 'meta',
|
||||
getParentElement, instance => setAttributes(instance, 'name', 'author'),
|
||||
HTMLMetaElement
|
||||
);
|
||||
|
||||
test(() => {
|
||||
let element = define_build_in_custom_element(
|
||||
['http-equiv'], HTMLMetaElement, 'meta'
|
||||
);
|
||||
let instance = document.createElement('meta', { is: element.name });
|
||||
|
||||
assert_array_equals(element.takeLog().types(), ['constructed']);
|
||||
document.head.appendChild(instance);
|
||||
assert_array_equals(element.takeLog().types(), ['connected']);
|
||||
instance['content'] = '300';
|
||||
instance['httpEquiv'] = 'refresh';
|
||||
let logEntries = element.takeLog();
|
||||
assert_array_equals(logEntries.types(), ['attributeChanged']);
|
||||
assert_attribute_log_entry(logEntries.last(), {
|
||||
name: 'http-equiv', oldValue: null, newValue: 'refresh', namespace: null
|
||||
});
|
||||
}, 'httpEquiv on HTMLMetaElement must enqueue an attributeChanged'
|
||||
+ ' reaction when adding a new attribute');
|
||||
|
||||
test(() => {
|
||||
let element = define_build_in_custom_element(
|
||||
['http-equiv'], HTMLMetaElement, 'meta'
|
||||
);
|
||||
let instance = document.createElement('meta', { is: element.name });
|
||||
document.head.appendChild(instance);
|
||||
|
||||
assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
|
||||
instance['content'] = 'text/html; charset=UTF-8';
|
||||
instance['httpEquiv'] = 'content-type';
|
||||
assert_array_equals(element.takeLog().types(), ['attributeChanged']);
|
||||
instance['content'] = '300';
|
||||
instance['httpEquiv'] = 'refresh';
|
||||
let logEntries = element.takeLog();
|
||||
assert_array_equals(logEntries.types(), ['attributeChanged']);
|
||||
assert_attribute_log_entry(logEntries.last(), {
|
||||
name: 'http-equiv', oldValue: 'content-type',
|
||||
newValue: 'refresh', namespace: null
|
||||
});
|
||||
}, 'httpEquiv on HTMLMetaElement must enqueue an attributeChanged'
|
||||
+ ' reaction when replacing an existing attribute');
|
||||
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue