Update web-platform-tests to revision abd18b3e018d25ed668d179c905b7869dca5e239

This commit is contained in:
WPT Sync Bot 2018-07-19 21:07:28 -04:00
parent 908a642063
commit 158f7eec0e
117 changed files with 2997 additions and 434 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,2 @@
[floats-in-table-caption-001.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[line-height-204.html]
expected: FAIL

View file

@ -38,6 +38,3 @@
[Test @font-face matching for weight 249] [Test @font-face matching for weight 249]
expected: FAIL expected: FAIL
[Test @font-face matching for weight 420]
expected: FAIL

View file

@ -0,0 +1,2 @@
[css3-text-line-break-opclns-050.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[css3-text-line-break-opclns-054.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[css3-text-line-break-opclns-059.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[css3-text-line-break-opclns-164.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[css3-text-line-break-opclns-165.html]
expected: FAIL

View file

@ -11,6 +11,3 @@
[FE19 PRESENTATION FORM FOR VERTICAL HORIZONTAL ELLIPSIS may NOT appear at line start if zh and strict] [FE19 PRESENTATION FORM FOR VERTICAL HORIZONTAL ELLIPSIS may NOT appear at line start if zh and strict]
expected: FAIL expected: FAIL
[22EF MIDLINE HORIZONTAL ELLIPSIS may NOT appear at line start if zh and strict]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css-transforms-3d-on-anonymous-block-001.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[vh_not_refreshing_on_chrome.html]
expected: FAIL

View file

@ -3,3 +3,6 @@
[CSSStyleDeclaration.setPropertyValue queues a mutation record, even if not mutated] [CSSStyleDeclaration.setPropertyValue queues a mutation record, even if not mutated]
expected: NOTRUN expected: NOTRUN
[CSSStyleDeclaration.setPropertyValue queues a mutation record when serialization is changed]
expected: NOTRUN

View file

@ -0,0 +1,13 @@
[cssstyledeclaration-setter-declarations.html]
[setProperty with longhand should update only the declaration being set]
expected: FAIL
[property setter should update only the declaration being set]
expected: FAIL
[setProperty with shorthand should update only the declarations being set]
expected: FAIL
[longhand property setter should update only the decoarations being set]
expected: FAIL

View file

@ -0,0 +1,4 @@
[cssstyledeclaration-setter-logical.html]
[newly set declaration should be after all declarations in the same logical property group but have different logical kind]
expected: FAIL

View file

@ -1,13 +0,0 @@
[cssstyledeclaration-setter-order.html]
[setProperty with existing longhand should change order]
expected: FAIL
[invoke property setter with existing longhand should change order]
expected: FAIL
[setProperty with existing shorthand should change order]
expected: FAIL
[invoke property setter with existing shorthand should change order]
expected: FAIL

View file

@ -3,9 +3,10 @@
disabled: iframe thread issue 5247 disabled: iframe thread issue 5247
[single-byte-decoder.html?document] [single-byte-decoder.html?document]
expected: TIMEOUT expected: CRASH
[single-byte-decoder.html?XMLHttpRequest] [single-byte-decoder.html?XMLHttpRequest]
expected: CRASH
[ISO-8859-2: iso_8859-2:1987 (XMLHttpRequest)] [ISO-8859-2: iso_8859-2:1987 (XMLHttpRequest)]
expected: FAIL expected: FAIL

View file

@ -1,2 +0,0 @@
[pagehide-on-history-forward.html]
expected: OK

View file

@ -30,6 +30,3 @@
[Set HTTP URL frame location.protocol to data] [Set HTTP URL frame location.protocol to data]
expected: FAIL expected: FAIL
[Set HTTP URL frame location.protocol to x]
expected: FAIL

View file

@ -172,33 +172,63 @@
[XHTML img usemap="http://example.org/#garbage-before-hash-id"] [XHTML img usemap="http://example.org/#garbage-before-hash-id"]
expected: FAIL expected: FAIL
[HTML (standards) IMG usemap="no-hash-name"] [HTML (quirks) IMG usemap="no-hash-name"]
expected: FAIL expected: FAIL
[HTML (standards) IMG usemap="no-hash-id"] [HTML (quirks) IMG usemap="no-hash-id"]
expected: FAIL expected: FAIL
[HTML (standards) IMG usemap="hash-last#"] [HTML (quirks) IMG usemap="hash-last#"]
expected: FAIL expected: FAIL
[HTML (standards) IMG usemap=""] [HTML (quirks) IMG usemap=""]
expected: FAIL expected: FAIL
[HTML (standards) IMG usemap="#"] [HTML (quirks) IMG usemap="#"]
expected: FAIL expected: FAIL
[HTML (standards) IMG usemap="#percent-escape-name-%41"] [HTML (quirks) IMG usemap="#percent-escape-name-%41"]
expected: FAIL expected: FAIL
[HTML (standards) IMG usemap="#percent-escape-id-%41"] [HTML (quirks) IMG usemap="#percent-escape-id-%41"]
expected: FAIL expected: FAIL
[HTML (standards) IMG usemap="#no-such-map"] [HTML (quirks) IMG usemap="#no-such-map"]
expected: FAIL expected: FAIL
[HTML (standards) IMG usemap="#different-CASE-name"] [HTML (quirks) IMG usemap="#different-CASE-name"]
expected: FAIL expected: FAIL
[HTML (standards) IMG usemap="#different-CASE-id"] [HTML (quirks) IMG usemap="#different-CASE-id"]
expected: FAIL
[XHTML img usemap="no-hash-name"]
expected: FAIL
[XHTML img usemap="no-hash-id"]
expected: FAIL
[XHTML img usemap="hash-last#"]
expected: FAIL
[XHTML img usemap=""]
expected: FAIL
[XHTML img usemap="#"]
expected: FAIL
[XHTML img usemap="#percent-escape-name-%41"]
expected: FAIL
[XHTML img usemap="#percent-escape-id-%41"]
expected: FAIL
[XHTML img usemap="#no-such-map"]
expected: FAIL
[XHTML img usemap="#different-CASE-name"]
expected: FAIL
[XHTML img usemap="#different-CASE-id"]
expected: FAIL expected: FAIL

View file

@ -1,4 +0,0 @@
[010.html]
[Salvagability of document.opened document]
expected: FAIL

View file

@ -0,0 +1,5 @@
[context-creation-and-destruction.html]
expected: TIMEOUT
[Overall test]
expected: NOTRUN

View file

@ -0,0 +1,5 @@
[context-creation.html]
expected: TIMEOUT
[Overall test]
expected: NOTRUN

View file

@ -0,0 +1,2 @@
[context-eviction-with-garbage-collection.html]
expected: TIMEOUT

View file

@ -0,0 +1,5 @@
[log_001_to_008.html]
expected: TIMEOUT
[Overall test]
expected: NOTRUN

View file

@ -0,0 +1,5 @@
[log2_001_to_008.html]
expected: TIMEOUT
[Overall test]
expected: NOTRUN

View file

@ -0,0 +1,5 @@
spec: https://wicg.github.io/animation-worklet/
suggested_reviewers:
- flackr
- majido
- stephenmcgruer

View file

@ -0,0 +1,16 @@
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
'use strict';
// https://wicg.github.io/animation-worklet/
promise_test(async () => {
const idl = await (await fetch('/interfaces/animation-worklet.idl')).text();
const html = await (await fetch('/interfaces/html.idl')).text();
const idlArray = new IdlArray();
idlArray.add_idls(idl);
idlArray.add_dependency_idls(html);
idlArray.test();
done();
}, 'Test driver');

View file

@ -0,0 +1,14 @@
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
// https://console.spec.whatwg.org/
promise_test(async () => {
const srcs = ['console'];
const [idl] = await Promise.all(
srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text())));
const idl_array = new IdlArray();
idl_array.add_idls(idl);
idl_array.test();
}, 'console interfaces');

View file

@ -4,10 +4,10 @@
<script src="./support/testharness-helper.sub.js"></script> <script src="./support/testharness-helper.sub.js"></script>
<body></body> <body></body>
<script> <script>
function waitForViolation(el, t, policy, blocked_origin) { function waitForViolation(el, t, policy, blockedURI) {
return new Promise(resolve => { return new Promise(resolve => {
el.addEventListener('securitypolicyviolation', e => { el.addEventListener('securitypolicyviolation', e => {
if (e.originalPolicy == policy && (new URL(e.blockedURI)).origin == blocked_origin) if (e.originalPolicy == policy && e.blockedURI == blockedURI)
resolve(e); resolve(e);
else else
t.unreached_func("Unexpected violation event for " + e.blockedURI)(); t.unreached_func("Unexpected violation event for " + e.blockedURI)();
@ -21,7 +21,7 @@
i.src = redirect.url; i.src = redirect.url;
// Report-only policy should trigger a violation on the redirected request. // Report-only policy should trigger a violation on the redirected request.
waitForViolation(window, t, "img-src https:", (new URL(redirect.target)).origin).then(t.step_func(e => { waitForViolation(window, t, "img-src https:", new URL(redirect.url, window.location).href).then(t.step_func(e => {
t.done(); t.done();
})); }));

View file

@ -40,5 +40,18 @@ async_test(t => {
.catch(t.step_func(e => assert_true(e instanceof TypeError))); .catch(t.step_func(e => assert_true(e instanceof TypeError)));
}, "SecurityPolicyViolation event fired on global."); }, "SecurityPolicyViolation event fired on global.");
async_test(t => {
var url = "{{location[scheme]}}://{{host}}:{{location[port]}}/common/redirect.py?location={{location[scheme]}}://{{domains[www]}}:{{location[port]}}/content-security-policy/support/ping.js";
waitUntilCSPEventForURL(t, url)
.then(t.step_func_done(e => {
assert_equals(e.blockedURI, url);
assert_false(cspEventFiredInDocument);
}));
fetch(url)
.then(t.unreached_func("Fetch should not succeed."))
.catch(t.step_func(e => assert_true(e instanceof TypeError)));
}, "SecurityPolicyViolation event fired on global with the correct blockedURI.");
// Worker tests need an explicit `done()`. // Worker tests need an explicit `done()`.
done(); done();

View file

@ -2,3 +2,4 @@ spec: https://w3c.github.io/core-aam/
suggested_reviewers: suggested_reviewers:
- halindrome - halindrome
- joanmarie - joanmarie
- michael-n-cooper

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<title>A block with 'overflow: hidden' should produce normal baseline</title>
<link rel="author" title="Koji Ishii" href="kojii@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-flexbox/#flex-baselines">
<link rel="match" href="reference/align-items-baseline-overflow-non-visible-ref.html">
<style>
.flex {
display: flex;
align-items: baseline;
}
.overflow {
overflow: hidden;
height: 2em;
}
</style>
<body>
<!--
CSS2 states that:
The baseline of an 'inline-block' is the baseline of its last line box in
the normal flow, unless it has either no in-flow line boxes or if its
'overflow' property has a computed value other than 'visible', in which case
the baseline is the bottom margin edge.
https://drafts.csswg.org/css2/visudet.html#propdef-vertical-align
This rule should apply only to 'inline-block', and not to normal block.
-->
<div class="flex">
<span>XX</span>
<div><div class="overflow">YY</div></div>
</div>
</body>

View file

@ -0,0 +1,14 @@
<!DOCTYPE html>
<style>
.flex {
display: flex;
align-items: baseline;
}
</style>
<body>
<div class="flex">
<span>XX</span>
<div><div>YY</div></div>
</div>
</body>

View file

@ -0,0 +1,323 @@
<!doctype html>
<meta charset=utf-8>
<title>Animating CSS logical properties using Web Animations</title>
<link rel="help" href="https://drafts.csswg.org/css-logical/#box">
<meta name="assert" content="The specified values of these properties are separate from the specified values of the parallel physical properties, but the flow-relative and physical properties share computed values.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../css-animations/support/testcommon.js"></script>
<style>
:root {
--200px: 200px;
--300px: 300px;
--writingMode: horizontal-tb;
}
</style>
<div id="log"></div>
<script>
'use strict';
test(t => {
const div = addDiv(t);
const anim = div.animate({ blockSize: ['0px', '100px'] }, 1000);
anim.currentTime = 500;
assert_equals(getComputedStyle(div).height, '50px');
}, 'Logical properties can be animated using object notation');
test(t => {
const div = addDiv(t);
const anim = div.animate(
[{ blockSize: '0px' }, { blockSize: '100px' }],
1000
);
anim.currentTime = 500;
assert_equals(getComputedStyle(div).height, '50px');
}, 'Logical properties can be animated using array notation');
test(t => {
const anim = addDiv(t).animate({ blockSize: ['0px', '100px'] }, 1000);
assert_equals(anim.effect.getKeyframes().length, 2);
assert_own_property(anim.effect.getKeyframes()[0], 'blockSize');
assert_false(anim.effect.getKeyframes()[0].hasOwnProperty('height'));
assert_own_property(anim.effect.getKeyframes()[1], 'blockSize');
assert_false(anim.effect.getKeyframes()[1].hasOwnProperty('height'));
}, 'Logical properties are NOT stored as physical properties');
test(t => {
const div = addDiv(t, { style: 'writing-mode: vertical-rl' });
const anim = div.animate({ blockSize: ['0px', '100px'] }, 1000);
anim.currentTime = 500;
assert_equals(getComputedStyle(div).width, '50px');
assert_equals(getComputedStyle(div).height, '0px');
}, 'Logical properties in animations respect the writing-mode');
test(t => {
const div = addDiv(t, { style: 'direction: rtl' });
const anim = div.animate({ marginInlineStart: ['0px', '100px'] }, 1000);
anim.currentTime = 500;
assert_equals(getComputedStyle(div).marginLeft, '0px');
assert_equals(getComputedStyle(div).marginRight, '50px');
}, 'Logical properties in animations respect the direction');
test(t => {
const div = addDiv(t);
const anim = div.animate(
{
blockSize: ['0px', '100px'],
height: ['200px', '300px'],
},
1000
);
anim.currentTime = 500;
assert_equals(getComputedStyle(div).height, '250px');
}, 'Physical properties win over logical properties in object notation');
test(t => {
const div = addDiv(t);
const anim = div.animate(
[
{ height: '200px', blockSize: '0px' },
{ height: '300px', blockSize: '100px' },
],
1000
);
anim.currentTime = 500;
assert_equals(getComputedStyle(div).height, '250px');
}, 'Physical properties win over logical properties in array notation');
test(t => {
const div = addDiv(t);
const anim = div.animate(
{
blockSize: ['0px', '100px'],
height: ['var(--200px)', 'var(--300px)'],
},
1000
);
anim.currentTime = 500;
assert_equals(getComputedStyle(div).height, '250px');
}, 'Physical properties with variables win over logical properties');
test(t => {
const div = addDiv(t);
const anim = div.animate(
{
marginInlineStart: '100px',
marginInline: '200px',
margin: 'logical 300px',
},
{ duration: 1, easing: 'step-start' }
);
assert_equals(getComputedStyle(div).marginLeft, '100px');
assert_equals(getComputedStyle(div).marginRight, '200px');
assert_equals(getComputedStyle(div).marginTop, '300px');
assert_equals(getComputedStyle(div).marginBottom, '300px');
}, 'Logical shorthands follow the usual prioritization based on number of'
+ ' component longhands');
test(t => {
const div = addDiv(t);
const anim = div.animate(
{
marginInline: '100px',
marginLeft: '200px',
},
{ duration: 1, easing: 'step-start' }
);
assert_equals(getComputedStyle(div).marginLeft, '200px');
assert_equals(getComputedStyle(div).marginRight, '100px');
}, 'Physical longhands win over logical shorthands');
test(t => {
const div = addDiv(t);
const anim = div.animate(
{
marginInlineStart: '100px',
margin: '200px',
},
{ duration: 1, easing: 'step-start' }
);
assert_equals(getComputedStyle(div).marginLeft, '100px');
assert_equals(getComputedStyle(div).marginRight, '200px');
}, 'Logical longhands win over physical shorthands');
test(t => {
const div = addDiv(t);
const anim = div.animate(
{
marginInline: '100px',
margin: '200px',
},
{ duration: 1, easing: 'step-start' }
);
assert_equals(getComputedStyle(div).marginLeft, '200px');
assert_equals(getComputedStyle(div).marginRight, '200px');
}, 'Physical shorthands win over logical shorthands');
test(t => {
const div = addDiv(t);
const anim = div.animate(
{
marginInline: '100px',
margin: 'var(--200px)',
},
{ duration: 1, easing: 'step-start' }
);
assert_equals(getComputedStyle(div).marginLeft, '200px');
assert_equals(getComputedStyle(div).marginRight, '200px');
}, 'Physical shorthands using variables win over logical shorthands');
test(t => {
const div = addDiv(t);
const anim = div.animate([{ blockSize: '200px' }, { height: '300px' }], 1000);
anim.currentTime = 500;
assert_equals(getComputedStyle(div).height, '250px');
}, 'Physical properties and logical properties can be mixed');
test(t => {
const div = addDiv(t);
const anim = div.animate(
[{ marginInline: '200px' }, { marginRight: '300px' }],
1000
);
anim.currentTime = 500;
assert_equals(getComputedStyle(div).marginRight, '250px');
}, 'Physical shorthands and logical shorthands can be mixed');
test(t => {
const div = addDiv(t);
const anim = div.animate(
[{ blockSize: '100px', height: '200px' }, { height: '300px' }],
1000
);
anim.currentTime = 500;
assert_equals(getComputedStyle(div).height, '250px');
}, 'Physical properties win over logical properties even when some keyframes'
+ ' only have logical properties');
test(t => {
const div = addDiv(t, { style: 'width: 0px; height: 0px' });
const anim = div.animate({ blockSize: ['0px', '100px'] }, 1000);
anim.currentTime = 500;
assert_equals(getComputedStyle(div).width, '0px');
assert_equals(getComputedStyle(div).height, '50px');
div.style.writingMode = 'vertical-rl';
assert_equals(getComputedStyle(div).width, '50px');
assert_equals(getComputedStyle(div).height, '0px');
}, 'Animations update when the writing-mode is changed');
test(t => {
const div = addDiv(t, { style: 'width: 0px; height: 0px' });
const anim = div.animate(
{ blockSize: ['0px', '100px'] },
{
duration: 1000,
fill: 'forwards',
}
);
anim.finish();
assert_equals(getComputedStyle(div).width, '0px');
assert_equals(getComputedStyle(div).height, '100px');
div.style.writingMode = 'vertical-rl';
assert_equals(getComputedStyle(div).width, '100px');
assert_equals(getComputedStyle(div).height, '0px');
}, 'Filling animations update when the writing-mode is changed');
test(t => {
const div = addDiv(t, { style: 'width: 100px; height: 200px' });
const anim = div.animate({ blockSize: '300px' }, 1000);
anim.currentTime = 500;
// Initially we are animating height from 200px -> 300px
assert_equals(getComputedStyle(div).width, '100px');
assert_equals(getComputedStyle(div).height, '250px');
// After the change we are animating width from 100px -> 300px
div.style.writingMode = 'vertical-rl';
assert_equals(getComputedStyle(div).width, '200px');
assert_equals(getComputedStyle(div).height, '200px');
}, 'Animations with implicit from values update when the writing-mode'
+ ' is changed');
test(t => {
const div = addDiv(t, { style: 'width: 0px; height: 0px' });
const anim = div.animate(
[
{ height: '200px', blockSize: '0px' },
{ height: '300px', blockSize: '100px' },
],
1000
);
anim.currentTime = 500;
// Initially writing-mode is horizontal-tb so the 'block-size' values are
// clobbered by the 'height' values.
assert_equals(getComputedStyle(div).width, '0px');
assert_equals(getComputedStyle(div).height, '250px');
// After updating the writing-mode to vertical-rl the 'block-size' values
// should no longer be overridden and should apply to the height.
div.style.writingMode = 'vertical-rl';
assert_equals(getComputedStyle(div).width, '50px');
assert_equals(getComputedStyle(div).height, '250px');
}, 'Animations with overlapping physical and logical properties update'
+ ' when the writing-mode is changed');
test(t => {
const div = addDiv(t, { style: 'width: 0px; height: 0px' });
div.style.writingMode = 'var(--writingMode)';
const anim = div.animate({ blockSize: ['0px', '100px'] }, 1000);
anim.currentTime = 500;
assert_equals(getComputedStyle(div).width, '0px');
assert_equals(getComputedStyle(div).height, '50px');
div.style.setProperty('--writingMode', 'vertical-rl');
assert_equals(getComputedStyle(div).width, '50px');
assert_equals(getComputedStyle(div).height, '0px');
}, 'Animations update when the writing-mode is changed through a CSS variable');
test(t => {
const div = addDiv(t);
const anim = div.animate({ marginInlineStart: ['0px', '100px'] }, 1000);
anim.currentTime = 500;
assert_equals(getComputedStyle(div).marginLeft, '50px');
assert_equals(getComputedStyle(div).marginRight, '0px');
div.style.direction = 'rtl';
assert_equals(getComputedStyle(div).marginLeft, '0px');
assert_equals(getComputedStyle(div).marginRight, '50px');
}, 'Animations update when the direction is changed');
test(t => {
const div = addDiv(t);
const anim = div.animate(
{ writingMode: 'vertical-rl' },
{ duration: 1, easing: 'step-start' }
);
assert_equals(getComputedStyle(div).writingMode, 'horizontal-tb');
assert_equals(anim.effect.getKeyframes().length, 0);
}, 'writing-mode is not animatable');
test(t => {
const div = addDiv(t);
const anim = div.animate(
{ writingMode: 'rtl' },
{ duration: 1, easing: 'step-start' }
);
anim.currentTime = 500;
assert_equals(getComputedStyle(div).direction, 'ltr');
assert_equals(anim.effect.getKeyframes().length, 0);
}, 'direction is not animatable');
</script>

View file

@ -0,0 +1,213 @@
<!doctype html>
<meta charset=utf-8>
<title>Animating CSS logical properties using CSS Animations</title>
<link rel="help" href="https://drafts.csswg.org/css-logical/#box">
<meta name="assert" content="The specified values of these properties are separate from the specified values of the parallel physical properties, but the flow-relative and physical properties share computed values.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../css-animations/support/testcommon.js"></script>
<div id="log"></div>
<script>
'use strict';
test(t => {
addStyle(t, {
'@keyframes anim': 'from { block-size: 0px } to { block-size: 100px }',
});
const div = addDiv(t, { style: 'animation: anim 10s -5s paused linear' });
assert_equals(getComputedStyle(div).height, '50px');
}, 'Logical properties can be animated');
test(t => {
addStyle(t, {
'@keyframes anim': 'from { block-size: 0px } to { block-size: 100px }',
});
const div = addDiv(t, {
style: 'animation: anim 10s -5s paused linear; writing-mode: vertical-rl',
});
assert_equals(getComputedStyle(div).width, '50px');
assert_equals(getComputedStyle(div).height, '0px');
}, 'Logical properties in animations respect the writing-mode');
test(t => {
addStyle(t, {
'@keyframes anim':
'from { margin-inline-start: 0px } to { margin-inline-start: 100px }',
});
const div = addDiv(t, {
style: 'animation: anim 10s -5s paused linear; direction: rtl',
});
assert_equals(getComputedStyle(div).marginLeft, '0px');
assert_equals(getComputedStyle(div).marginRight, '50px');
}, 'Logical properties in animations respect the direction');
test(t => {
addStyle(t, {
'@keyframes anim':
'from { block-size: 0px; height: 200px }'
+ ' to { block-size: 100px; height: 300px }',
});
const div = addDiv(t, {
style: 'animation: anim 10s -5s paused linear',
});
assert_equals(getComputedStyle(div).height, '250px');
}, 'Declaration order is respected within @keyframes declaration blocks');
test(t => {
addStyle(t, {
'@keyframes anim':
'to { margin-top: 200px;'
+ ' margin-block-start: 100px }'
});
const div = addDiv(t, {
style: 'animation: anim 10s paused step-start',
});
assert_equals(getComputedStyle(div).marginTop, '100px');
}, 'Logical properties are able to override physical properties in'
+ ' @keyframes declaration blocks');
test(t => {
addStyle(t, {
'@keyframes anim':
'to {'
+ ' margin-inline: 200px;'
+ ' margin-inline-start: 0px;'
+ ' margin-inline-start: 100px }',
});
const div = addDiv(t, {
style: 'animation: anim 10s paused step-start',
});
assert_equals(getComputedStyle(div).marginLeft, '100px');
}, 'Declaration order is respected amongst logical properties within'
+ ' @keyframes declaration blocks');
test(t => {
addStyle(t, {
'@keyframes anim': 'from { block-size: 200px } to { height: 300px }',
});
const div = addDiv(t, {
style: 'animation: anim 10s -5s paused linear',
});
assert_equals(getComputedStyle(div).height, '250px');
}, 'Physical properties and logical properties can be mixed');
test(t => {
addStyle(t, {
'@keyframes anim':
'from { height: 100px; block-size: 200px }'
+ ' to { block-size: 100px; height: 300px }',
});
const div = addDiv(t, {
style: 'animation: anim 10s -5s paused linear',
});
assert_equals(getComputedStyle(div).height, '250px');
}, 'Declaration order is respected on each keyframe individually');
test(t => {
addStyle(t, {
'@keyframes anim': 'from { block-size: 0px } to { block-size: 100px }',
});
const div = addDiv(t, {
style: 'animation: anim 10s -5s paused linear; width: 0px; height: 0px',
});
assert_equals(getComputedStyle(div).width, '0px');
assert_equals(getComputedStyle(div).height, '50px');
div.style.writingMode = 'vertical-rl';
assert_equals(getComputedStyle(div).width, '50px');
assert_equals(getComputedStyle(div).height, '0px');
}, 'Animations update when the writing-mode is changed');
promise_test(async t => {
addStyle(t, {
'@keyframes anim': 'from { block-size: 0px } to { block-size: 100px }',
});
const div = addDiv(t, {
style: 'animation: anim 10s -9.9s linear forwards;'
+ ' width: 0px; height: 0px',
});
const watcher = new EventWatcher(t, div, [ 'animationend' ]);
await watcher.wait_for('animationend');
assert_equals(getComputedStyle(div).width, '0px');
assert_equals(getComputedStyle(div).height, '100px');
div.style.writingMode = 'vertical-rl';
assert_equals(getComputedStyle(div).width, '100px');
assert_equals(getComputedStyle(div).height, '0px');
}, 'Filling animations update when the writing-mode is changed');
test(t => {
addStyle(t, {
'@keyframes anim': 'to { block-size: 100px; height: 200px }',
});
const div = addDiv(t, {
style: 'animation: anim 10s -5s paused linear; width: 0px; height: 0px',
});
// Initially we are interpolating the height from 0 to 200px
assert_equals(getComputedStyle(div).width, '0px');
assert_equals(getComputedStyle(div).height, '100px');
// But once we change the writing-mode, we will be interpolating *both*
// the height (from 0px to 200px) *and* the width (from 0px to 100px).
div.style.writingMode = 'vertical-rl';
assert_equals(getComputedStyle(div).width, '50px');
assert_equals(getComputedStyle(div).height, '100px');
}, 'The number of interpolating properties can be increased when the'
+ ' writing-mode is changed');
test(t => {
addStyle(t, {
'@keyframes anim': 'to { width: 300px; block-size: 200px }',
});
const div = addDiv(t, {
style: 'animation: anim 10s -5s paused linear; width: 100px; height: 100px',
});
// Initially we are interpolating the width (100px -> 300px) and the height
// (100px -> 200px).
assert_equals(getComputedStyle(div).width, '200px');
assert_equals(getComputedStyle(div).height, '150px');
// Once we change the writing-mode, we will be interpolating *only* the
// width (100px -> 200px).
div.style.writingMode = 'vertical-rl';
assert_equals(getComputedStyle(div).width, '150px');
assert_equals(getComputedStyle(div).height, '100px');
}, 'The number of interpolating properties can be decreased when the'
+ ' writing-mode is changed');
test(t => {
addStyle(t, { ':root': '--writingMode: horizontal-tb' });
addStyle(t, {
'@keyframes anim': 'from { block-size: 0px } to { block-size: 100px }',
});
const div = addDiv(t, {
style:
'animation: anim 10s -5s paused linear;'
+ ' width: 0px; height: 0px;'
+ ' writing-mode: var(--writingMode)'
});
assert_equals(getComputedStyle(div).width, '0px');
assert_equals(getComputedStyle(div).height, '50px');
div.style.setProperty('--writingMode', 'vertical-rl');
assert_equals(getComputedStyle(div).width, '50px');
assert_equals(getComputedStyle(div).height, '0px');
}, 'Animations update when the writing-mode is changed through a CSS variable');
test(t => {
addStyle(t, {
'@keyframes anim':
'from { margin-inline-start: 0px } to { margin-inline-start: 100px }',
});
const div = addDiv(t, { style: 'animation: anim 10s -5s paused linear' });
assert_equals(getComputedStyle(div).marginLeft, '50px');
assert_equals(getComputedStyle(div).marginRight, '0px');
div.style.direction = 'rtl';
assert_equals(getComputedStyle(div).marginLeft, '0px');
assert_equals(getComputedStyle(div).marginRight, '50px');
}, 'Animations update when the direction is changed');
</script>

View file

@ -0,0 +1,37 @@
<!doctype html>
<meta charset=utf-8>
<title>Animating CSS logical properties using CSS Animations - Web Animations reflection</title>
<link rel="help" href="https://drafts.csswg.org/css-logical/#box">
<meta name="assert" content="The specified values of these properties are separate from the specified values of the parallel physical properties, but the flow-relative and physical properties share computed values.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../css-animations/support/testcommon.js"></script>
<div id="log"></div>
<script>
'use strict';
/*
* The mapping from CSS Animations to Web Animations has yet to be specified
* but, when it is, we expect it to require that logical properties in CSS
* keyframes be represented as physical properties in the result returned from
* getKeyframes() since this is consistent with the behavior of expanding out
* all shorthands in to their consituent longhands in order to resolve
* overlapping properties.
*/
test(t => {
addStyle(t, {
'@keyframes anim': 'from { block-size: 0px } to { block-size: 100px }',
});
const div = addDiv(t, { style: 'animation: anim 10s' });
const anim = div.getAnimations()[0];
assert_own_property(anim.effect.getKeyframes()[0], 'height');
assert_false(anim.effect.getKeyframes()[0].hasOwnProperty('blockSize'));
assert_own_property(anim.effect.getKeyframes()[1], 'height');
assert_false(anim.effect.getKeyframes()[1].hasOwnProperty('blockSize'));
}, 'Logical properties are represented as physical properties in keyframes');
</script>

View file

@ -1,2 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<style>
/* Disable kerning because kerning may differ for different node tree. */
html { font-kerning: none; font-feature-settings: "kern" off; }
</style>
<div><span style="opacity:0.5">P</span>ASS</div> <div><span style="opacity:0.5">P</span>ASS</div>

View file

@ -7,6 +7,8 @@
<style> <style>
#one::first-letter { float: left; opacity: 0.5 } #one::first-letter { float: left; opacity: 0.5 }
#two { opacity: 0.5 } #two { opacity: 0.5 }
/* Disable kerning because kerning may differ for different node tree. */
html { font-kerning: none; font-feature-settings: "kern" off; }
</style> </style>
<div id="one">PASS</div> <div id="one">PASS</div>
<div id="two"></div> <div id="two"></div>

View file

@ -1,6 +1,6 @@
<!doctype html> <!doctype html>
<meta charset="utf-8"> <meta charset="utf-8">
<title>CSSOM: CSSStyleDeclaration.setPropertyValue queues a mutation record when not actually mutated</title> <title>CSSOM: CSSStyleDeclaration.setPropertyValue queues a mutation record when changed</title>
<link rel="help" href="https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-setpropertyvalue"> <link rel="help" href="https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-setpropertyvalue">
<link rel="help" href="https://drafts.csswg.org/cssom/#update-style-attribute-for"> <link rel="help" href="https://drafts.csswg.org/cssom/#update-style-attribute-for">
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> <link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
@ -9,12 +9,12 @@
<script> <script>
document.documentElement.style.top = "0px"; document.documentElement.style.top = "0px";
let test = async_test("CSSStyleDeclaration.setPropertyValue queues a mutation record, even if not mutated"); let test = async_test("CSSStyleDeclaration.setPropertyValue queues a mutation record when serialization is changed");
let m = new MutationObserver(function(r) { let m = new MutationObserver(function(r) {
assert_equals(r.length, 1); assert_equals(r.length, 1);
test.done(); test.done();
}); });
m.observe(document.documentElement, { attributes: true }); m.observe(document.documentElement, { attributes: true });
document.documentElement.style.top = "0px"; document.documentElement.style.top = "1px";
</script> </script>

View file

@ -0,0 +1,160 @@
<!DOCTYPE html>
<title>CSSOM test: declaration block after setting via CSSOM</title>
<link rel="help" href="https://drafts.csswg.org/cssom/#set-a-css-declaration-value">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
function generateCSSDeclBlock(props) {
let elem = document.createElement("div");
let cssText = props.map(({name, value, priority}) => {
let longhand = `${name}: ${value}`;
if (priority) {
longhand += "!" + priority;
}
return longhand + ";";
}).join(" ");
elem.setAttribute("style", cssText);
return elem.style;
}
function compareByName(a, b) {
if (a.name < b.name) return -1;
if (a.name > b.name) return 1;
return 0;
}
function checkDeclarationsAnyOrder(block, props, msg) {
let actual = [];
for (let name of block) {
let value = block.getPropertyValue(name);
let priority = block.getPropertyPriority(name);
actual.push({name, value, priority});
}
actual.sort(compareByName);
let expected = Array.from(props);
expected.sort(compareByName);
assert_object_equals(actual, expected, "Declaration block content should match " + msg);
}
function longhand(name, value, priority="") {
return {name, value, priority};
}
function* shorthand(name, value, priority="") {
for (let subprop of SUBPROPS[name]) {
yield longhand(subprop, value, priority);
}
}
const SUBPROPS = {
"margin": ["margin-top", "margin-right", "margin-bottom", "margin-left"],
"padding": ["padding-top", "padding-right", "padding-bottom", "padding-left"],
};
test(function() {
let expectedDecls = [
longhand("top", "1px"),
longhand("bottom", "2px"),
longhand("left", "3px", "important"),
longhand("right", "4px"),
];
let block = generateCSSDeclBlock(expectedDecls);
checkDeclarationsAnyOrder(block, expectedDecls, "in initial block");
block.setProperty("top", "5px", "important");
expectedDecls[0] = longhand("top", "5px", "important");
checkDeclarationsAnyOrder(block, expectedDecls, "after setting existing property");
block.setProperty("bottom", "2px");
checkDeclarationsAnyOrder(block, expectedDecls, "after setting existing property with identical value");
block.setProperty("left", "3px");
expectedDecls[2].priority = "";
checkDeclarationsAnyOrder(block, expectedDecls, "after setting existing property with different priority");
block.setProperty("float", "none");
expectedDecls.push(longhand("float", "none"));
checkDeclarationsAnyOrder(block, expectedDecls, "after setting non-existing property");
}, "setProperty with longhand should update only the declaration being set");
test(function() {
let expectedDecls = [
longhand("top", "1px"),
longhand("bottom", "2px"),
longhand("left", "3px", "important"),
longhand("right", "4px"),
];
let block = generateCSSDeclBlock(expectedDecls);
checkDeclarationsAnyOrder(block, expectedDecls, "in initial block");
block.top = "5px";
expectedDecls[0] = longhand("top", "5px");
checkDeclarationsAnyOrder(block, expectedDecls, "after setting existing property");
block.bottom = "2px";
checkDeclarationsAnyOrder(block, expectedDecls, "after setting existing property with identical value");
block.left = "3px";
expectedDecls[2].priority = "";
checkDeclarationsAnyOrder(block, expectedDecls, "after setting existing property with different priority");
block.float = "none";
expectedDecls.push(longhand("float", "none"));
checkDeclarationsAnyOrder(block, expectedDecls, "after setting non-existing property");
}, "property setter should update only the declaration being set");
test(function() {
let expectedDecls = [
...shorthand("margin", "1px"),
longhand("top", "2px"),
...shorthand("padding", "3px", "important"),
];
let block = generateCSSDeclBlock(expectedDecls);
checkDeclarationsAnyOrder(block, expectedDecls, "in initial block");
block.setProperty("margin", "4px");
for (let i = 0; i < 4; i++) {
expectedDecls[i].value = "4px";
}
checkDeclarationsAnyOrder(block, expectedDecls, "after setting an existing shorthand");
block.setProperty("margin", "4px");
checkDeclarationsAnyOrder(block, expectedDecls, "after setting an existing shorthand with identical value");
block.setProperty("padding", "3px");
for (let i = 5; i < 9; i++) {
expectedDecls[i].priority = "";
}
checkDeclarationsAnyOrder(block, expectedDecls, "after setting an existing shorthand with different priority");
block.setProperty("margin-bottom", "5px", "important");
expectedDecls[2] = longhand("margin-bottom", "5px", "important");
checkDeclarationsAnyOrder(block, expectedDecls, "after setting a longhand in an existing shorthand");
}, "setProperty with shorthand should update only the declarations being set");
test(function() {
let expectedDecls = [
...shorthand("margin", "1px"),
longhand("top", "2px"),
...shorthand("padding", "3px", "important"),
];
let block = generateCSSDeclBlock(expectedDecls);
checkDeclarationsAnyOrder(block, expectedDecls, "in initial block");
block.margin = "4px";
for (let i = 0; i < 4; i++) {
expectedDecls[i].value = "4px";
}
checkDeclarationsAnyOrder(block, expectedDecls, "after setting an existing shorthand");
block.margin = "4px";
checkDeclarationsAnyOrder(block, expectedDecls, "after setting an existing shorthand with identical value");
block.padding = "3px";
for (let i = 5; i < 9; i++) {
expectedDecls[i].priority = "";
}
checkDeclarationsAnyOrder(block, expectedDecls, "after setting an existing shorthand with different priority");
block.marginBottom = "5px";
expectedDecls[2] = longhand("margin-bottom", "5px");
checkDeclarationsAnyOrder(block, expectedDecls, "after setting a longhand in an existing shorthand");
}, "longhand property setter should update only the decoarations being set");
</script>

View file

@ -0,0 +1,73 @@
<!DOCTYPE html>
<title>CSSOM test: declaration block after setting via CSSOM</title>
<link rel="help" href="https://drafts.csswg.org/cssom/#set-a-css-declaration-value">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<div id="test"></div>
<script>
test(function() {
const PHYSICAL_PROPS = ["padding-top", "padding-right",
"padding-bottom", "padding-left"];
const LOGICAL_PROPS = ["padding-block-start", "padding-block-end",
"padding-inline-start", "padding-inline-end"];
let elem = document.getElementById("test");
let decls = new Map;
{
let css = []
let i = 0;
for (let name of [...PHYSICAL_PROPS, ...LOGICAL_PROPS]) {
let value = `${i++}px`;
css.push(`${name}: ${value};`);
decls.set(name, value);
}
elem.setAttribute("style", css.join(" "));
}
let style = elem.style;
function indexOfProperty(prop) {
return Array.prototype.indexOf.apply(style, [prop]);
}
function assertPropAfterProps(prop, props, msg) {
let index = indexOfProperty(prop);
for (let p of props) {
assert_less_than(indexOfProperty(p), index, `${prop} should be after ${p} ${msg}`);
}
}
// We are not changing any value in this test, just order.
function assertValueUnchanged() {
for (let [name, value] of decls.entries()) {
assert_equals(style.getPropertyValue(name), value,
`value of ${name} shouldn't be changed`);
}
}
assertValueUnchanged();
// Check that logical properties are all after physical properties
// at the beginning.
for (let p of LOGICAL_PROPS) {
assertPropAfterProps(p, PHYSICAL_PROPS, "initially");
}
// Try setting a longhand.
style.setProperty("padding-top", "0px");
assertValueUnchanged();
// Check that padding-top is after logical properties, but other
// physical properties are still before logical properties.
assertPropAfterProps("padding-top", LOGICAL_PROPS, "after setting padding-top");
for (let p of LOGICAL_PROPS) {
assertPropAfterProps(p, PHYSICAL_PROPS.filter(prop => prop != "padding-top"),
"after setting padding-top");
}
// Try setting a shorthand.
style.setProperty("padding", "0px 1px 2px 3px");
assertValueUnchanged();
// Check that all physical properties are now after logical properties.
for (let p of PHYSICAL_PROPS) {
assertPropAfterProps(p, LOGICAL_PROPS, "after setting padding shorthand");
}
}, "newly set declaration should be after all declarations " +
"in the same logical property group but have different logical kind");
</script>

View file

@ -1,108 +0,0 @@
<!DOCTYPE html>
<title>CSSOM test: order of declarations after setting via CSSOM</title>
<link rel="help" href="https://drafts.csswg.org/cssom/#set-a-css-declaration-value">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
function generateCSSDeclBlock(props) {
let elem = document.createElement("div");
let cssText = props.map(([prop, value]) => `${prop}: ${value};`).join(" ");
elem.setAttribute("style", cssText);
return elem.style;
}
function checkOrder(block, props, msg) {
assert_array_equals(Array.from(block), props, `Property order should match ${msg}`);
}
function arrayWithItemsAtEnd(array, items) {
let result = array.filter(item => !items.includes(item));
return result.concat(items);
}
const SUBPROPS = {
"margin": ["margin-top", "margin-right", "margin-bottom", "margin-left"],
"padding": ["padding-top", "padding-right", "padding-bottom", "padding-left"],
};
test(function() {
let block = generateCSSDeclBlock([
["top", "1px"],
["bottom", "2px"],
["left", "3px"],
["right", "4px"],
]);
let expectedOrder = ["top", "bottom", "left", "right"];
checkOrder(block, expectedOrder, "in initial block");
block.setProperty("top", "5px");
expectedOrder = arrayWithItemsAtEnd(expectedOrder, ["top"]);
checkOrder(block, expectedOrder, "after setting existing property");
block.setProperty("bottom", "2px");
expectedOrder = arrayWithItemsAtEnd(expectedOrder, ["bottom"]);
checkOrder(block, expectedOrder, "after setting existing property with identical value");
}, "setProperty with existing longhand should change order");
test(function() {
let block = generateCSSDeclBlock([
["top", "1px"],
["bottom", "2px"],
["left", "3px"],
["right", "4px"],
]);
let expectedOrder = ["top", "bottom", "left", "right"];
checkOrder(block, expectedOrder, "in initial block");
block.top = "5px";
expectedOrder = arrayWithItemsAtEnd(expectedOrder, ["top"]);
checkOrder(block, expectedOrder, "after setting existing property");
block.bottom = "2px";
expectedOrder = arrayWithItemsAtEnd(expectedOrder, ["bottom"]);
checkOrder(block, expectedOrder, "after setting existing property with identical value");
}, "invoke property setter with existing longhand should change order");
test(function() {
let block = generateCSSDeclBlock([
["margin", "1px"],
["top", "2px"],
["padding", "3px"],
]);
let expectedOrder = SUBPROPS["margin"].concat(["top"]).concat(SUBPROPS["padding"]);
checkOrder(block, expectedOrder, "in initial block");
block.setProperty("margin", "4px");
expectedOrder = arrayWithItemsAtEnd(expectedOrder, SUBPROPS["margin"]);
checkOrder(block, expectedOrder, "after setting an existing shorthand");
block.setProperty("padding", "3px");
expectedOrder = arrayWithItemsAtEnd(expectedOrder, SUBPROPS["padding"]);
checkOrder(block, expectedOrder, "after setting an existing shorthand with identical value");
block.setProperty("margin-bottom", "5px");
expectedOrder = arrayWithItemsAtEnd(expectedOrder, ["margin-bottom"]);
checkOrder(block, expectedOrder, "after setting a longhand in an existing shorthand");
}, "setProperty with existing shorthand should change order");
test(function() {
let block = generateCSSDeclBlock([
["margin", "1px"],
["top", "2px"],
["padding", "3px"],
]);
let expectedOrder = SUBPROPS["margin"].concat(["top"]).concat(SUBPROPS["padding"]);
checkOrder(block, expectedOrder, "in initial block");
block.margin = "4px";
expectedOrder = arrayWithItemsAtEnd(expectedOrder, SUBPROPS["margin"]);
checkOrder(block, expectedOrder, "after setting an existing shorthand");
block.padding = "3px";
expectedOrder = arrayWithItemsAtEnd(expectedOrder, SUBPROPS["padding"]);
checkOrder(block, expectedOrder, "after setting an existing shorthand with identical value");
block.marginBottom = "5px";
expectedOrder = arrayWithItemsAtEnd(expectedOrder, ["margin-bottom"]);
checkOrder(block, expectedOrder, "after setting a longhand in an existing shorthand");
}, "invoke property setter with existing shorthand should change order");
</script>

View file

@ -0,0 +1,73 @@
<!DOCTYPE html>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0
-->
<html>
<head>
<title>Reference: Testing safe overflow-position for align-content, justify-content, and align-items in flex containers</title>
<link rel="author" title="Mihir Iyer" href="mailto:miyer@mozilla.com">
<meta charset="utf-8">
<style>
.flex {
display: flex;
width: 85px;
height: 65px;
border: 1px solid black;
align-content: flex-end;
justify-content: center;
align-items: center;
float: left;
clear: both;
margin-top: 100px;
}
.rowNoWrap {
flex-flow: row nowrap;
}
.columnNoWrap {
flex-flow: column wrap;
}
.item {
border: 1px solid blue;
background: lightblue;
width: 28px;
height: 28px;
flex-shrink: 0;
}
.bigItem {
border: 1px solid blue;
background: lightblue;
width: 28px;
height: 90px;
flex-shrink: 0;
}
.alignContentStart {
align-content: start;
}
.justifyContentStart {
justify-content: start;
}
.alignSelfStart {
align-self: start;
}
</style>
</head>
<body>
<div class="flex rowNoWrap justifyContentStart">
<div class="item"></div>
<div class="item"></div>
<div class="bigItem alignSelfStart"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
</div>
<div class="flex columnNoWrap alignContentStart">
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
</div>
</body>
</html>

View file

@ -0,0 +1,66 @@
<!DOCTYPE html>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0
-->
<html>
<head>
<title>CSS Test: Testing safe overflow-position for align-content, justify-content, and align-items in flex containers</title>
<link rel="author" title="Mihir Iyer" href="mailto:miyer@mozilla.com">
<link rel="help" href="https://drafts.csswg.org/css-align-3/#overflow-values">
<link rel="match" href="flexbox-safe-overflow-position-001-ref.html">
<meta charset="utf-8">
<style>
.flex {
display: flex;
width: 85px;
height: 65px;
border: 1px solid black;
align-content: safe flex-end;
justify-content: safe center;
align-items: safe center;
float: left;
clear: both;
margin-top: 100px;
}
.rowNoWrap {
flex-flow: row nowrap;
}
.columnNoWrap {
flex-flow: column wrap;
}
.item {
border: 1px solid blue;
background: lightblue;
width: 28px;
height: 28px;
flex-shrink: 0;
}
.bigItem {
border: 1px solid blue;
background: lightblue;
width: 28px;
height: 90px;
flex-shrink: 0;
}
</style>
</head>
<body>
<div class="flex rowNoWrap">
<div class="item"></div>
<div class="item"></div>
<div class="bigItem"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
</div>
<div class="flex columnNoWrap">
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
</div>
</body>
</html>

View file

@ -214,6 +214,9 @@
== flexbox-root-node-001a.html flexbox-root-node-001-ref.html == flexbox-root-node-001a.html flexbox-root-node-001-ref.html
== flexbox-root-node-001b.html flexbox-root-node-001-ref.html == flexbox-root-node-001b.html flexbox-root-node-001-ref.html
# Tests for <overflow-position> "safe" keyword in CSS Alignment properties
== flexbox-safe-overflow-position-001.html flexbox-safe-overflow-position-001-ref.html
# Tests for sizing of flex containers, e.g. under min/max size constraints # Tests for sizing of flex containers, e.g. under min/max size constraints
== flexbox-sizing-horiz-001.xhtml flexbox-sizing-horiz-001-ref.xhtml == flexbox-sizing-horiz-001.xhtml flexbox-sizing-horiz-001-ref.xhtml
== flexbox-sizing-horiz-002.xhtml flexbox-sizing-horiz-002-ref.xhtml == flexbox-sizing-horiz-002.xhtml flexbox-sizing-horiz-002-ref.xhtml

View file

@ -25,4 +25,4 @@ rsync -avz --delete --filter=". ./sync-tests-filter" "$MOZTREE"/layout/reftests/
sed -i -e 's/^\(\(fails\|needs-focus\|random\|skip\|asserts\|slow\|require-or\|silentfail\|pref\|test-pref\|ref-pref\|fuzzy\)[^ ]* *\?\)\+//;/^default-preferences /d;s/ \?# \?\(TC: \)\?[bB]ug.*//;s/ # Initial mulet triage:.*//' $(find . -name reftest.list) sed -i -e 's/^\(\(fails\|needs-focus\|random\|skip\|asserts\|slow\|require-or\|silentfail\|pref\|test-pref\|ref-pref\|fuzzy\)[^ ]* *\?\)\+//;/^default-preferences /d;s/ \?# \?\(TC: \)\?[bB]ug.*//;s/ # Initial mulet triage:.*//' $(find . -name reftest.list)
sed -i -e 's/-moz-crisp-edges/pixelated/g;s/-moz-min-content/min-content/g;s/-moz-max-content/max-content/g' $(find . -regex ".*\.\(xht\|xhtml\|html\|css\)") sed -i -e 's/-moz-crisp-edges/pixelated/g;s/-moz-min-content/min-content/g;s/-moz-max-content/max-content/g' $(find . -regex ".*\.\(xht\|xhtml\|html\|css\)")
git add -A . git add -A .
git commit -m"Sync Mozilla tests as of https://hg.mozilla.org/mozilla-central/rev/$MOZREV ." . git commit -m"Sync Mozilla tests as of https://hg.mozilla.org/mozilla-central/rev/$MOZREV ." -e .

View file

@ -0,0 +1,36 @@
// GENERATED CONTENT - DO NOT EDIT
// Content of this file was automatically extracted from the
// "CSS Animation Worklet API" spec.
// See: https://wicg.github.io/animation-worklet/
partial interface Window {
[SameObject] readonly attribute Worklet animationWorklet;
};
callback VoidFunction = void ();
[ Exposed=AnimationWorklet, Global=AnimationWorklet ]
interface AnimationWorkletGlobalScope : WorkletGlobalScope {
void registerAnimator(DOMString name, VoidFunction animatorCtor);
};
[Constructor (DOMString animatorName,
optional (AnimationEffectReadOnly or sequence)? effects = null,
optional AnimationTimeline? timeline,
optional any options)]
interface WorkletAnimation : Animation {
readonly attribute DOMString animatorName;
};
interface WorkletGroupEffectReadOnly : GroupEffectReadOnly {};
interface WorkletGroupEffect : WorkletGroupEffectReadOnly {};
WorkletGroupEffect implements AnimationEffectMutable;
WorkletGroupEffect implements GroupEffectMutable;
[Exposed=AnimationWorklet]
partial interface AnimationEffectReadOnly {
// Intended for use inside Animation Worklet scope to drive the effect.
attribute double localTime;
};

View file

@ -1,9 +1,13 @@
// GENERATED CONTENT - DO NOT EDIT
// Content of this file was automatically extracted from the
// "Console Standard" spec.
// See: https://console.spec.whatwg.org/
[Exposed=(Window,Worker,Worklet)] [Exposed=(Window,Worker,Worklet)]
namespace console { // but see namespace object requirements below namespace console { // but see namespace object requirements below
// Logging // Logging
void assert(optional boolean condition = false, any... data); void assert(optional boolean condition = false, any... data);
void clear(); void clear();
void count(optional DOMString label = "default");
void debug(any... data); void debug(any... data);
void error(any... data); void error(any... data);
void info(any... data); void info(any... data);
@ -14,6 +18,10 @@ namespace console { // but see namespace object requirements below
void dir(any item, optional object? options); void dir(any item, optional object? options);
void dirxml(any... data); void dirxml(any... data);
// Counting
void count(optional DOMString label = "default");
void countReset(optional DOMString label = "default");
// Grouping // Grouping
void group(any... data); void group(any... data);
void groupCollapsed(any... data); void groupCollapsed(any... data);
@ -21,5 +29,6 @@ namespace console { // but see namespace object requirements below
// Timing // Timing
void time(optional DOMString label = "default"); void time(optional DOMString label = "default");
void timeLog(optional DOMString label = "default", any... data);
void timeEnd(optional DOMString label = "default"); void timeEnd(optional DOMString label = "default");
}; };

View file

@ -0,0 +1,6 @@
// GENERATED CONTENT - DO NOT EDIT
// Content of this file was automatically extracted from the
// "Paint Timing 1" spec.
// See: https://w3c.github.io/paint-timing/
interface PerformancePaintTiming : PerformanceEntry {};

View file

@ -0,0 +1,28 @@
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
'use strict';
// https://w3c.github.io/paint-timing/
idl_test(
['paint-timing'],
['performance-timeline'],
(idl_array, t) => {
idl_array.add_objects({
PerformancePaintTiming: ['paintTiming'],
});
const awaitPaint = new Promise(resolve => {
let observer = new PerformanceObserver(list => {
self.paintTiming = list.getEntries()[0];
resolve();
});
observer.observe({ entryTypes: ['paint'] });
});
const timeout = new Promise((_, reject) => {
t.step_timeout(() => reject('Timed out waiting for paint event'), 3000);
});
return Promise.race([awaitPaint, timeout]);
},
'paint-timing interfaces.');

View file

@ -1,95 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test for PaymentRequest.show() method</title>
<link rel="help" href="https://w3c.github.io/browser-payment-api/#show-method">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
"use strict";
setup({
explicit_done: true,
explicit_timeout: true,
});
const basicCard = Object.freeze({ supportedMethods: "basic-card" });
const defaultMethods = Object.freeze([basicCard]);
const defaultDetails = Object.freeze({
total: {
label: "Total",
amount: {
currency: "USD",
value: "1.00",
},
},
});
test(() => {
try {
new PaymentRequest(defaultMethods, defaultDetails);
} catch (err) {
done();
throw err;
}
}, "Must be possible to construct a payment request");
function manualTest1(button){
button.disabled = true;
promise_test(async t => {
const request = new PaymentRequest(defaultMethods, defaultDetails);
const acceptPromise = request.show(); // Sets state to "interactive"
await promise_rejects(t, "InvalidStateError", request.show());
await request.abort();
await promise_rejects(t, "AbortError", acceptPromise);
}, button.textContent.trim());
}
function manualTest2(button){
button.disabled = true;
promise_test(async t => {
const request1 = new PaymentRequest(defaultMethods, defaultDetails);
const request2 = new PaymentRequest(defaultMethods, defaultDetails);
const acceptPromise1 = request1.show();
const acceptPromise2 = request2.show();
await promise_rejects(t, "AbortError", acceptPromise2);
await request1.abort();
await promise_rejects(t, "AbortError", acceptPromise1);
}, button.textContent.trim());
}
function manualTest3(button){
button.disabled = true;
promise_test(async t => {
const request = new PaymentRequest(
[{ supportedMethods: "this-is-not-supported" }],
defaultDetails);
const acceptPromise = request.show();
await promise_rejects(t, "NotSupportedError", acceptPromise);
}, button.textContent.trim());
done();
}
</script>
<h2>Test for PaymentRequest.show() method</h2>
<p>
Click on each button in sequence from top to bottom without refreshing the page.
</p>
<ol>
<li>
<button onclick="manualTest1(this)">
Throws if the promise [[state]] is not "created"
</button>
</li>
<li>
<button onclick="manualTest2(this)">
If the user agent's "payment request is showing" boolean is true, then return a promise rejected with an "AbortError" DOMException.
</button>
</li>
<li>
<button onclick="manualTest3(this)">
If payment method consultation produces no supported method of payment, then return a promise rejected with a "NotSupportedError" DOMException.
</button>
</li>
</ol>
<small>
If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a>
and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>.
</small>

View file

@ -1,12 +1,15 @@
<!DOCTYPE html> <!DOCTYPE html>
<!-- Copyright © 2017 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang). -->
<meta charset="utf-8"> <meta charset="utf-8">
<title>Test for PaymentRequest.show() method</title> <title>Test for PaymentRequest.show() method</title>
<link rel="help" href="https://w3c.github.io/browser-payment-api/#show-method"> <link rel="help" href="https://w3c.github.io/browser-payment-api/#show-method">
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<button id="button"></button>
<script> <script>
'use strict'; 'use strict';
const button = document.getElementById("button");
const defaultMethods = Object.freeze([ const defaultMethods = Object.freeze([
{ supportedMethods: "basic-card" }, { supportedMethods: "basic-card" },
{ supportedMethods: "https://apple.com/apple-pay" } { supportedMethods: "https://apple.com/apple-pay" }
@ -27,4 +30,40 @@ promise_test(async t => {
const acceptPromise = request.show(); const acceptPromise = request.show();
await promise_rejects(t, "SecurityError", acceptPromise); await promise_rejects(t, "SecurityError", acceptPromise);
}, `Calling show() without being triggered by user interaction throws`); }, `Calling show() without being triggered by user interaction throws`);
promise_test(async t => {
button.onclick = async () => {
const request = new PaymentRequest(defaultMethods, defaultDetails);
const acceptPromise = request.show(); // Sets state to "interactive"
await promise_rejects(t, "InvalidStateError", request.show());
await request.abort();
await promise_rejects(t, "AbortError", acceptPromise);
};
await test_driver.click(button);
}, "Throws if the promise [[state]] is not 'created'.");
promise_test(async t => {
button.onclick = async () => {
const request1 = new PaymentRequest(defaultMethods, defaultDetails);
const request2 = new PaymentRequest(defaultMethods, defaultDetails);
const acceptPromise1 = request1.show();
const acceptPromise2 = request2.show();
await promise_rejects(t, "AbortError", acceptPromise2);
await request1.abort();
await promise_rejects(t, "AbortError", acceptPromise1);
};
await test_driver.click(button);
}, `If the user agent's "payment request is showing" boolean is true, then return a promise rejected with an "AbortError" DOMException.`);
promise_test(async t => {
button.onclick = async () => {
const request = new PaymentRequest(
[{ supportedMethods: "this-is-not-supported" }],
defaultDetails
);
const acceptPromise = request.show();
await promise_rejects(t, "NotSupportedError", acceptPromise);
};
await test_driver.click(button);
}, `If payment method consultation produces no supported method of payment, then return a promise rejected with a "NotSupportedError" DOMException.`);
</script> </script>

View file

@ -11,7 +11,7 @@
async function runManualTest({ completeWith: result }, button) { async function runManualTest({ completeWith: result }, button) {
button.disabled = true; button.disabled = true;
const { response, request } = await getPaymentRequestResponse(); const { response, request } = await getPaymentRequestResponse();
promise_test(async () => { promise_test(async t => {
try { try {
// We .complete() as normal, using the passed test value // We .complete() as normal, using the passed test value
const promise = response.complete(result); const promise = response.complete(result);

View file

@ -3167,27 +3167,32 @@ IdlNamespace.prototype.test = function ()
* as adding objects. Do not call idl_array.test() in the setup; it is * as adding objects. Do not call idl_array.test() in the setup; it is
* called by this function (idl_test). * called by this function (idl_test).
*/ */
function idl_test(srcs, deps, setup_func, test_name) { function idl_test(srcs, deps, idl_setup_func, test_name) {
return promise_test(function (t) { return promise_test(function (t) {
var idl_array = new IdlArray(); var idl_array = new IdlArray();
srcs = (srcs instanceof Array) ? srcs : [srcs] || []; srcs = (srcs instanceof Array) ? srcs : [srcs] || [];
deps = (deps instanceof Array) ? deps : [deps] || []; deps = (deps instanceof Array) ? deps : [deps] || [];
return Promise.all( return Promise.all(
srcs.concat(deps).map(function(i) { srcs.concat(deps).map(function(spec) {
return fetch('/interfaces/' + i + '.idl').then(function(r) { return fetch('/interfaces/' + spec + '.idl').then(function(r) {
return r.text(); return r.text();
}); });
})).then(function(idls) { }))
.then(function(idls) {
for (var i = 0; i < srcs.length; i++) { for (var i = 0; i < srcs.length; i++) {
idl_array.add_idls(idls[i]); idl_array.add_idls(idls[i]);
} }
for (var i = srcs.length; i < srcs.length + deps.length; i++) { for (var i = srcs.length; i < srcs.length + deps.length; i++) {
idl_array.add_dependency_idls(idls[i]); idl_array.add_dependency_idls(idls[i]);
} }
if (setup_func) { })
setup_func(idl_array) .then(function() {
}; return idl_setup_func(idl_array, t);
idl_array.test(); })
.then(function() { idl_array.test(); })
.catch(function (reason) {
idl_array.test(); // Test what we can.
return Promise.reject(reason || 'IDL setup failed.');
}); });
}, test_name); }, test_name);
} }

View file

@ -9,7 +9,7 @@ import unittest
from six.moves.urllib.parse import urlencode, urlunsplit from six.moves.urllib.parse import urlencode, urlunsplit
from six.moves.urllib.request import Request as BaseRequest from six.moves.urllib.request import Request as BaseRequest
from six.moves.urllib.request import urlopen from six.moves.urllib.request import urlopen
from six import iteritems from six import binary_type, iteritems
wptserve = pytest.importorskip("wptserve") wptserve = pytest.importorskip("wptserve")
@ -31,10 +31,16 @@ class Request(BaseRequest):
def add_data(self, data): def add_data(self, data):
if hasattr(data, "items"): if hasattr(data, "items"):
data = urlencode(data) data = urlencode(data).encode("ascii")
print(data)
assert isinstance(data, binary_type)
if hasattr(BaseRequest, "add_data"):
BaseRequest.add_data(self, data)
else:
self.data = data
self.add_header("Content-Length", str(len(data))) self.add_header("Content-Length", str(len(data)))
BaseRequest.add_data(self, data)
class TestUsingServer(unittest.TestCase): class TestUsingServer(unittest.TestCase):

View file

@ -1,4 +1,3 @@
import sys
import unittest import unittest
import uuid import uuid
@ -15,7 +14,6 @@ class TestResponseSetCookie(TestUsingServer):
with StashServer(None, authkey=str(uuid.uuid4())): with StashServer(None, authkey=str(uuid.uuid4())):
super(TestResponseSetCookie, self).run(result) super(TestResponseSetCookie, self).run(result)
@pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2")
def test_put_take(self): def test_put_take(self):
@wptserve.handlers.handler @wptserve.handlers.handler
def handler(request, response): def handler(request, response):
@ -33,13 +31,13 @@ class TestResponseSetCookie(TestUsingServer):
self.server.router.register(*route) self.server.router.register(*route)
resp = self.request(route[1], method="POST", body={"id": id, "data": "Sample data"}) resp = self.request(route[1], method="POST", body={"id": id, "data": "Sample data"})
self.assertEqual(resp.read(), "OK") self.assertEqual(resp.read(), b"OK")
resp = self.request(route[1], query="id=" + id) resp = self.request(route[1], query="id=" + id)
self.assertEqual(resp.read(), "Sample data") self.assertEqual(resp.read(), b"Sample data")
resp = self.request(route[1], query="id=" + id) resp = self.request(route[1], query="id=" + id)
self.assertEqual(resp.read(), "NOT FOUND") self.assertEqual(resp.read(), b"NOT FOUND")
if __name__ == '__main__': if __name__ == '__main__':

View file

@ -0,0 +1,21 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/helper.sub.js"></script>
<body>
<script>
//helper function for the tests
function testHref(str, url) {
var a = document.createElement('a');
a.href = url;
assert_equals(a.href, str);
}
test(t => {
testHref(URLS.safe, TrustedURL.create(URLS.safe));
}, "a.href = URLS.safe, TrustedURL.create");
test(t => {
testHref(URLS.safe, TrustedURL.unsafelyCreate(URLS.safe));
}, "a.href = URLS.safe, TrustedURL.unsafelyCreate");
</script>

View file

@ -0,0 +1,25 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/helper.sub.js"></script>
<body>
<map>
<script>
//helper function for the tests
function testHref(str, url) {
var area = document.createElement('area');
area.href = url;
area.alt = "Area";
assert_equals(area.href, str);
}
test(t => {
testHref(URLS.safe, TrustedURL.create(URLS.safe));
}, "area.href = URLS.safe, TrustedURL.create");
test(t => {
testHref(URLS.safe, TrustedURL.unsafelyCreate(URLS.safe));
}, "area.href = URLS.safe, TrustedURL.unsafelyCreate");
</script>
</map>
</body>

View file

@ -0,0 +1,23 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./support/helper.sub.js"></script>
<body>
<script>
test(t => {
var url = TrustedURL.create(URLS.safe);
var d = document.createElement('iframe');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.create().");
test(t => {
var url = TrustedURL.unsafelyCreate(URLS.safe);
var d = document.createElement('iframe');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.unsafelyCreate().");
</script>

View file

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="./support/helper.js"></script> <script src="./support/helper.sub.js"></script>
<body> <body>
<script> <script>

View file

@ -0,0 +1,21 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/helper.sub.js"></script>
<body>
<script>
//helper function for the tests
function testHref(str, url) {
var link = document.createElement('link');
link.href = url;
assert_equals(link.href, str);
}
test(t => {
testHref(URLS.safe, TrustedURL.create(URLS.safe));
}, "link.href = URLS.safe, TrustedURL.create");
test(t => {
testHref(URLS.safe, TrustedURL.unsafelyCreate(URLS.safe));
}, "link.href = URLS.safe, TrustedURL.unsafelyCreate");
</script>

View file

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="./support/helper.js"></script> <script src="./support/helper.sub.js"></script>
<body> <body>
<script> <script>

View file

@ -0,0 +1,23 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/helper.sub.js"></script>
<body>
<script>
//helper function for the tests
function testData(str, url) {
var objectElement = document.createElement('object');
objectElement.data = url;
objectElement.codeBase = url;
assert_equals(objectElement.data, str);
assert_equals(objectElement.codeBase,str);
}
test(t => {
testData(URLS.safe, TrustedURL.create(URLS.safe));
}, "Basic processing: safe URL, safe construction.");
test(t => {
testData(URLS.safe, TrustedURL.unsafelyCreate(URLS.safe));
}, "Basic processing: safe URL, unsafe construction.");
</script>

View file

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="./support/helper.js"></script> <script src="./support/helper.sub.js"></script>
<body> <body>
<script> <script>
test(t => { test(t => {

View file

@ -0,0 +1,43 @@
<!DOCTYPE html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/helper.sub.js"></script>
<meta http-equiv="Content-Security-Policy" content="require-trusted-types">
</head>
<body>
<script>
//helper function for the tests
function testHref(str, url) {
var a = document.createElement('a');
a.href = url;
assert_equals(a.href, str);
}
//URL assignments do not throw.
test(t => {
testHref(URLS.safe, TrustedURL.create(URLS.safe));
}, "a.href = URLS.safe, TrustedURL.create");
test(t => {
testHref(URLS.safe, TrustedURL.unsafelyCreate(URLS.safe));
}, "a.href = URLS.safe, TrustedURL.unsafelyCreate");
// String assignments throw.
test(t => {
var a = document.createElement('a');
assert_throws(new TypeError(), _ => {
a.href = "A string";
});
}, "`a.href = string` throws");
//Null assignment throws.
test(t => {
var a = document.createElement('a');
assert_throws(new TypeError(), _ => {
a.href = null;
});
}, "`a.href = null` throws");
</script>

View file

@ -0,0 +1,46 @@
<!DOCTYPE html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/helper.sub.js"></script>
<meta http-equiv="Content-Security-Policy" content="require-trusted-types">
</head>
<body>
<map>
<script>
//helper function for the tests
function testHref(str, url) {
var area = document.createElement('area');
area.href = url;
area.alt = "Area";
assert_equals(area.href, str);
}
//URL assignments do not throw.
test(t => {
testHref(URLS.safe, TrustedURL.create(URLS.safe));
}, "area.href = URLS.safe, TrustedURL.create");
test(t => {
testHref(URLS.safe, TrustedURL.unsafelyCreate(URLS.safe));
}, "area.href = URLS.safe, TrustedURL.unsafelyCreate");
// String assignments throw.
test(t => {
var area = document.createElement('area');
assert_throws(new TypeError(), _ => {
area.href = "A string";
});
}, "`area.href = string` throws");
//Null assignment throws.
test(t => {
var area = document.createElement('area');
assert_throws(new TypeError(), _ => {
area.href = null;
});
}, "`area.href = null` throws");
</script>
</map>

View file

@ -0,0 +1,33 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./support/helper.sub.js"></script>
<meta http-equiv="Content-Security-Policy" content="require-trusted-types">
<body>
<script>
//URL assignments don't throw
test(t => {
var url = TrustedURL.create(URLS.safe);
var d = document.createElement('iframe');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.create().");
test(t => {
var url = TrustedURL.unsafelyCreate(URLS.safe);
var d = document.createElement('iframe');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.unsafelyCreate().");
//String assignment throws
test(t => {
var d = document.createElement('iframe');
assert_throws(new TypeError(), _ => {
d.src = "Fail.";
});
}, "'src = string' throws.");
</script>

View file

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="./support/helper.js"></script> <script src="./support/helper.sub.js"></script>
<meta http-equiv="Content-Security-Policy" content="require-trusted-types"> <meta http-equiv="Content-Security-Policy" content="require-trusted-types">
<body> <body>

View file

@ -0,0 +1,43 @@
<!DOCTYPE html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/helper.sub.js"></script>
<meta http-equiv="Content-Security-Policy" content="require-trusted-types">
</head>
<body>
<script>
//helper function for the tests
function testHref(str, url) {
var link = document.createElement('link');
link.href = url;
assert_equals(link.href, str);
}
//URL assignments do not throw.
test(t => {
testHref(URLS.safe, TrustedURL.create(URLS.safe));
}, "link.href = URLS.safe, TrustedURL.create");
test(t => {
testHref(URLS.safe, TrustedURL.unsafelyCreate(URLS.safe));
}, "link.href = URLS.safe, TrustedURL.unsafelyCreate");
// String assignments throw.
test(t => {
var link = document.createElement('link');
assert_throws(new TypeError(), _ => {
link.href = "A string";
});
}, "`link.href = string` throws");
//Null assignment throws.
test(t => {
var link = document.createElement('link');
assert_throws(new TypeError(), _ => {
link.href = null;
});
}, "`link.href = null` throws");
</script>

View file

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="./support/helper.js"></script> <script src="./support/helper.sub.js"></script>
<meta http-equiv="Content-Security-Policy" content="require-trusted-types"> <meta http-equiv="Content-Security-Policy" content="require-trusted-types">
<body> <body>

View file

@ -0,0 +1,60 @@
<!DOCTYPE html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/helper.sub.js"></script>
<meta http-equiv="Content-Security-Policy" content="require-trusted-types">
</head>
<body>
<script>
//helper function for the tests
function testData(str, url) {
var objectElement = document.createElement('object');
objectElement.data = url;
objectElement.codeBase = url;
assert_equals(objectElement.data, str);
assert_equals(objectElement.codeBase, str);
}
//URL assignments do not throw
test(t => {
testData(URLS.safe, TrustedURL.create(URLS.safe));
}, "Basic processing: safe URL, safe construction.");
test(t => {
testData(URLS.safe, TrustedURL.unsafelyCreate(URLS.safe));
}, "Basic processing: safe URL, unsafe construction.");
//String assignments throw
test(t => {
var objectElement = document.createElement('object');
assert_throws(new TypeError(), _ => {
objectElement.data = "A string";
});
}, "`objectElement.data = string` throws");
test(t => {
var objectElement = document.createElement('object');
assert_throws(new TypeError(), _ => {
objectElement.codeBase = "A string";
});
}, "`objectElement.codeBase = string` throws");
//Null assignment throws.
test(t => {
var objectElement = document.createElement('object');
assert_throws(new TypeError(), _ => {
objectElement.data = null;
});
}, "`objectElement.data = null` throws");
//Null assignment throws.
test(t => {
var objectElement = document.createElement('object');
assert_throws(new TypeError(), _ => {
objectElement.codeBase = null;
});
}, "`objectElement.codeBase = null` throws");
</script>

View file

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="./support/helper.js"></script> <script src="./support/helper.sub.js"></script>
<meta http-equiv="Content-Security-Policy" content="require-trusted-types"> <meta http-equiv="Content-Security-Policy" content="require-trusted-types">
<body> <body>

View file

@ -3,7 +3,7 @@
<head> <head>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="./support/helper.js"></script> <script src="./support/helper.sub.js"></script>
<meta http-equiv="Content-Security-Policy" content="require-trusted-types"> <meta http-equiv="Content-Security-Policy" content="require-trusted-types">
</head> </head>

View file

@ -0,0 +1,33 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./support/helper.sub.js"></script>
<meta http-equiv="Content-Security-Policy" content="require-trusted-types">
<body>
<script>
//URL assignments don't throw
test(t => {
var url = TrustedURL.create(URLS.safe);
var d = document.createElement('frame');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.create().");
test(t => {
var url = TrustedURL.unsafelyCreate(URLS.safe);
var d = document.createElement('frame');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.unsafelyCreate().");
//String assignment throws
test(t => {
var d = document.createElement('frame');
assert_throws(new TypeError(), _ => {
d.src = "Fail.";
});
}, "'src = string' throws.");
</script>

View file

@ -0,0 +1,33 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./support/helper.sub.js"></script>
<meta http-equiv="Content-Security-Policy" content="require-trusted-types">
<body>
<script>
//URL assignments don't throw
test(t => {
var url = TrustedURL.create(URLS.safe);
var d = document.createElement('input');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.create().");
test(t => {
var url = TrustedURL.unsafelyCreate(URLS.safe);
var d = document.createElement('input');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.unsafelyCreate().");
//String assignment throws
test(t => {
var d = document.createElement('input');
assert_throws(new TypeError(), _ => {
d.src = "Fail.";
});
}, "'src = string' throws.");
</script>

View file

@ -0,0 +1,33 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./support/helper.sub.js"></script>
<meta http-equiv="Content-Security-Policy" content="require-trusted-types">
<body>
<script>
//URL assignments don't throw
test(t => {
var url = TrustedURL.create(URLS.safe);
var d = document.createElement('track');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.create().");
test(t => {
var url = TrustedURL.unsafelyCreate(URLS.safe);
var d = document.createElement('track');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.unsafelyCreate().");
//String assignment throws
test(t => {
var d = document.createElement('track');
assert_throws(new TypeError(), _ => {
d.src = "Fail.";
});
}, "'src = string' throws.");
</script>

View file

@ -0,0 +1,68 @@
<!DOCTYPE html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/helper.sub.js"></script>
<meta http-equiv="Content-Security-Policy" content="require-trusted-types">
</head>
<body>
<script>
//helper functions for the tests
function testWindowOpen(t, url, win) {
let child_window = win.open(url, "", "");
child_window.onload = t.step_func_done(_ => {
assert_equals(child_window.location.href, "" + url);
child_window.close();
});
}
function testWindowThrows(t, url, win) {
let child_window = win.open(TrustedURL.create(URLS.safe), "", "");
child_window.onload = t.step_func_done(_ => {
assert_throws(new TypeError(), _ => {
child_window = win.open(url, "", "");
child_window.close();
});
});
}
//TrustedURL assignments do not throw
async_test(t => {
testWindowOpen(t, TrustedURL.create(URLS.safe), window);
}, "window.open: safe URL, safe construction.");
async_test(t => {
testWindowOpen(t, TrustedURL.unsafelyCreate(URLS.safe), window);
}, "window.open: safe URL, unsafe construction.");
async_test(t => {
testWindowOpen(t, TrustedURL.create(URLS.safe), document);
}, "document.open: safe URL, safe construction.");
async_test(t => {
testWindowOpen(t, TrustedURL.unsafelyCreate(URLS.safe), document);
}, "document.open: safe URL, unsafe construction.");
//String assignments throw
async_test(t => {
testWindowThrows(t, 'A string', window);
}, "`window.open(string)` throws.");
async_test(t => {
testWindowThrows(t, 'A string', document);
}, "`document.open(string)` throws.");
//Null assignment throws
async_test(t => {
testWindowThrows(t, null, window);
}, "`window.open(null)` throws.");
//Null assignment throws
async_test(t => {
testWindowThrows(t, null, document);
}, "`document.open(null)` throws.");
</script>
</body>
</html>

View file

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="./support/helper.js"></script> <script src="./support/helper.sub.js"></script>
<body> <body>
<script> <script>
test(t => { test(t => {

View file

@ -0,0 +1,23 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./support/helper.sub.js"></script>
<body>
<script>
test(t => {
var url = TrustedURL.create(URLS.safe);
var d = document.createElement('frame');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.create().");
test(t => {
var url = TrustedURL.unsafelyCreate(URLS.safe);
var d = document.createElement('frame');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.unsafelyCreate().");
</script>

View file

@ -0,0 +1,23 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./support/helper.sub.js"></script>
<body>
<script>
test(t => {
var url = TrustedURL.create(URLS.safe);
var d = document.createElement('input');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.create().");
test(t => {
var url = TrustedURL.unsafelyCreate(URLS.safe);
var d = document.createElement('input');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.unsafelyCreate().");
</script>

View file

@ -0,0 +1,23 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./support/helper.sub.js"></script>
<body>
<script>
test(t => {
var url = TrustedURL.create(URLS.safe);
var d = document.createElement('track');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.create().");
test(t => {
var url = TrustedURL.unsafelyCreate(URLS.safe);
var d = document.createElement('track');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.unsafelyCreate().");
</script>

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/helper.sub.js"></script>
<body>
<script>
//helper functions for the tests
function testWindowOpen(t, url, win) {
let child_window = win.open(url, "", "");
child_window.onload = t.step_func_done(_ => {
assert_equals(child_window.location.href, "" + url);
child_window.close();
});
}
async_test(t => {
testWindowOpen(t, TrustedURL.create(URLS.safe), window);
}, "window.open: safe URL, safe construction.");
async_test(t => {
testWindowOpen(t, TrustedURL.unsafelyCreate(URLS.safe), window);
}, "window.open: safe URL, unsafe construction.");
async_test(t => {
testWindowOpen(t, TrustedURL.create(URLS.safe), document);
}, "document.open: safe URL, safe construction.");
async_test(t => {
testWindowOpen(t, TrustedURL.unsafelyCreate(URLS.safe), document);
}, "document.open: safe URL, unsafe construction.");
</script>

View file

@ -2,3 +2,4 @@ spec: https://w3c.github.io/aria/
suggested_reviewers: suggested_reviewers:
- halindrome - halindrome
- joanmarie - joanmarie
- michael-n-cooper

View file

@ -0,0 +1,78 @@
<!doctype html>
<html>
<head>
<title>aria-expanded=false on a menuitem</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
<link rel="stylesheet" href="/wai-aria/scripts/manual.css">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/wai-aria/scripts/ATTAcomm.js"></script>
<script>
setup({explicit_timeout: true, explicit_done: true });
var theTest = new ATTAcomm(
{
"steps" : [
{
"element" : "test",
"test" : {
"ATK" : [
[
"property",
"states",
"contains",
"STATE_EXPANDABLE"
],
[
"property",
"states",
"doesNotContain",
"STATE_EXPANDED"
]
],
"AXAPI" : [
[
"property",
"AXExpanded",
"is",
"NO"
]
],
"MSAA" : [
[
"property",
"states",
"contains",
"STATE_SYSTEM_COLLAPSED"
]
],
"UIA" : [
[
"property",
"ExpandCollapse.ExpandCollapseState",
"is",
"Collapsed"
]
]
},
"title" : "step 1",
"type" : "test"
}
],
"title" : "aria-expanded=false"
}
) ;
</script>
</head>
<body>
<p>This test examines the ARIA properties for aria-expanded=false on a menuitem.</p>
<div role='menu'>
<div role='menuitem' id='test' aria-expanded='false'>item 1</div>
<div role='menuitem'>item 2</div>
</div>
<div id="manualMode"></div>
<div id="log"></div>
<div id="ATTAmessages"></div>
</body>
</html>

View file

@ -0,0 +1,82 @@
<!doctype html>
<html>
<head>
<title>aria-expanded=true on a menuitem</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
<link rel="stylesheet" href="/wai-aria/scripts/manual.css">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/wai-aria/scripts/ATTAcomm.js"></script>
<script>
setup({explicit_timeout: true, explicit_done: true });
var theTest = new ATTAcomm(
{
"steps" : [
{
"element" : "test",
"test" : {
"ATK" : [
[
"property",
"states",
"contains",
"STATE_EXPANDABLE"
],
[
"property",
"states",
"contains",
"STATE_EXPANDED"
]
],
"AXAPI" : [
[
"property",
"AXExpanded",
"is",
"YES"
]
],
"MSAA" : [
[
"property",
"states",
"contains",
"STATE_SYSTEM_EXPANDED"
]
],
"UIA" : [
[
"property",
"ExpandCollapse.ExpandCollapseState",
"is",
"Expanded"
]
]
},
"title" : "step 1",
"type" : "test"
}
],
"title" : "aria-expanded=true"
}
) ;
</script>
</head>
<body>
<p>This test examines the ARIA properties for aria-expanded=true on a menuitem.</p>
<div role='menu'>
<div role='menuitem' id='test' aria-expanded='true'>item 1</div>
<div role='menu'>
<div role='menuitem'>subitem 1</div>
<div role='menuitem'>subitem 2</div>
</div>
<div role='menuitem'>item 2</div>
</div>
<div id="manualMode"></div>
<div id="log"></div>
<div id="ATTAmessages"></div>
</body>
</html>

View file

@ -0,0 +1,78 @@
<!doctype html>
<html>
<head>
<title>aria-expanded=false on a menuitemcheckbox</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
<link rel="stylesheet" href="/wai-aria/scripts/manual.css">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/wai-aria/scripts/ATTAcomm.js"></script>
<script>
setup({explicit_timeout: true, explicit_done: true });
var theTest = new ATTAcomm(
{
"steps" : [
{
"element" : "test",
"test" : {
"ATK" : [
[
"property",
"states",
"contains",
"STATE_EXPANDABLE"
],
[
"property",
"states",
"doesNotContain",
"STATE_EXPANDED"
]
],
"AXAPI" : [
[
"property",
"AXExpanded",
"is",
"NO"
]
],
"MSAA" : [
[
"property",
"states",
"contains",
"STATE_SYSTEM_COLLAPSED"
]
],
"UIA" : [
[
"property",
"ExpandCollapse.ExpandCollapseState",
"is",
"Collapsed"
]
]
},
"title" : "step 1",
"type" : "test"
}
],
"title" : "aria-expanded=false"
}
) ;
</script>
</head>
<body>
<p>This test examines the ARIA properties for aria-expanded=false on a menuitemcheckbox.</p>
<div role='menu'>
<div role='menuitemcheckbox' id='test' aria-expanded='false'>item 1</div>
<div role='menuitem'>item 2</div>
</div>
<div id="manualMode"></div>
<div id="log"></div>
<div id="ATTAmessages"></div>
</body>
</html>

View file

@ -0,0 +1,82 @@
<!doctype html>
<html>
<head>
<title>aria-expanded=true on a menuitemcheckbox</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
<link rel="stylesheet" href="/wai-aria/scripts/manual.css">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/wai-aria/scripts/ATTAcomm.js"></script>
<script>
setup({explicit_timeout: true, explicit_done: true });
var theTest = new ATTAcomm(
{
"steps" : [
{
"element" : "test",
"test" : {
"ATK" : [
[
"property",
"states",
"contains",
"STATE_EXPANDABLE"
],
[
"property",
"states",
"contains",
"STATE_EXPANDED"
]
],
"AXAPI" : [
[
"property",
"AXExpanded",
"is",
"YES"
]
],
"MSAA" : [
[
"property",
"states",
"contains",
"STATE_SYSTEM_EXPANDED"
]
],
"UIA" : [
[
"property",
"ExpandCollapse.ExpandCollapseState",
"is",
"Expanded"
]
]
},
"title" : "step 1",
"type" : "test"
}
],
"title" : "aria-expanded=true"
}
) ;
</script>
</head>
<body>
<p>This test examines the ARIA properties for aria-expanded=true on a menuitemcheckbox.</p>
<div role='menu'>
<div role='menuitemcheckbox' id='test' aria-expanded='true'>item 1</div>
<div role='menu'>
<div role='menuitem'>subitem 1</div>
<div role='menuitem'>subitem 2</div>
</div>
<div role='menuitem'>item 2</div>
</div>
<div id="manualMode"></div>
<div id="log"></div>
<div id="ATTAmessages"></div>
</body>
</html>

View file

@ -0,0 +1,78 @@
<!doctype html>
<html>
<head>
<title>aria-expanded=false on a menuitemradio</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
<link rel="stylesheet" href="/wai-aria/scripts/manual.css">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/wai-aria/scripts/ATTAcomm.js"></script>
<script>
setup({explicit_timeout: true, explicit_done: true });
var theTest = new ATTAcomm(
{
"steps" : [
{
"element" : "test",
"test" : {
"ATK" : [
[
"property",
"states",
"contains",
"STATE_EXPANDABLE"
],
[
"property",
"states",
"doesNotContain",
"STATE_EXPANDED"
]
],
"AXAPI" : [
[
"property",
"AXExpanded",
"is",
"NO"
]
],
"MSAA" : [
[
"property",
"states",
"contains",
"STATE_SYSTEM_COLLAPSED"
]
],
"UIA" : [
[
"property",
"ExpandCollapse.ExpandCollapseState",
"is",
"Collapsed"
]
]
},
"title" : "step 1",
"type" : "test"
}
],
"title" : "aria-expanded=false"
}
) ;
</script>
</head>
<body>
<p>This test examines the ARIA properties for aria-expanded=false on a menuitemradio.</p>
<div role='menu'>
<div role='menuitemradio' id='test' aria-expanded='false'>item 1</div>
<div role='menuitem'>item 2</div>
</div>
<div id="manualMode"></div>
<div id="log"></div>
<div id="ATTAmessages"></div>
</body>
</html>

View file

@ -0,0 +1,82 @@
<!doctype html>
<html>
<head>
<title>aria-expanded=true on a menuitemradio</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
<link rel="stylesheet" href="/wai-aria/scripts/manual.css">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/wai-aria/scripts/ATTAcomm.js"></script>
<script>
setup({explicit_timeout: true, explicit_done: true });
var theTest = new ATTAcomm(
{
"steps" : [
{
"element" : "test",
"test" : {
"ATK" : [
[
"property",
"states",
"contains",
"STATE_EXPANDABLE"
],
[
"property",
"states",
"contains",
"STATE_EXPANDED"
]
],
"AXAPI" : [
[
"property",
"AXExpanded",
"is",
"YES"
]
],
"MSAA" : [
[
"property",
"states",
"contains",
"STATE_SYSTEM_EXPANDED"
]
],
"UIA" : [
[
"property",
"ExpandCollapse.ExpandCollapseState",
"is",
"Expanded"
]
]
},
"title" : "step 1",
"type" : "test"
}
],
"title" : "aria-expanded=true"
}
) ;
</script>
</head>
<body>
<p>This test examines the ARIA properties for aria-expanded=true on a menuitemradio.</p>
<div role='menu'>
<div role='menuitemradio' id='test' aria-expanded='true'>item 1</div>
<div role='menu'>
<div role='menuitem'>subitem 1</div>
<div role='menuitem'>subitem 2</div>
</div>
<div role='menuitem'>item 2</div>
</div>
<div id="manualMode"></div>
<div id="log"></div>
<div id="ATTAmessages"></div>
</body>
</html>

View file

@ -40,7 +40,7 @@ function testAudioNodeOptions(should, context, nodeName, expectedNodeOptions) {
{channelCount: testChannelCount})); {channelCount: testChannelCount}));
}, },
'new ' + nodeName + '(c, {channelCount: ' + testChannelCount + '}}') 'new ' + nodeName + '(c, {channelCount: ' + testChannelCount + '}}')
.throw(expectedNodeOptions.channelCount.errorType || 'TypeError'); .throw(expectedNodeOptions.channelCount.errorType || TypeError);
} else { } else {
// The channel count is not fixed. Try to set the count to invalid // The channel count is not fixed. Try to set the count to invalid
// values and make sure an error is thrown. // values and make sure an error is thrown.
@ -119,7 +119,7 @@ function testAudioNodeOptions(should, context, nodeName, expectedNodeOptions) {
{channelCountMode: 'foobar'})); {channelCountMode: 'foobar'}));
}, },
'new ' + nodeName + '(c, {channelCountMode: "foobar"}') 'new ' + nodeName + '(c, {channelCountMode: "foobar"}')
.throw('TypeError'); .throw(TypeError);
should(node.channelCountMode, 'node.channelCountMode after invalid setter') should(node.channelCountMode, 'node.channelCountMode after invalid setter')
.beEqualTo(testValues[testValues.length - 1]); .beEqualTo(testValues[testValues.length - 1]);
} }
@ -181,7 +181,7 @@ function testAudioNodeOptions(should, context, nodeName, expectedNodeOptions) {
{channelInterpretation: 'foobar'})); {channelInterpretation: 'foobar'}));
}, },
'new ' + nodeName + '(c, {channelInterpretation: "foobar"})') 'new ' + nodeName + '(c, {channelInterpretation: "foobar"})')
.throw('TypeError'); .throw(TypeError);
should( should(
node.channelInterpretation, node.channelInterpretation,
'node.channelInterpretation after invalid setter') 'node.channelInterpretation after invalid setter')
@ -201,13 +201,13 @@ function initializeContext(should) {
function testInvalidConstructor(should, name, context) { function testInvalidConstructor(should, name, context) {
should(() => { should(() => {
new window[name](); new window[name]();
}, 'new ' + name + '()').throw('TypeError'); }, 'new ' + name + '()').throw(TypeError);
should(() => { should(() => {
new window[name](1); new window[name](1);
}, 'new ' + name + '(1)').throw('TypeError'); }, 'new ' + name + '(1)').throw(TypeError);
should(() => { should(() => {
new window[name](context, 42); new window[name](context, 42);
}, 'new ' + name + '(context, 42)').throw('TypeError'); }, 'new ' + name + '(context, 42)').throw(TypeError);
} }
function testDefaultConstructor(should, name, context, options) { function testDefaultConstructor(should, name, context, options) {

View file

@ -81,6 +81,13 @@ window.Audit = (function() {
targetString = '' + String(target).split(/[\s\]]/)[1]; targetString = '' + String(target).split(/[\s\]]/)[1];
} }
break; break;
case 'function':
if (Error.isPrototypeOf(target)) {
targetString = "EcmaScript error " + target.name;
} else {
targetString = String(target);
}
break;
default: default:
targetString = String(target); targetString = String(target);
break; break;
@ -267,7 +274,10 @@ window.Audit = (function() {
/** /**
* Check if |actual| operation wrapped in a function throws an exception * Check if |actual| operation wrapped in a function throws an exception
* with a expected error type correctly. |expected| is optional. * with a expected error type correctly. |expected| is optional. If it is a
* String, then it is considered to be the name of a DOMException. It can
* also be an instance of either an Error or a DOMException, to be more
* strict about the actual error type.
* *
* @example * @example
* should(() => { let a = b; }, 'A bad code').throw(); * should(() => { let a = b; }, 'A bad code').throw();
@ -303,8 +313,15 @@ window.Audit = (function() {
// The expected error type was not given. // The expected error type was not given.
didThrowCorrectly = true; didThrowCorrectly = true;
passDetail = '${actual} threw ' + error.name + errorMessage + '.'; passDetail = '${actual} threw ' + error.name + errorMessage + '.';
} else if (error.name === this._expected) { } else if (typeof(this._expected) == "string" &&
// The expected error type match the actual one. error instanceof DOMException &&
error.name === this._expected) {
// A DOMException was thrown and expected, and the names match
didThrowCorrectly = true;
passDetail = '${actual} threw ${expected}' + errorMessage + '.';
} else if (this._expected == error.constructor &&
this._expected.name == error.name) {
// The expected error type and names match the actual one.
didThrowCorrectly = true; didThrowCorrectly = true;
passDetail = '${actual} threw ${expected}' + errorMessage + '.'; passDetail = '${actual} threw ${expected}' + errorMessage + '.';
} else { } else {

View file

@ -8,7 +8,7 @@ function testStartStop(should, node, options) {
should(() => { should(() => {
node.start(time); node.start(time);
}, `start(${time})`) }, `start(${time})`)
.throw('TypeError'); .throw(TypeError);
}); });
should(() => { should(() => {
@ -17,7 +17,7 @@ function testStartStop(should, node, options) {
should(() => { should(() => {
node.start(-1); node.start(-1);
}, 'start(-1)').throw('RangeError'); }, 'start(-1)').throw(RangeError);
if (options) { if (options) {
options.forEach(test => { options.forEach(test => {
@ -32,14 +32,14 @@ function testStartStop(should, node, options) {
}, 'Calling start() twice').throw('InvalidStateError'); }, 'Calling start() twice').throw('InvalidStateError');
should(() => { should(() => {
node.stop(-1); node.stop(-1);
}, 'stop(-1)').throw('RangeError'); }, 'stop(-1)').throw(RangeError);
// Test non-finite stop times // Test non-finite stop times
nonFiniteValues.forEach(time => { nonFiniteValues.forEach(time => {
should(() => { should(() => {
node.stop(time); node.stop(time);
}, `stop(${time})`) }, `stop(${time})`)
.throw('TypeError'); .throw(TypeError);
}); });
} }

View file

@ -121,10 +121,10 @@
.notThrow(); .notThrow();
should(() => { should(() => {
buffer.copyFromChannel(null, 0); buffer.copyFromChannel(null, 0);
}, '1: buffer.copyFromChannel(null, 0)').throw('TypeError'); }, '1: buffer.copyFromChannel(null, 0)').throw(TypeError);
should(() => { should(() => {
buffer.copyFromChannel(context, 0); buffer.copyFromChannel(context, 0);
}, '2: buffer.copyFromChannel(context, 0)').throw('TypeError'); }, '2: buffer.copyFromChannel(context, 0)').throw(TypeError);
should(() => { should(() => {
buffer.copyFromChannel(x, -1); buffer.copyFromChannel(x, -1);
}, '3: buffer.copyFromChannel(x, -1)').throw('IndexSizeError'); }, '3: buffer.copyFromChannel(x, -1)').throw('IndexSizeError');
@ -156,14 +156,14 @@
buffer.copyFromChannel(shared_buffer, 0); buffer.copyFromChannel(shared_buffer, 0);
}, },
'8: buffer.copyFromChannel(SharedArrayBuffer view, 0)') '8: buffer.copyFromChannel(SharedArrayBuffer view, 0)')
.throw('TypeError'); .throw(TypeError);
should( should(
() => { () => {
buffer.copyFromChannel(shared_buffer, 0, 0); buffer.copyFromChannel(shared_buffer, 0, 0);
}, },
'9: buffer.copyFromChannel(SharedArrayBuffer view, 0, 0)') '9: buffer.copyFromChannel(SharedArrayBuffer view, 0, 0)')
.throw('TypeError'); .throw(TypeError);
} }
task.done(); task.done();
@ -177,10 +177,10 @@
.exist(); .exist();
should(() => { should(() => {
buffer.copyToChannel(null, 0); buffer.copyToChannel(null, 0);
}, '0: buffer.copyToChannel(null, 0)').throw('TypeError'); }, '0: buffer.copyToChannel(null, 0)').throw(TypeError);
should(() => { should(() => {
buffer.copyToChannel(context, 0); buffer.copyToChannel(context, 0);
}, '1: buffer.copyToChannel(context, 0)').throw('TypeError'); }, '1: buffer.copyToChannel(context, 0)').throw(TypeError);
should(() => { should(() => {
buffer.copyToChannel(x, -1); buffer.copyToChannel(x, -1);
}, '2: buffer.copyToChannel(x, -1)').throw('IndexSizeError'); }, '2: buffer.copyToChannel(x, -1)').throw('IndexSizeError');
@ -211,14 +211,14 @@
buffer.copyToChannel(shared_buffer, 0); buffer.copyToChannel(shared_buffer, 0);
}, },
'7: buffer.copyToChannel(SharedArrayBuffer view, 0)') '7: buffer.copyToChannel(SharedArrayBuffer view, 0)')
.throw('TypeError'); .throw(TypeError);
should( should(
() => { () => {
buffer.copyToChannel(shared_buffer, 0, 0); buffer.copyToChannel(shared_buffer, 0, 0);
}, },
'8: buffer.copyToChannel(SharedArrayBuffer view, 0, 0)') '8: buffer.copyToChannel(SharedArrayBuffer view, 0, 0)')
.throw('TypeError'); .throw(TypeError);
} }
task.done(); task.done();

View file

@ -24,13 +24,13 @@
audit.define('invalid constructor', (task, should) => { audit.define('invalid constructor', (task, should) => {
should(() => { should(() => {
new AudioBuffer(); new AudioBuffer();
}, 'new AudioBuffer()').throw('TypeError'); }, 'new AudioBuffer()').throw(TypeError);
should(() => { should(() => {
new AudioBuffer(1); new AudioBuffer(1);
}, 'new AudioBuffer(1)').throw('TypeError'); }, 'new AudioBuffer(1)').throw(TypeError);
should(() => { should(() => {
new AudioBuffer(Date, 42); new AudioBuffer(Date, 42);
}, 'new AudioBuffer(Date, 42)').throw('TypeError'); }, 'new AudioBuffer(Date, 42)').throw(TypeError);
task.done(); task.done();
}); });
@ -42,19 +42,19 @@
// optional. // optional.
should(() => { should(() => {
new AudioBuffer({}); new AudioBuffer({});
}, 'buffer = new AudioBuffer({})').throw('TypeError'); }, 'buffer = new AudioBuffer({})').throw(TypeError);
should(() => { should(() => {
new AudioBuffer({length: 1}); new AudioBuffer({length: 1});
}, 'buffer = new AudioBuffer({length: 1})').throw('TypeError'); }, 'buffer = new AudioBuffer({length: 1})').throw(TypeError);
should(() => { should(() => {
new AudioBuffer({sampleRate: 48000}); new AudioBuffer({sampleRate: 48000});
}, 'buffer = new AudioBuffer({sampleRate: 48000})').throw('TypeError'); }, 'buffer = new AudioBuffer({sampleRate: 48000})').throw(TypeError);
should(() => { should(() => {
buffer = new AudioBuffer({numberOfChannels: 1}); buffer = new AudioBuffer({numberOfChannels: 1});
}, 'buffer = new AudioBuffer({numberOfChannels: 1}').throw('TypeError'); }, 'buffer = new AudioBuffer({numberOfChannels: 1}').throw(TypeError);
// Length and sampleRate are required, but others are optional. // Length and sampleRate are required, but others are optional.
should( should(

View file

@ -17,15 +17,15 @@
let oscTypes = ['sine', 'square', 'sawtooth', 'triangle', 'custom']; let oscTypes = ['sine', 'square', 'sawtooth', 'triangle', 'custom'];
let audit = Audit.createTaskRunner(); let audit = Audit.createTaskRunner();
audit.define('start/stop exceptions', (task, should) => { audit.define('start/stop exceptions', (task, should) => {
// We're not going to render anything, so make it simple // We're not going to render anything, so make it simple
let context = new OfflineAudioContext(1, 1, sampleRate); let context = new OfflineAudioContext(1, 1, sampleRate);
let node = new AudioBufferSourceNode(context); let node = new AudioBufferSourceNode(context);
testStartStop(should, node, [ testStartStop(should, node, [
{args: [0, -1], errorType: 'RangeError'}, {args: [0, -1], errorType: RangeError},
{args: [0, 0, -1], errorType: 'RangeError'} {args: [0, 0, -1], errorType: RangeError}
]); ]);
task.done(); task.done();
}); });

View file

@ -28,7 +28,7 @@
// Make sure we can't set to something which isn't an AudioBuffer. // Make sure we can't set to something which isn't an AudioBuffer.
should(function() { should(function() {
source.buffer = 57; source.buffer = 57;
}, 'source.buffer = 57').throw('TypeError'); }, 'source.buffer = 57').throw(TypeError);
// It's ok to set the buffer to null. // It's ok to set the buffer to null.
should(function() { should(function() {

View file

@ -140,7 +140,7 @@
context = new AudioContext({'latencyHint': 'foo'}) context = new AudioContext({'latencyHint': 'foo'})
}, },
'context = new AudioContext({\'latencyHint\': \'foo\'})') 'context = new AudioContext({\'latencyHint\': \'foo\'})')
.throw('TypeError'); .throw(TypeError);
// Verify that no extra options can be passed into the // Verify that no extra options can be passed into the
// AudioContextOptions. // AudioContextOptions.
@ -149,7 +149,7 @@
context = new AudioContext('latencyHint') context = new AudioContext('latencyHint')
}, },
'context = new AudioContext(\'latencyHint\')') 'context = new AudioContext(\'latencyHint\')')
.throw('TypeError'); .throw(TypeError);
Promise.all(closingPromises).then(function() { Promise.all(closingPromises).then(function() {
task.done(); task.done();

View file

@ -46,11 +46,11 @@
// Try calling connect() method with illegal values. // Try calling connect() method with illegal values.
should( should(
() => audioNode.connect(0, 0, 0), 'audioNode.connect(0, 0, 0)') () => audioNode.connect(0, 0, 0), 'audioNode.connect(0, 0, 0)')
.throw('TypeError'); .throw(TypeError);
should( should(
() => audioNode.connect(null, 0, 0), () => audioNode.connect(null, 0, 0),
'audioNode.connect(null, 0, 0)') 'audioNode.connect(null, 0, 0)')
.throw('TypeError'); .throw(TypeError);
should( should(
() => audioNode.connect(context.destination, 5, 0), () => audioNode.connect(context.destination, 5, 0),
'audioNode.connect(context.destination, 5, 0)') 'audioNode.connect(context.destination, 5, 0)')
@ -77,7 +77,7 @@
should( should(
() => context3 = new AudioContext(1, 44100, 44100), () => context3 = new AudioContext(1, 44100, 44100),
'context3 = new AudioContext(1, 44100, 44100)') 'context3 = new AudioContext(1, 44100, 44100)')
.throw('TypeError'); .throw(TypeError);
// Ensure it is an EventTarget // Ensure it is an EventTarget
should( should(

View file

@ -45,7 +45,7 @@
let defaultFuncArg = (value) => [value, 1]; let defaultFuncArg = (value) => [value, 1];
// Test the value parameter // Test the value parameter
doTests(should, gain, 'TypeError', nonFiniteValues, [ doTests(should, gain, TypeError, nonFiniteValues, [
{automationName: 'setValueAtTime', funcArg: defaultFuncArg}, { {automationName: 'setValueAtTime', funcArg: defaultFuncArg}, {
automationName: 'linearRampToValueAtTime', automationName: 'linearRampToValueAtTime',
funcArg: defaultFuncArg funcArg: defaultFuncArg
@ -75,7 +75,7 @@
let defaultFuncArg = (startTime) => [1, startTime]; let defaultFuncArg = (startTime) => [1, startTime];
// Test the time parameter // Test the time parameter
doTests(should, gain, 'TypeError', nonFiniteValues, [ doTests(should, gain, TypeError, nonFiniteValues, [
{automationName: 'setValueAtTime', funcArg: defaultFuncArg}, {automationName: 'setValueAtTime', funcArg: defaultFuncArg},
{ {
automationName: 'linearRampToValueAtTime', automationName: 'linearRampToValueAtTime',
@ -112,7 +112,7 @@
// contents of the array are not important. // contents of the array are not important.
let curve = new Float32Array(3); let curve = new Float32Array(3);
doTests(should, gain, 'TypeError', nonFiniteValues, [ doTests(should, gain, TypeError, nonFiniteValues, [
{ {
automationName: 'setValueCurveAtTime', automationName: 'setValueCurveAtTime',
funcArg: (startTime) => [curve, startTime, 1] funcArg: (startTime) => [curve, startTime, 1]
@ -121,7 +121,7 @@
// Non-finite values for the curve should signal an error // Non-finite values for the curve should signal an error
doTests( doTests(
should, gain, 'TypeError', should, gain, TypeError,
[[1, 2, Infinity, 3], [1, NaN, 2, 3]], [{ [[1, 2, Infinity, 3], [1, NaN, 2, 3]], [{
automationName: 'setValueCurveAtTime', automationName: 'setValueCurveAtTime',
funcArg: (c) => [c, 1, 1] funcArg: (c) => [c, 1, 1]
@ -144,7 +144,7 @@
// Test the time parameter // Test the time parameter
let curve = new Float32Array(3); let curve = new Float32Array(3);
doTests(should, gain, 'RangeError', [-1], [ doTests(should, gain, RangeError, [-1], [
{automationName: 'setValueAtTime', funcArg: defaultFuncArg}, {automationName: 'setValueAtTime', funcArg: defaultFuncArg},
{ {
automationName: 'linearRampToValueAtTime', automationName: 'linearRampToValueAtTime',
@ -178,7 +178,7 @@
should( should(
() => gain.gain.setValueCurveAtTime(curve, 1, 0), () => gain.gain.setValueCurveAtTime(curve, 1, 0),
'gain.gain.setValueCurveAtTime(curve, 1, 0)') 'gain.gain.setValueCurveAtTime(curve, 1, 0)')
.throw('RangeError'); .throw(RangeError);
task.done(); task.done();
}); });
@ -191,7 +191,7 @@
(task, should) => { (task, should) => {
let gain = context.createGain(); let gain = context.createGain();
doTests(should, gain, 'RangeError', [0, -1e-100, 1e-100], [{ doTests(should, gain, RangeError, [0, -1e-100, 1e-100], [{
automationName: 'exponentialRampToValueAtTime', automationName: 'exponentialRampToValueAtTime',
funcArg: (value) => [value, 1] funcArg: (value) => [value, 1]
}]); }]);

Some files were not shown because too many files have changed in this diff Show more