Update web-platform-tests to revision 44702f2bc8ea98bc32b5b244f2fe63c6ce66d49d

This commit is contained in:
Josh Matthews 2017-11-15 12:15:13 -05:00
parent 85fa6409bb
commit c227604a2c
997 changed files with 45660 additions and 14650 deletions

View file

@ -1,3 +1,4 @@
@snuggs
@alsemenov
@deepak-sa
@domenic

View file

@ -0,0 +1,61 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Custom Elements: CEReactions on HTMLInputElement interface</title>
<link rel="author" title="Intel" href="http://www.intel.com">
<link rel="author" title="Wanming Lin" href="mailto:wanming.lin@intel.com">
<meta name="assert" content="capture of HTMLInputElement interface must have CEReactions">
<meta name="help" content="https://www.w3.org/TR/html-media-capture/#the-capture-attribute">
<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>
test(() => {
const element = define_build_in_custom_element(['capture'], HTMLInputElement, 'input');
const instance = document.createElement('input', { is: element.name });
assert_array_equals(element.takeLog().types(), ['constructed']);
instance['capture'] = 'user';
const logEntries = element.takeLog();
assert_array_equals(logEntries.types(), ['attributeChanged']);
assert_attribute_log_entry(logEntries.last(), {name: 'capture', oldValue: '', newValue: 'user', namespace: null});
}, 'capture on HTMLInputElement must enqueue an attributeChanged reaction when adding new attribute');
test(() => {
const element = define_build_in_custom_element(['capture'], HTMLInputElement, 'input');
const instance = document.createElement('input', { is: element.name });
instance['capture'] = 'user';
assert_array_equals(element.takeLog().types(), ['constructed', 'attributeChanged']);
instance['capture'] = 'environment';
const logEntries = element.takeLog();
assert_array_equals(logEntries.types(), ['attributeChanged']);
assert_attribute_log_entry(logEntries.last(), {name: 'capture', oldValue: 'user', newValue: 'environment', namespace: null});
}, 'capture on HTMLInputElement must enqueue an attributeChanged reaction when replacing an existing attribute');
test(() => {
const element = define_build_in_custom_element(['capture'], HTMLInputElement, 'input');
const instance = document.createElement('input', { is: element.name });
assert_array_equals(element.takeLog().types(), ['constructed']);
instance['capture'] = 'asdf';
const logEntries = element.takeLog();
assert_array_equals(logEntries.types(), ['attributeChanged']);
assert_attribute_log_entry(logEntries.last(), {name: 'capture', oldValue: '', newValue: 'asdf', namespace: null});
}, 'capture on HTMLInputElement must enqueue an attributeChanged reaction when adding invalid value default');
test(() => {
const element = define_build_in_custom_element(['capture'], HTMLInputElement, 'input');
const instance = document.createElement('input', { is: element.name });
instance['capture'] = 'user';
assert_array_equals(element.takeLog().types(), ['constructed', 'attributeChanged']);
instance['capture'] = '';
const logEntries = element.takeLog();
assert_array_equals(logEntries.types(), ['attributeChanged']);
assert_attribute_log_entry(logEntries.last(), {name: 'capture', oldValue: 'user', newValue: '', namespace: null});
}, 'capture on HTMLInputElement must enqueue an attributeChanged reaction when removing the attribute');
</script>
</body>

View file

@ -143,6 +143,38 @@ function define_new_custom_element(observedAttributes) {
}
define_new_custom_element._element_number = 1;
function define_build_in_custom_element(observedAttributes, extendedElement, extendsOption) {
let log = [];
let name = 'custom-element-' + define_build_in_custom_element._element_number++;
class CustomElement extends extendedElement {
constructor() {
super();
log.push({type: 'constructed', element: this});
}
attributeChangedCallback(...args) {
log.push(create_attribute_changed_callback_log(this, ...args));
}
connectedCallback() { log.push({type: 'connected', element: this}); }
disconnectedCallback() { log.push({type: 'disconnected', element: this}); }
adoptedCallback(oldDocument, newDocument) { log.push({type: 'adopted', element: this, oldDocument: oldDocument, newDocument: newDocument}); }
}
CustomElement.observedAttributes = observedAttributes;
customElements.define(name, CustomElement, { extends: extendsOption});
return {
name: name,
class: CustomElement,
takeLog: function () {
let currentLog = log; log = [];
currentLog.types = () => currentLog.map((entry) => entry.type);
currentLog.last = () => currentLog[currentLog.length - 1];
return currentLog;
}
};
}
define_build_in_custom_element._element_number = 1;
function document_types() {
return [
{