Update web-platform-tests to revision 7a6f5673ff5d146ca5c09c6a1b42b7706cfee328

This commit is contained in:
WPT Sync Bot 2018-06-28 21:05:13 -04:00
parent e2fca1b228
commit 4787b28da3
261 changed files with 8195 additions and 4689 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,7 @@
[script-304.html]
[Load a fresh cross-origin script]
expected: FAIL
[Reload same cross-origin script from the memory cache after revalidation]
expected: FAIL

View file

@ -0,0 +1,2 @@
[between-float-and-text.html]
expected: FAIL

View file

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

View file

@ -0,0 +1,4 @@
[trailing-space-before-br-001.html]
[CSS Text: A sequence of collapsible spaces at the end of a line is removed]
expected: FAIL

View file

@ -0,0 +1,16 @@
[transform-box-valid.html]
[e.style['transform-box'\] = "content-box" should set the property value]
expected: FAIL
[e.style['transform-box'\] = "border-box" should set the property value]
expected: FAIL
[e.style['transform-box'\] = "fill-box" should set the property value]
expected: FAIL
[e.style['transform-box'\] = "stroke-box" should set the property value]
expected: FAIL
[e.style['transform-box'\] = "view-box" should set the property value]
expected: FAIL

View file

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

File diff suppressed because it is too large Load diff

View file

@ -3,3 +3,6 @@
[When qualifiedName does not match the QName production, an INVALID_CHARACTER_ERR exception is to be thrown.]
expected: FAIL
[Toggling element with inline style should make inline style disappear]
expected: FAIL

View file

@ -9,3 +9,20 @@
[A Keep-Alive fetch() should return only its allocated Quota upon promise resolution.]
expected: FAIL
[request-keepalive-quota.html?include=slow-3]
[A Keep-Alive fetch() should not be allowed if the Quota is used up.]
expected: FAIL
[request-keepalive-quota.html?include=slow-1]
[request-keepalive-quota.html?include=slow-2]
[A Keep-Alive fetch() should return only its allocated Quota upon promise resolution.]
expected: FAIL
[request-keepalive-quota.html?include=fast]
[A Keep-Alive fetch() with a body over the Quota Limit should reject.]
expected: FAIL

View file

@ -0,0 +1,4 @@
[fetch-in-service-worker.html]
[Cross-Origin-Resource-Policy in Service Worker]
expected: FAIL

View file

@ -0,0 +1,9 @@
[fetch.any.html]
[fetch]
expected: FAIL
[fetch.any.worker.html]
[fetch]
expected: FAIL

View file

@ -1,7 +0,0 @@
[fetch.html]
[Untitled]
expected: FAIL
[fetch]
expected: FAIL

View file

@ -1,5 +1,4 @@
[javascript-url-abort-return-value-undefined.tentative.html]
expected: TIMEOUT
[Not aborting fetch for javascript:undefined navigation]
expected: TIMEOUT
expected: FAIL

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,4 @@
[idlharness.window.html]
[idlharness]
expected: FAIL

View file

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

View file

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

View file

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

View file

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

View file

@ -0,0 +1,235 @@
'use strict';
// Workaround because add_cleanup doesn't support async functions yet.
// See https://github.com/web-platform-tests/wpt/issues/6075
async function async_cleanup(cleanup_function) {
try {
await cleanup_function();
} catch (e) {
// Errors in cleanup functions shouldn't result in test failures.
}
}
const kCurrentHostname = (new URL(self.location.href)).hostname;
const kOneDay = 24 * 60 * 60 * 1000;
const kTenYears = 10 * 365 * kOneDay;
const kTenYearsFromNow = Date.now() + kTenYears;
const kCookieListItemKeys =
['domain', 'expires', 'name', 'path', 'sameSite', 'secure', 'value'].sort();
promise_test(async testCase => {
await cookieStore.delete('cookie-name');
await cookieStore.set('cookie-name', 'cookie-value');
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie.name, 'cookie-name');
assert_equals(cookie.value, 'cookie-value');
assert_equals(cookie.domain, null);
assert_equals(cookie.path, '/');
assert_equals(cookie.expires, null);
assert_equals(cookie.secure, true);
assert_equals(cookie.sameSite, 'strict');
assert_array_equals(Object.keys(cookie).sort(), kCookieListItemKeys);
await async_cleanup(() => cookieStore.delete('cookie-name'));
}, 'CookieListItem - cookieStore.set defaults with positional name and value');
promise_test(async testCase => {
await cookieStore.delete('cookie-name');
await cookieStore.set({ name: 'cookie-name', value: 'cookie-value' });
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie.name, 'cookie-name');
assert_equals(cookie.value, 'cookie-value');
assert_equals(cookie.domain, null);
assert_equals(cookie.path, '/');
assert_equals(cookie.expires, null);
assert_equals(cookie.secure, true);
assert_equals(cookie.sameSite, 'strict');
assert_array_equals(Object.keys(cookie).sort(), kCookieListItemKeys);
await async_cleanup(() => cookieStore.delete('cookie-name'));
}, 'CookieListItem - cookieStore.set defaults with name and value in options');
promise_test(async testCase => {
await cookieStore.delete('cookie-name');
await cookieStore.set('cookie-name', 'cookie-value',
{ expires: kTenYearsFromNow });
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie.name, 'cookie-name');
assert_equals(cookie.value, 'cookie-value');
assert_equals(cookie.domain, null);
assert_equals(cookie.path, '/');
assert_approx_equals(cookie.expires, kTenYearsFromNow, kOneDay);
assert_equals(cookie.secure, true);
assert_equals(cookie.sameSite, 'strict');
assert_array_equals(Object.keys(cookie).sort(), kCookieListItemKeys);
await async_cleanup(() => cookieStore.delete('cookie-name'));
}, 'CookieListItem - cookieStore.set with expires set to a timestamp 10 ' +
'years in the future');
promise_test(async testCase => {
await cookieStore.delete('cookie-name');
await cookieStore.set({ name: 'cookie-name', value: 'cookie-value',
expires: kTenYearsFromNow });
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie.name, 'cookie-name');
assert_equals(cookie.value, 'cookie-value');
assert_equals(cookie.domain, null);
assert_equals(cookie.path, '/');
assert_approx_equals(cookie.expires, kTenYearsFromNow, kOneDay);
assert_equals(cookie.secure, true);
assert_equals(cookie.sameSite, 'strict');
assert_array_equals(Object.keys(cookie).sort(), kCookieListItemKeys);
await async_cleanup(() => cookieStore.delete('cookie-name'));
}, 'CookieListItem - cookieStore.set with name and value in options and ' +
'expires set to a future timestamp');
promise_test(async testCase => {
await cookieStore.delete('cookie-name');
await cookieStore.set('cookie-name', 'cookie-value',
{ expires: new Date(kTenYearsFromNow) });
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie.name, 'cookie-name');
assert_equals(cookie.value, 'cookie-value');
assert_equals(cookie.domain, null);
assert_equals(cookie.path, '/');
assert_approx_equals(cookie.expires, kTenYearsFromNow, kOneDay);
assert_equals(cookie.secure, true);
await async_cleanup(() => cookieStore.delete('cookie-name'));
}, 'CookieListItem - cookieStore.set with expires set to a Date 10 ' +
'years in the future');
promise_test(async testCase => {
await cookieStore.delete('cookie-name');
await cookieStore.set({ name: 'cookie-name', value: 'cookie-value',
expires: new Date(kTenYearsFromNow) });
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie.name, 'cookie-name');
assert_equals(cookie.value, 'cookie-value');
assert_equals(cookie.domain, null);
assert_equals(cookie.path, '/');
assert_approx_equals(cookie.expires, kTenYearsFromNow, kOneDay);
assert_equals(cookie.secure, true);
assert_equals(cookie.sameSite, 'strict');
assert_array_equals(Object.keys(cookie).sort(), kCookieListItemKeys);
await async_cleanup(() => cookieStore.delete('cookie-name'));
}, 'CookieListItem - cookieStore.set with name and value in options and ' +
'expires set to a future Date');
promise_test(async testCase => {
await cookieStore.delete('cookie-name', { domain: kCurrentHostname });
await cookieStore.set('cookie-name', 'cookie-value',
{ domain: kCurrentHostname });
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie.name, 'cookie-name');
assert_equals(cookie.value, 'cookie-value');
assert_equals(cookie.domain, kCurrentHostname);
assert_equals(cookie.path, '/');
assert_equals(cookie.expires, null);
assert_equals(cookie.secure, true);
assert_equals(cookie.sameSite, 'strict');
assert_array_equals(Object.keys(cookie).sort(), kCookieListItemKeys);
await async_cleanup(async () => {
await cookieStore.delete('cookie-name', { domain: kCurrentHostname });
});
}, 'CookieListItem - cookieStore.set with domain set to the current hostname');
promise_test(async testCase => {
const currentUrl = new URL(self.location.href);
const currentPath = currentUrl.pathname;
const currentDirectory =
currentPath.substr(0, currentPath.lastIndexOf('/') + 1);
await cookieStore.delete('cookie-name', { path: currentDirectory });
await cookieStore.set('cookie-name', 'cookie-value',
{ path: currentDirectory });
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie.name, 'cookie-name');
assert_equals(cookie.value, 'cookie-value');
assert_equals(cookie.domain, null);
assert_equals(cookie.path, currentDirectory);
assert_equals(cookie.expires, null);
assert_equals(cookie.secure, true);
assert_equals(cookie.sameSite, 'strict');
assert_array_equals(Object.keys(cookie).sort(), kCookieListItemKeys);
await async_cleanup(async () => {
await cookieStore.delete('cookie-name', { path: currentDirectory });
});
}, 'CookieListItem - cookieStore.set with path set to the current directory');
promise_test(async testCase => {
await cookieStore.delete('cookie-name', { secure: false });
await cookieStore.set('cookie-name', 'cookie-value', { secure: false });
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie.name, 'cookie-name');
assert_equals(cookie.value, 'cookie-value');
assert_equals(cookie.domain, null);
assert_equals(cookie.path, '/');
assert_equals(cookie.expires, null);
assert_equals(cookie.secure, false);
assert_equals(cookie.sameSite, 'strict');
assert_array_equals(Object.keys(cookie).sort(), kCookieListItemKeys);
await async_cleanup(async () => {
await cookieStore.delete('cookie-name', { secure: false });
});
}, 'CookieListItem - cookieStore.set with secure set to false');
['strict', 'lax', 'unrestricted'].forEach(sameSiteValue => {
promise_test(async testCase => {
await cookieStore.delete('cookie-name', { sameSite: sameSiteValue });
await cookieStore.set({
name: 'cookie-name', value: 'cookie-value', sameSite: sameSiteValue });
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie.name, 'cookie-name');
assert_equals(cookie.value, 'cookie-value');
assert_equals(cookie.domain, null);
assert_equals(cookie.path, '/');
assert_equals(cookie.expires, null);
assert_equals(cookie.secure, true);
assert_equals(cookie.sameSite, sameSiteValue);
assert_array_equals(Object.keys(cookie).sort(), kCookieListItemKeys);
await async_cleanup(async () => {
await cookieStore.delete('cookie-name', { secure: sameSiteValue });
});
}, `CookieListItem - cookieStore.set with sameSite set to ${sameSiteValue}`);
promise_test(async testCase => {
await cookieStore.delete('cookie-name', { sameSite: sameSiteValue });
await cookieStore.set('cookie-name', 'cookie-value',
{ sameSite: sameSiteValue });
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie.name, 'cookie-name');
assert_equals(cookie.value, 'cookie-value');
assert_equals(cookie.domain, null);
assert_equals(cookie.path, '/');
assert_equals(cookie.expires, null);
assert_equals(cookie.secure, true);
assert_equals(cookie.sameSite, sameSiteValue);
assert_array_equals(Object.keys(cookie).sort(), kCookieListItemKeys);
await async_cleanup(async () => {
await cookieStore.delete('cookie-name', { secure: sameSiteValue });
});
}, 'CookieListItem - cookieStore.set with positional name and value and ' +
`sameSite set to ${sameSiteValue}`);
});

View file

@ -1,121 +0,0 @@
'use strict';
// Workaround because add_cleanup doesn't support async functions yet.
// See https://github.com/web-platform-tests/wpt/issues/6075
async function async_cleanup(cleanup_function) {
try {
await cleanup_function();
} catch (e) {
// Errors in cleanup functions shouldn't result in test failures.
}
}
const kCurrentHostname = (new URL(self.location.href)).hostname;
const kIsSecureTransport = (new URL(self.location.href)).protocol === 'https:';
const kOneDay = 24 * 60 * 60 * 1000;
const kTenYears = 10 * 365 * kOneDay;
const kTenYearsFromNow = Date.now() + kTenYears;
promise_test(async testCase => {
await cookieStore.delete('cookie-name');
await cookieStore.set('cookie-name', 'cookie-value');
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie.name, 'cookie-name');
assert_equals(cookie.value, 'cookie-value');
assert_equals(cookie.domain, null);
assert_equals(cookie.path, '/');
assert_equals(cookie.expires, null);
assert_equals(cookie.secure, kIsSecureTransport);
await async_cleanup(() => cookieStore.delete('cookie-name'));
}, 'cookieStore.set defaults with positional name and value');
promise_test(async testCase => {
await cookieStore.delete('cookie-name');
await cookieStore.set({ name: 'cookie-name', value: 'cookie-value' });
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie.name, 'cookie-name');
assert_equals(cookie.value, 'cookie-value');
assert_equals(cookie.domain, null);
assert_equals(cookie.path, '/');
assert_equals(cookie.expires, null);
assert_equals(cookie.secure, kIsSecureTransport);
await async_cleanup(() => cookieStore.delete('cookie-name'));
}, 'cookieStore.set defaults with name and value in options');
promise_test(async testCase => {
await cookieStore.delete('cookie-name');
await cookieStore.set('cookie-name', 'cookie-value',
{ expires: kTenYearsFromNow });
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie.name, 'cookie-name');
assert_equals(cookie.value, 'cookie-value');
assert_equals(cookie.domain, null);
assert_equals(cookie.path, '/');
assert_approx_equals(cookie.expires, kTenYearsFromNow, kOneDay);
assert_equals(cookie.secure, kIsSecureTransport);
await async_cleanup(() => cookieStore.delete('cookie-name'));
}, 'cookieStore.set with expires set to 10 years in the future');
promise_test(async testCase => {
await cookieStore.delete('cookie-name');
await cookieStore.set({ name: 'cookie-name', value: 'cookie-value',
expires: kTenYearsFromNow });
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie.name, 'cookie-name');
assert_equals(cookie.value, 'cookie-value');
assert_equals(cookie.domain, null);
assert_equals(cookie.path, '/');
assert_approx_equals(cookie.expires, kTenYearsFromNow, kOneDay);
assert_equals(cookie.secure, kIsSecureTransport);
await async_cleanup(() => cookieStore.delete('cookie-name'));
}, 'cookieStore.set with name and value in options and expires in the future');
promise_test(async testCase => {
await cookieStore.delete('cookie-name', { domain: kCurrentHostname });
await cookieStore.set('cookie-name', 'cookie-value',
{ domain: kCurrentHostname });
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie.name, 'cookie-name');
assert_equals(cookie.value, 'cookie-value');
assert_equals(cookie.domain, kCurrentHostname);
assert_equals(cookie.path, '/');
assert_equals(cookie.expires, null);
assert_equals(cookie.secure, kIsSecureTransport);
await async_cleanup(async () => {
await cookieStore.delete('cookie-name', { domain: kCurrentHostname });
});
}, 'cookieStore.set with domain set to the current hostname');
promise_test(async testCase => {
const currentUrl = new URL(self.location.href);
const currentPath = currentUrl.pathname;
const currentDirectory =
currentPath.substr(0, currentPath.lastIndexOf('/') + 1);
await cookieStore.delete('cookie-name', { path: currentDirectory });
await cookieStore.set('cookie-name', 'cookie-value',
{ path: currentDirectory });
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie.name, 'cookie-name');
assert_equals(cookie.value, 'cookie-value');
assert_equals(cookie.domain, null);
assert_equals(cookie.path, currentDirectory);
assert_equals(cookie.expires, null);
assert_equals(cookie.secure, kIsSecureTransport);
await async_cleanup(async () => {
await cookieStore.delete('cookie-name', { path: currentDirectory });
});
}, 'cookieStore.set with path set to the current directory');

View file

@ -84,14 +84,14 @@ promise_test(async testCase => {
await cookieStore.set('cookie-name-2', 'cookie-value-2');
const cookies = await cookieStore.getAll(
'cookie-name-', { matchType: 'startsWith' });
'cookie-name-', { matchType: 'starts-with' });
assert_equals(cookies.length, 1);
assert_equals(cookies[0].name, 'cookie-name-2');
assert_equals(cookies[0].value, 'cookie-value-2');
await async_cleanup(() => cookieStore.delete('cookie-name'));
await async_cleanup(() => cookieStore.delete('cookie-name-2'));
}, 'cookieStore.getAll with matchType set to startsWith');
}, 'cookieStore.getAll with matchType set to starts-with');
promise_test(async testCase => {
await cookieStore.set('cookie-name', 'cookie-value');
@ -109,11 +109,11 @@ promise_test(async testCase => {
await cookieStore.set('cookie-name-2', 'cookie-value-2');
const cookies = await cookieStore.getAll(
{ matchType: 'startsWith', name: 'cookie-name-' });
{ matchType: 'starts-with', name: 'cookie-name-' });
assert_equals(cookies.length, 1);
assert_equals(cookies[0].name, 'cookie-name-2');
assert_equals(cookies[0].value, 'cookie-value-2');
await async_cleanup(() => cookieStore.delete('cookie-name'));
await async_cleanup(() => cookieStore.delete('cookie-name-2'));
}, 'cookieStore.getAll with matchType set to startsWith and name in options');
}, 'cookieStore.getAll with matchType set to starts-with and name in options');

View file

@ -1,11 +1,3 @@
<!doctype html>
<meta charset="utf-8">
<title>Async Cookies: cookieStore.getAll() sees cookieStore.set() cookie</title>
<link rel="help" href="https://github.com/WICG/cookie-store">
<link rel="author" href="pwnall@chromium.org" title="Victor Costan">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
'use strict';
// Workaround because add_cleanup doesn't support async functions yet.
@ -37,5 +29,3 @@ promise_test(async testCase => {
await async_cleanup(() => cookieStore.delete('cookie-name-2'));
await async_cleanup(() => cookieStore.delete('cookie-name-3'));
}, 'cookieStore.getAll returns multiple cookies written by cookieStore.set');
</script>

View file

@ -58,12 +58,12 @@ promise_test(async testCase => {
await cookieStore.set('cookie-name', 'cookie-value');
const cookie = await cookieStore.get(
'cookie-na', { matchType: 'startsWith' });
'cookie-na', { matchType: 'starts-with' });
assert_equals(cookie.name, 'cookie-name');
assert_equals(cookie.value, 'cookie-value');
async_cleanup(() => cookieStore.delete('cookie-name'));
}, 'cookieStore.get with matchType set to startsWith');
}, 'cookieStore.get with matchType set to starts-with');
promise_test(async testCase => {
await cookieStore.set('cookie-name', 'cookie-value');
@ -78,9 +78,9 @@ promise_test(async testCase => {
await cookieStore.set('cookie-name', 'cookie-value');
const cookie = await cookieStore.get(
{ matchType: 'startsWith', name: 'cookie-na' });
{ matchType: 'starts-with', name: 'cookie-na' });
assert_equals(cookie.name, 'cookie-name');
assert_equals(cookie.value, 'cookie-value');
async_cleanup(() => cookieStore.delete('cookie-name'));
}, 'cookieStore.get with matchType set to startsWith and name in options');
}, 'cookieStore.get with matchType set to starts-with and name in options');

View file

@ -1,92 +0,0 @@
'use strict';
// Workaround because add_cleanup doesn't support async functions yet.
// See https://github.com/web-platform-tests/wpt/issues/6075
async function async_cleanup(cleanup_function) {
try {
await cleanup_function();
} catch (e) {
// Errors in cleanup functions shouldn't result in test failures.
}
}
promise_test(async testCase => {
await cookieStore.set('cookie-name', 'cookie-value');
await cookieStore.delete('cookie-name-2');
const has_cookie = await cookieStore.has('cookie-name');
assert_equals(has_cookie, true);
const has_cookie2 = await cookieStore.has('cookie-name-2');
assert_equals(has_cookie2, false);
await async_cleanup(() => cookieStore.delete('cookie-name'));
}, 'cookieStore.has with positional name');
promise_test(async testCase => {
await cookieStore.set('cookie-name', 'cookie-value');
await cookieStore.delete('cookie-name-2');
const has_cookie = await cookieStore.has({ name: 'cookie-name' });
assert_equals(has_cookie, true);
const has_cookie2 = await cookieStore.has({ name: 'cookie-name-2' });
assert_equals(has_cookie2, false);
await async_cleanup(() => cookieStore.delete('cookie-name'));
}, 'cookieStore.has with name in options');
promise_test(async testCase => {
await cookieStore.set('cookie-name', 'cookie-value');
await promise_rejects(testCase, new TypeError(), cookieStore.has(
'cookie-name', { name: 'cookie-name' }));
await async_cleanup(() => cookieStore.delete('cookie-name'));
}, 'cookieStore.has with name in both positional arguments and options');
promise_test(async testCase => {
await cookieStore.set('cookie-name', 'cookie-value');
const has_cookie = await cookieStore.has(
'cookie-na', { matchType: 'equals' });
assert_equals(has_cookie, false);
const has_cookie2 = await cookieStore.has(
'cookie-name', { matchType: 'equals' });
assert_equals(has_cookie2, true);
await async_cleanup(() => cookieStore.delete('cookie-name'));
}, 'cookieStore.has with matchType explicitly set to equals');
promise_test(async testCase => {
await cookieStore.set('cookie-name', 'cookie-value');
const has_cookie = await cookieStore.has(
'cookie-na', { matchType: 'startsWith' });
assert_equals(has_cookie, true);
const has_cookie2 = await cookieStore.has(
'cookie-name-', { matchType: 'startsWith' });
assert_equals(has_cookie2, false);
await async_cleanup(() => cookieStore.delete('cookie-name'));
}, 'cookieStore.has with matchType set to startsWith');
promise_test(async testCase => {
await cookieStore.set('cookie-name', 'cookie-value');
await promise_rejects(testCase, new TypeError(), cookieStore.has(
'cookie-name', { matchType: 'invalid' }));
await async_cleanup(() => cookieStore.delete('cookie-name'));
}, 'cookieStore.has with invalid matchType');
promise_test(async testCase => {
await cookieStore.set('cookie-name', 'cookie-value');
const has_cookie = await cookieStore.has(
{ matchType: 'startsWith', name: 'cookie-na' });
assert_equals(has_cookie, true);
const has_cookie2 = await cookieStore.has(
{ matchType: 'startsWith', name: 'cookie-name-' });
assert_equals(has_cookie2, false);
await async_cleanup(() => cookieStore.delete('cookie-name'));
}, 'cookieStore.has with matchType set to startsWith and name in options');

View file

@ -1,25 +0,0 @@
'use strict';
// Workaround because add_cleanup doesn't support async functions yet.
// See https://github.com/web-platform-tests/wpt/issues/6075
async function async_cleanup(cleanup_function) {
try {
await cleanup_function();
} catch (e) {
// Errors in cleanup functions shouldn't result in test failures.
}
}
promise_test(async testCase => {
await cookieStore.set('cookie-name', 'cookie-value');
assert_equals(await cookieStore.has('cookie-name'), true);
await async_cleanup(() => cookieStore.delete('cookie-name'));
}, 'cookieStore.has returns true for cookie set by cookieStore.set()');
promise_test(async testCase => {
await cookieStore.delete('cookie-name');
assert_equals(await cookieStore.has('cookie-name'), false);
await async_cleanup(() => cookieStore.delete('cookie-name'));
}, 'cookieStore.has returns false for cookie deleted by cookieStore.delete()');

View file

@ -67,7 +67,7 @@ promise_test(async testCase => {
assert_equals(cookie.value, 'cookie-value');
await async_cleanup(() => cookieStore.delete('cookie-name'));
}, 'cookieStore.set with expires in the future');
}, 'cookieStore.set with expires set to a future timestamp');
promise_test(async testCase => {
const tenYears = 10 * 365 * 24 * 60 * 60 * 1000;
@ -80,7 +80,34 @@ promise_test(async testCase => {
assert_equals(cookie, null);
await async_cleanup(() => cookieStore.delete('cookie-name'));
}, 'cookieStore.set with expires in the past');
}, 'cookieStore.set with expires set to a past timestamp');
promise_test(async testCase => {
const tenYears = 10 * 365 * 24 * 60 * 60 * 1000;
const tenYearsFromNow = Date.now() + tenYears;
await cookieStore.delete('cookie-name');
await cookieStore.set(
'cookie-name', 'cookie-value', { expires: new Date(tenYearsFromNow) });
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie.name, 'cookie-name');
assert_equals(cookie.value, 'cookie-value');
await async_cleanup(() => cookieStore.delete('cookie-name'));
}, 'cookieStore.set with expires set to a future Date');
promise_test(async testCase => {
const tenYears = 10 * 365 * 24 * 60 * 60 * 1000;
const tenYearsAgo = Date.now() - tenYears;
await cookieStore.delete('cookie-name');
await cookieStore.set(
'cookie-name', 'cookie-value', { expires: new Date(tenYearsAgo) });
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie, null);
await async_cleanup(() => cookieStore.delete('cookie-name'));
}, 'cookieStore.set with expires set to a past Date');
promise_test(async testCase => {
const tenYears = 10 * 365 * 24 * 60 * 60 * 1000;

View file

@ -1,59 +0,0 @@
'use strict';
// Workaround because add_cleanup doesn't support async functions yet.
// See https://github.com/web-platform-tests/wpt/issues/6075
async function async_cleanup(cleanup_function) {
try {
await cleanup_function();
} catch (e) {
// Errors in cleanup functions shouldn't result in test failures.
}
}
promise_test(async testCase => {
const inTwentyFourHours = new Date(Date.now() + 24 * 60 * 60 * 1000);
assert_equals(
await cookieStore.set(
'cookie-name', 'cookie-value', { expires: inTwentyFourHours }),
undefined);
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie.name, 'cookie-name');
assert_equals(cookie.value, 'cookie-value');
await async_cleanup(() => cookieStore.delete('cookie-name'));
}, 'cookieStore.set with expires option: Date object');
promise_test(async testCase => {
const inTwentyFourHours = Date.now() + 24 * 60 * 60 * 1000;
assert_equals(
await cookieStore.set(
'cookie-name', 'cookie-value', { expires: inTwentyFourHours }),
undefined);
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie.name, 'cookie-name');
assert_equals(cookie.value, 'cookie-value');
await async_cleanup(() => cookieStore.delete('cookie-name'));
}, 'cookieStore.set with expires option: milliseconds since epoch object');
promise_test(async testCase => {
const year = (new Date()).getUTCFullYear() + 1;
const date = new Date('07 Jun ' + year + ' 07:07:07 UTC');
const day = ('Sun Mon Tue Wed Thu Fri Sat'.split(' '))[date.getUTCDay()];
const nextJune = `${day}, 07 Jun ${year} + ' 07:07:07 GMT`;
assert_equals(
await cookieStore.set(
'cookie-name', 'cookie-value', { expires: nextJune }),
undefined);
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie.name, 'cookie-name');
assert_equals(cookie.value, 'cookie-value');
await async_cleanup(() => cookieStore.delete('cookie-name'));
}, 'cookieStore.set with expires option: HTTP date string');

View file

@ -1,71 +0,0 @@
<!doctype html>
<meta charset="utf-8">
<title>Cookie Store: cookieStore handles special cookie names correctly</title>
<link rel="help" href="https://github.com/WICG/cookie-store">
<link rel="author" href="pwnall@chromium.org" title="Victor Costan">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
'use strict';
['__Secure-', '__Host-'].forEach(prefix => {
promise_test(async testCase => {
await promise_rejects(
testCase, new TypeError(),
cookieStore.set(`${prefix}cookie-name`, `secure-cookie-value`),
`Setting ${prefix} cookies should fail in non-secure contexts`);
try { await cookieStore.delete(`${prefix}cookie-name`); } catch (e) {}
}, `cookieStore.set with ${prefix} name on non-secure origin`);
promise_test(async testCase => {
await promise_rejects(
testCase, new TypeError(),
cookieStore.set(
`${prefix}cookie-name`, `secure-cookie-value`, {
expires: Date.now() - (24 * 60 * 60 * 1000)
}),
`Setting expired ${prefix} cookies should fail in non-secure contexts`);
try { await cookieStore.delete(`${prefix}cookie-name`); } catch (e) {}
}, `cookieStore.set of expired ${prefix} cookie on non-secure origin`);
promise_test(async testCase => {
assert_equals(
await cookieStore.get(`${prefix}cookie-name`),
null,
'get with ${prefix} prefix should not reject');
assert_equals(
await cookieStore.get({name: `${prefix}cookie-name`}),
null,
'get with ${prefix} prefix name option should not reject');
assert_equals(
await cookieStore.get({name: prefix, matchType: 'startsWith'}),
null,
'get with ${prefix} name and startsWith options should not reject');
}, `cookieStore.get with ${prefix} name on non-secure origin`);
promise_test(async testCase => {
assert_array_equals(
await cookieStore.getAll(`${prefix}cookie-name`),
[],
'getAll with ${prefix} prefix should not reject');
assert_array_equals(
await cookieStore.getAll({name: `${prefix}cookie-name`}),
[],
'getAll with ${prefix} prefix name option should not reject');
assert_array_equals(
await cookieStore.getAll({name: prefix, matchType: 'startsWith'}),
[],
'getAll with ${prefix} name and startsWith options should not reject');
}, `cookieStore.getAll with ${prefix} name on non-secure origin`);
promise_test(async testCase => {
await promise_rejects(
testCase, new TypeError(),
cookieStore.delete(`${prefix}cookie-name`, `host-cookie-value`),
`Deleting ${prefix} cookies should fail in non-secure contexts`);
}, `cookieStore.delete with ${prefix} name on non-secure origin`);
});
</script>

View file

@ -1,11 +1,3 @@
<!doctype html>
<meta charset="utf-8">
<title>Cookie Store: cookieStore handles special cookie names correctly (secure context)</title>
<link rel="help" href="https://github.com/WICG/cookie-store">
<link rel="author" href="pwnall@chromium.org" title="Victor Costan">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
'use strict';
['__Secure-', '__Host-'].forEach(prefix => {
@ -37,5 +29,3 @@
`Deleting ${prefix} cookies should not fail in secure context`);
}, `cookieStore.delete with ${prefix} name on secure origin`);
});
</script>

View file

@ -1,8 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Async Cookies: document.cookie</title>
<meta name="help" href="https://github.com/WICG/cookie-store/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/cookie-test-helpers.js"></script>
<script src="resources/document_cookie.js"></script>

View file

@ -1,8 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Async Cookies: HTTP Cookie and Set-Cookie headers</title>
<meta name="help" href="https://github.com/WICG/cookie-store/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/cookie-test-helpers.js"></script>
<script src="resources/http_cookie_and_set_cookie_headers.js"></script>

View file

@ -1,8 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Async Cookies: Test No Name and No Value</title>
<meta name="help" href="https://github.com/WICG/cookie-store/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/cookie-test-helpers.js"></script>
<script src="resources/no_name_and_no_value.js"></script>

View file

@ -1,8 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Async Cookies: Test No Name, '=' in Value</title>
<meta name="help" href="https://github.com/WICG/cookie-store/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/cookie-test-helpers.js"></script>
<script src="resources/no_name_equals_in_value.js"></script>

View file

@ -1,8 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Async Cookies: Test No Name, Multiple Values</title>
<meta name="help" href="https://github.com/WICG/cookie-store/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/cookie-test-helpers.js"></script>
<script src="resources/no_name_multiple_values.js"></script>

View file

@ -5,10 +5,12 @@ self.GLOBAL = {
importScripts("/resources/testharness.js");
importScripts(
"cookieStore_delete_arguments.tentative.window.js",
"cookieStore_get_arguments.tentative.window.js",
"cookieStore_getAll_arguments.tentative.window.js",
"cookieStore_has_arguments.tentative.window.js",
"cookieStore_set_arguments.tentative.window.js");
"cookieListItem_attributes.tentative.https.window.js",
"cookieStore_delete_arguments.tentative.https.window.js",
"cookieStore_get_arguments.tentative.https.window.js",
"cookieStore_getAll_arguments.tentative.https.window.js",
"cookieStore_getAll_multiple.tentative.https.window.js",
"cookieStore_set_arguments.tentative.https.window.js",
"cookieStore_special_names.tentative.https.window.js");
done();

View file

@ -5,9 +5,9 @@ self.GLOBAL = {
importScripts("/resources/testharness.js");
importScripts(
"cookieStore_get_delete_basic.tentative.window.js",
"cookieStore_get_set_basic.tentative.window.js",
"cookieStore_getAll_set_basic.tentative.window.js",
"cookieStore_has_basic.tentative.window.js");
"cookieStore_delete_basic.tentative.https.window.js",
"cookieStore_get_delete_basic.tentative.https.window.js",
"cookieStore_get_set_basic.tentative.https.window.js",
"cookieStore_getAll_set_basic.tentative.https.window.js");
done();

View file

@ -13,7 +13,7 @@ self.addEventListener('install', (event) => {
{ name: 'cookie-name1', matchType: 'equals', url: '/scope/path1' }]);
await cookieStore.subscribeToChanges([
{ }, // Test the default values for subscription properties.
{ name: 'cookie-prefix', matchType: 'startsWith' },
{ name: 'cookie-prefix', matchType: 'starts-with' },
]);
})());
});
@ -54,10 +54,10 @@ promise_test(async testCase => {
assert_equals('equals', subscriptions[0].matchType);
assert_equals(subscriptions[1].name, 'cookie-prefix');
assert_equals('startsWith', subscriptions[1].matchType);
assert_equals('starts-with', subscriptions[1].matchType);
assert_false('name' in subscriptions[2]);
assert_equals('startsWith', subscriptions[2].matchType);
assert_equals('starts-with', subscriptions[2].matchType);
}, 'getChangeSubscriptions returns subscriptions passed to subscribeToChanges');
promise_test(async testCase => {

View file

@ -40,7 +40,7 @@ promise_test(async testCase => {
promise_test(async testCase => {
await kServiceWorkerActivatedPromise;
cookie_change_received_promise = new Promise((resolve) => {
const cookie_change_received_promise = new Promise((resolve) => {
self.addEventListener('cookiechange', (event) => {
resolve(event);
});

View file

@ -0,0 +1,36 @@
self.GLOBAL = {
isWindow: function() { return false; },
isWorker: function() { return true; },
};
importScripts("/resources/testharness.js");
self.addEventListener('install', (event) => {
event.waitUntil((async () => {
cookieStore.subscribeToChanges([]);
})());
});
// Workaround because add_cleanup doesn't support async functions yet.
// See https://github.com/w3c/web-platform-tests/issues/6075
async function async_cleanup(cleanup_function) {
try {
await cleanup_function();
} catch (e) {
// Errors in cleanup functions shouldn't result in test failures.
}
}
// Resolves when the service worker receives the 'activate' event.
const kServiceWorkerActivatedPromise = new Promise(resolve => {
self.addEventListener('activate', event => { resolve(); });
});
promise_test(async testCase => {
await kServiceWorkerActivatedPromise;
const subscriptions = await cookieStore.getChangeSubscriptions();
assert_equals(subscriptions.length, 0);
}, 'getChangeSubscriptions returns an empty array when there are no subscriptions');
done();

View file

@ -0,0 +1,21 @@
<!doctype html>
<meta charset="utf-8">
<title>Async Cookies: ServiceWorker without cookie change subscriptions</title>
<link rel="help" href="https://github.com/WICG/cookie-store">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
'use strict';
(async () => {
const scope = 'scope';
let registration = await navigator.serviceWorker.getRegistration(scope);
if (registration)
await registration.unregister();
registration = await navigator.serviceWorker.register(
'serviceworker_cookieStore_subscriptions_empty.js', {scope});
fetch_tests_from_worker(registration.installing);
})();
</script>

View file

@ -0,0 +1,53 @@
self.GLOBAL = {
isWindow: function() { return false; },
isWorker: function() { return true; },
};
importScripts("/resources/testharness.js");
self.addEventListener('install', (event) => {
event.waitUntil((async () => {
cookieStore.subscribeToChanges([
{ name: 'cookie-name', matchType: 'equals', url: '/scope/path' }]);
})());
});
// Workaround because add_cleanup doesn't support async functions yet.
// See https://github.com/w3c/web-platform-tests/issues/6075
async function async_cleanup(cleanup_function) {
try {
await cleanup_function();
} catch (e) {
// Errors in cleanup functions shouldn't result in test failures.
}
}
// Resolves when the service worker receives the 'activate' event.
const kServiceWorkerActivatedPromise = new Promise(resolve => {
self.addEventListener('activate', event => { resolve(); });
});
promise_test(async testCase => {
await kServiceWorkerActivatedPromise;
const cookie_change_received_promise = new Promise((resolve) => {
self.addEventListener('cookiechange', (event) => {
resolve(event);
});
});
await cookieStore.set('another-cookie-name', 'cookie-value');
await cookieStore.set('cookie-name', 'cookie-value');
const event = await cookie_change_received_promise;
assert_equals(event.type, 'cookiechange');
assert_equals(event.changed.length, 1);
assert_equals(event.changed[0].name, 'cookie-name');
assert_equals(event.changed[0].value, 'cookie-value');
await async_cleanup(() => {
cookieStore.delete('another-cookie-name');
cookieStore.delete('cookie-name');
});
}, 'cookiechange not dispatched for change that does not match subscription');
done();

View file

@ -0,0 +1,21 @@
<!doctype html>
<meta charset="utf-8">
<title>Async Cookies: ServiceWorker cookiechange event filtering</title>
<link rel="help" href="https://github.com/WICG/cookie-store">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
'use strict';
(async () => {
const scope = 'scope';
let registration = await navigator.serviceWorker.getRegistration(scope);
if (registration)
await registration.unregister();
registration = await navigator.serviceWorker.register(
'serviceworker_cookieStore_subscriptions_mismatch.js', {scope});
fetch_tests_from_worker(registration.installing);
})();
</script>

View file

@ -0,0 +1,10 @@
def main(request, response):
match = request.headers.get("If-None-Match", None)
if match is not None and match == "mybestscript-v1":
response.status = (304, "YEP")
return ""
response.headers.set("Access-Control-Allow-Origin", "*")
response.headers.set("Cache-Control", "must-revalidate")
response.headers.set("ETag", "mybestscript-v1")
response.headers.set("Content-Type", "text/javascript")
return "function hep() { }"

View file

@ -0,0 +1,40 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="/common/utils.js"></script>
</head>
<body>
<div id="testDiv"></div>
<script>
const scriptURL = get_host_info().HTTP_REMOTE_ORIGIN + "/cors/resources/cache-304.py?" + token();
function loadScript(test)
{
const script = document.createElement("script");
script.crossOrigin = "anonymous";
script.src = scriptURL;
return new Promise((resolve, reject) => {
// Let's add a small timeout so that the script is fully loaded in memory cache before reloading it.
script.onload = test.step_timeout(resolve, 50);
script.onerror = reject;
testDiv.appendChild(script);
});
}
promise_test((test) => {
return loadScript(test);
}, "Load a fresh cross-origin script");
promise_test((test) => {
return loadScript(test);
}, "Reload same cross-origin script from the memory cache after revalidation");
</script>
</body>
</html>

View file

@ -1,103 +0,0 @@
<!DOCTYPE html>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/resources/WebIDLParser.js></script>
<script src=/resources/idlharness.js></script>
<script type="text/plain" id="untested">
dictionary CredentialData {
USVString id;
};
[Exposed=Window, SecureContext]
interface Credential {
readonly attribute USVString id;
readonly attribute DOMString type;
};
[NoInterfaceObject, SecureContext]
interface CredentialUserData {
readonly attribute USVString name;
readonly attribute USVString iconURL;
};
dictionary PasswordCredentialData : CredentialData {
USVString name;
USVString iconURL;
required USVString password;
};
typedef (PasswordCredentialData or HTMLFormElement) PasswordCredentialInit;
typedef (FormData or URLSearchParams) CredentialBodyType;
dictionary FederatedCredentialInit : CredentialData {
USVString name;
USVString iconURL;
required USVString provider;
DOMString protocol;
};
dictionary CredentialCreationOptions {
PasswordCredentialInit? password;
FederatedCredentialInit? federated;
};
enum CredentialMediationRequirement {
"silent",
"optional",
"required"
};
dictionary CredentialRequestOptions {
boolean password = false;
FederatedCredentialRequestOptions federated;
CredentialMediationRequirement mediation = "optional";
};
dictionary FederatedCredentialRequestOptions {
sequence<USVString> providers;
sequence<DOMString> protocols;
};
</script>
<script type="text/plain" id="tested">
[Exposed=Window, SecureContext]
interface CredentialsContainer {
Promise<Credential> get(optional CredentialRequestOptions options);
Promise<Credential> store(Credential credential);
Promise<Credential?> create(optional CredentialCreationOptions options);
Promise<void> preventSilentAccess();
};
[Constructor(PasswordCredentialData data),
Constructor(HTMLFormElement form),
Exposed=Window,
SecureContext]
interface PasswordCredential : Credential {
readonly attribute DOMString password;
};
PasswordCredential implements CredentialUserData;
[Constructor(FederatedCredentialInit data),
Exposed=Window,
SecureContext]
interface FederatedCredential : Credential {
readonly attribute USVString provider;
readonly attribute DOMString? protocol;
};
FederatedCredential implements CredentialUserData;
</script>
<script>
"use strict";
var idl_array = new IdlArray();
idl_array.add_untested_idls(document.querySelector('#untested').textContent);
idl_array.add_idls(document.querySelector('#tested').textContent);
idl_array.add_objects({
CredentialsContainer: ['navigator.credentials'],
PasswordCredential: ['new PasswordCredential({ id: "id", password: "pencil", iconURL: "https://example.com/", name: "name" })'],
FederatedCredential: ['new FederatedCredential({ id: "id", provider: "https://example.com", iconURL: "https://example.com/", name: "name" })']
});
idl_array.test();
</script>

View file

@ -0,0 +1,35 @@
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
// https://w3c.github.io/webappsec-credential-management/
'use strict';
promise_test(async () => {
const idl = await fetch('/interfaces/credential-management.idl').then(r => r.text());
const html = await fetch('/interfaces/html.idl').then(r => r.text());
var idl_array = new IdlArray();
idl_array.add_idls(idl);
idl_array.add_dependency_idls(html);
idl_array.add_objects({
CredentialsContainer: ['navigator.credentials'],
PasswordCredential: [
`new PasswordCredential({
id: "id",
password: "pencil",
iconURL: "https://example.com/",
name: "name"
})`
],
FederatedCredential: [
`new FederatedCredential({
id: "id",
provider: "https://example.com",
iconURL: "https://example.com/",
name: "name"
})`
]
});
idl_array.test();
})

View file

@ -0,0 +1,11 @@
<!DOCTYPE html>
<title>Auto-positioned abspos after text, before float</title>
<link rel="author" title="Morten Stenshorne" href="mstensho@chromium.org">
<link rel="help" href="https://www.w3.org/TR/CSS22/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements">
<link rel="match" href="../../reference/ref-filled-green-200px-square.html">
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div style="line-height:20px; margin-top:-20px;">
&nbsp;
<div style="position:absolute; width:200px; height:200px; background:green;"></div>
<div style="float:left; margin-top:20px; width:200px; height:200px; background:red;"></div>
</div>

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS basic box model: parsing clear with invalid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-clear">
<meta name="assert" content="clear supports only the grammar 'none | left | right | both'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("clear", "auto");
test_invalid_value("clear", "left right");
</script>
</body>
</html>

View file

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS basic box model: parsing clear with valid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-clear">
<meta name="assert" content="clear supports the full grammar 'none | left | right | both'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("clear", "none");
test_valid_value("clear", "left");
test_valid_value("clear", "right");
test_valid_value("clear", "both");
</script>
</body>
</html>

View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS basic box model: parsing float with invalid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-float">
<meta name="assert" content="float supports only the grammar 'left | right | top | bottom | start | end | none | <page-floats>'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("float", "auto");
test_invalid_value("float", "right bottom");
test_invalid_value("float", "top, left");
</script>
</body>
</html>

View file

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS basic box model: parsing float with valid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-float">
<meta name="assert" content="float supports the full grammar 'left | right | top | bottom | start | end | none | <page-floats>'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("float", "left");
test_valid_value("float", "right");
test_valid_value("float", "none");
// The following are not yet supported by browsers:
// test_valid_value("float", "top");
// test_valid_value("float", "bottom");
// test_valid_value("float", "start"); // not permitted in https://drafts.csswg.org/css-page-floats/#float-property
// test_valid_value("float", "end"); // not permitted in https://drafts.csswg.org/css-page-floats/#float-property
// Page floats are now defined in
// https://drafts.csswg.org/css-page-floats/#float-property
</script>
</body>
</html>

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS basic box model: parsing height with invalid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-height">
<meta name="assert" content="height supports only the grammar '[<length> | <percentage>] | available | min-content | max-content | fit-content | complex | auto'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("height", "none");
test_invalid_value("height", "min-content available");
test_invalid_value("height", "max-content 10px");
test_invalid_value("height", "20% available");
test_invalid_value("height", "-10px");
test_invalid_value("height", "-20%");
test_invalid_value("height", "60");
test_invalid_value("height", "10px 20%");
test_invalid_value("height", "10px border-box");
test_invalid_value("height", "content-box 20%");
</script>
</body>
</html>

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS basic box model: parsing height with valid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-height">
<meta name="assert" content="height supports the full grammar '[<length> | <percentage>] | available | min-content | max-content | fit-content | complex | auto'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("height", "auto");
test_valid_value("height", "10px");
test_valid_value("height", "20%");
test_valid_value("height", "calc(2em + 3ex)");
test_valid_value("height", "min-content");
test_valid_value("height", "max-content");
test_valid_value("height", "fit-content");
// The following are not yet supported by browsers:
// test_valid_value("height", "available");
// test_valid_value("height", "complex");
</script>
</body>
</html>

View file

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS basic box model: parsing margin with invalid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-margin">
<meta name="assert" content="margin supports only the grammar '[ <length> | <percentage> | auto]{1,4}'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("margin", "available");
test_invalid_value("margin", "10px border-box");
test_invalid_value("margin", "1% 2% 3% 4% 5%");
test_invalid_value("margin-top", "calc(2em + 3ex) auto");
test_invalid_value("margin-right", "auto calc(2em + 3ex) 20%");
test_invalid_value("margin-bottom", "10px 20% calc(2em + 3ex) auto");
test_invalid_value("margin-bottom-left", "none");
</script>
</body>
</html>

View file

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS basic box model: parsing margin with valid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-margin">
<meta name="assert" content="margin supports the full grammar '[ <length> | <percentage> | auto]{1,4}'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("margin", "10px");
test_valid_value("margin", "20%");
test_valid_value("margin", "calc(2em + 3ex)");
test_valid_value("margin", "auto");
test_valid_value("margin", "-10px");
test_valid_value("margin", "-20%");
test_valid_value("margin", "calc(2em + 3ex) auto");
test_valid_value("margin", "auto calc(2em + 3ex) 20%");
test_valid_value("margin", "10px 20% calc(2em + 3ex) auto");
test_valid_value("margin-top", "10px");
test_valid_value("margin-right", "20%");
test_valid_value("margin-bottom", "calc(2em + 3ex)");
test_valid_value("margin-left", "auto");
test_valid_value("margin-top", "-10px");
test_valid_value("margin-right", "-20%");
</script>
</body>
</html>

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS basic box model: parsing max-height with invalid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-max-height">
<meta name="assert" content="max-height supports only the grammar '[ [<length> | <percentage>] && [border-box | content-box]? ] | available | min-content | max-content | fit-content | none'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("max-height", "complex");
test_invalid_value("max-height", "auto");
test_invalid_value("max-height", "none available");
test_invalid_value("max-height", "max-content 10px");
test_invalid_value("max-height", "20% available");
test_invalid_value("max-height", "-10px");
test_invalid_value("max-height", "-20%");
test_invalid_value("max-height", "60");
test_invalid_value("max-height", "10px 20%");
test_invalid_value("max-height", "content-box border-box");
test_invalid_value("max-height", "10px border-box 20%");
test_invalid_value("max-height", "content-box 20% border-box");
</script>
</body>
</html>

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS basic box model: parsing max-height with valid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-max-height">
<meta name="assert" content="max-height supports the full grammar '[ [<length> | <percentage>] && [border-box | content-box]? ] | available | min-content | max-content | fit-content | none'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("max-height", "none");
test_valid_value("max-height", "10px");
test_valid_value("max-height", "20%");
test_valid_value("max-height", "calc(2em + 3ex)");
test_valid_value("max-height", "min-content");
test_valid_value("max-height", "max-content");
test_valid_value("max-height", "fit-content");
// The following are not yet supported by browsers:
// test_valid_value("max-height", "available");
// test_valid_value("max-height", "10px border-box");
// test_valid_value("max-height", "content-box 20%", "20% content-box");
</script>
</body>
</html>

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS basic box model: parsing max-width with invalid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-max-width">
<meta name="assert" content="max-width supports only the grammar '[ [<length> | <percentage>] && [border-box | content-box]? ] | available | min-content | max-content | fit-content | none'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("max-width", "complex");
test_invalid_value("max-width", "auto");
test_invalid_value("max-width", "none available");
test_invalid_value("max-width", "max-content 10px");
test_invalid_value("max-width", "20% available");
test_invalid_value("max-width", "-10px");
test_invalid_value("max-width", "-20%");
test_invalid_value("max-width", "60");
test_invalid_value("max-width", "10px 20%");
test_invalid_value("max-width", "content-box border-box");
test_invalid_value("max-width", "10px border-box 20%");
test_invalid_value("max-width", "content-box 20% border-box");
</script>
</body>
</html>

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS basic box model: parsing max-width with valid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-max-width">
<meta name="assert" content="max-width supports the full grammar '[ [<length> | <percentage>] && [border-box | content-box]? ] | available | min-content | max-content | fit-content | none'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("max-width", "none");
test_valid_value("max-width", "10px");
test_valid_value("max-width", "20%");
test_valid_value("max-width", "calc(2em + 3ex)");
test_valid_value("max-width", "min-content");
test_valid_value("max-width", "max-content");
test_valid_value("max-width", "fit-content");
// The following are not yet supported by browsers:
// test_valid_value("max-width", "available");
// test_valid_value("max-width", "10px border-box");
// test_valid_value("max-width", "content-box 20%", "20% content-box");
</script>
</body>
</html>

View file

@ -0,0 +1,33 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS basic box model: parsing min-height with invalid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-min-height">
<meta name="assert" content="min-height supports only the grammar '[ [<length> | <percentage>] && [border-box | content-box]? ] | available | min-content | max-content | fit-content'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("min-height", "complex");
test_invalid_value("min-height", "none");
test_invalid_value("min-height", "none available");
test_invalid_value("min-height", "max-content 10px");
test_invalid_value("min-height", "20% available");
test_invalid_value("min-height", "-10px");
test_invalid_value("min-height", "-20%");
test_invalid_value("min-height", "60");
test_invalid_value("min-height", "10px 20%");
test_invalid_value("min-height", "content-box border-box");
test_invalid_value("min-height", "10px border-box 20%");
test_invalid_value("min-height", "content-box 20% border-box");
// The following is not yet rejected by browsers:
test_invalid_value("min-height", "auto");
</script>
</body>
</html>

View file

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS basic box model: parsing min-height with valid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-min-height">
<meta name="assert" content="min-height supports the full grammar '[ [<length> | <percentage>] && [border-box | content-box]? ] | available | min-content | max-content | fit-content'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("min-height", "10px");
test_valid_value("min-height", "20%");
test_valid_value("min-height", "calc(2em + 3ex)");
test_valid_value("min-height", "min-content");
test_valid_value("min-height", "max-content");
test_valid_value("min-height", "fit-content");
// The following are not yet supported by browsers:
// test_valid_value("min-height", "available");
// test_valid_value("min-height", "10px border-box");
// test_valid_value("min-height", "content-box 20%", "20% content-box");
</script>
</body>
</html>

View file

@ -0,0 +1,33 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS basic box model: parsing min-width with invalid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-min-width">
<meta name="assert" content="min-width supports only the grammar '[ [<length> | <percentage>] && [border-box | content-box]? ] | available | min-content | max-content | fit-content'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("min-width", "complex");
test_invalid_value("min-width", "none");
test_invalid_value("min-width", "none available");
test_invalid_value("min-width", "max-content 10px");
test_invalid_value("min-width", "20% available");
test_invalid_value("min-width", "-10px");
test_invalid_value("min-width", "-20%");
test_invalid_value("min-width", "60");
test_invalid_value("min-width", "10px 20%");
test_invalid_value("min-width", "content-box border-box");
test_invalid_value("min-width", "10px border-box 20%");
test_invalid_value("min-width", "content-box 20% border-box");
// The following is not yet rejected by browsers:
test_invalid_value("min-width", "auto");
</script>
</body>
</html>

View file

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS basic box model: parsing min-width with valid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-min-width">
<meta name="assert" content="min-width supports the full grammar '[ [<length> | <percentage>] && [border-box | content-box]? ] | available | min-content | max-content | fit-content'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("min-width", "10px");
test_valid_value("min-width", "20%");
test_valid_value("min-width", "calc(2em + 3ex)");
test_valid_value("min-width", "min-content");
test_valid_value("min-width", "max-content");
test_valid_value("min-width", "fit-content");
// The following are not yet supported by browsers:
// test_valid_value("min-width", "available");
// test_valid_value("min-width", "10px border-box");
// test_valid_value("min-width", "content-box 20%", "20% content-box");
</script>
</body>
</html>

View file

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS basic box model: parsing overflow with invalid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-overflow">
<meta name="assert" content="overflow supports only the grammar '[ visible | hidden | scroll | auto | no-display | no-content ]{1,2}'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("overflow", "none");
test_invalid_value("overflow", "visible hidden scroll");
test_invalid_value("overflow", "no-display, no-content");
test_invalid_value("overflow-x", "none");
test_invalid_value("overflow-y", "visible hidden");
test_invalid_value("overflow-y", "no-display, no-content");
</script>
</body>
</html>

View file

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS basic box model: parsing overflow with valid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-overflow">
<meta name="assert" content="overflow supports the full grammar '[ visible | hidden | scroll | auto | no-display | no-content ]{1,2}'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("overflow", "visible");
test_valid_value("overflow", "hidden");
test_valid_value("overflow", "scroll");
test_valid_value("overflow", "auto");
test_valid_value("overflow-x", "visible");
test_valid_value("overflow-x", "hidden");
test_valid_value("overflow-x", "scroll");
test_valid_value("overflow-y", "auto");
// The following are not yet supported by browsers:
// test_valid_value("overflow", "no-display");
// test_valid_value("overflow", "no-content");
// test_valid_value("overflow", "visible hidden");
// test_valid_value("overflow", "auto scroll");
// test_valid_value("overflow", "no-display no-content");
// test_valid_value("overflow-y", "no-display");
// test_valid_value("overflow-y", "no-content");
</script>
</body>
</html>

View file

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS basic box model: parsing padding with invalid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-padding">
<meta name="assert" content="padding supports only the grammar '<length>{1,4}'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("padding", "auto");
test_invalid_value("padding", "available");
test_invalid_value("padding", "10px border-box");
test_invalid_value("padding", "calc(2em + 3ex) auto");
test_invalid_value("padding", "10px 20px 30px 40px 50px");
test_invalid_value("padding-top", "auto");
test_invalid_value("padding-bottom", "10px 20px calc(2em + 3ex) auto");
test_invalid_value("padding-bottom-left", "10px 20px");
test_invalid_value("padding-top", "-10px");
// The following are not yet rejected by browsers:
test_invalid_value("padding", "20%");
test_invalid_value("padding", "10px 20% 30% 40px");
test_invalid_value("padding-right", "20%");
test_invalid_value("padding-right", "calc(2em + 3%)");
</script>
</body>
</html>

View file

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS basic box model: parsing padding with valid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-padding">
<meta name="assert" content="padding supports the full grammar '<length>{1,4}'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("padding", "10px");
test_valid_value("padding", "10px 20px 30px 40px");
test_valid_value("padding", "calc(2em + 3ex)");
test_valid_value("padding-top", "10px");
test_valid_value("padding-right", "20px");
test_valid_value("padding-bottom", "30px");
test_valid_value("padding-left", "40px");
</script>
</body>
</html>

View file

@ -0,0 +1,39 @@
'use strict';
// serializedValue can be the expected serialization of value,
// or an array of permitted serializations,
// or omitted if value should serialize as value.
function test_valid_value(property, value, serializedValue) {
if (arguments.length < 3)
serializedValue = value;
var stringifiedValue = JSON.stringify(value);
test(function(){
var div = document.createElement('div');
div.style[property] = value;
assert_not_equals(div.style.getPropertyValue(property), "", "property should be set");
var div = document.createElement('div');
div.style[property] = value;
var readValue = div.style.getPropertyValue(property);
if (serializedValue instanceof Array)
assert_in_array(readValue, serializedValue, "serialization should be sound");
else
assert_equals(readValue, serializedValue, "serialization should be canonical");
div.style[property] = readValue;
assert_equals(div.style.getPropertyValue(property), readValue, "serialization should round-trip");
}, "e.style['" + property + "'] = " + stringifiedValue + " should set the property value");
}
function test_invalid_value(property, value) {
var stringifiedValue = JSON.stringify(value);
test(function(){
var div = document.createElement('div');
div.style[property] = value;
assert_equals(div.style.getPropertyValue(property), "");
}, "e.style['" + property + "'] = " + stringifiedValue + " should not set the property value");
}

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS basic box model: parsing visibility with invalid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-visibility">
<meta name="assert" content="visibility supports only the grammar 'visible | hidden | collapse'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("visibility", "auto");
test_invalid_value("visibility", "hidden collapse");
</script>
</body>
</html>

View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS basic box model: parsing visibility with valid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-visibility">
<meta name="assert" content="visibility supports the full grammar 'visible | hidden | collapse'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("visibility", "visible");
test_valid_value("visibility", "hidden");
test_valid_value("visibility", "collapse");
</script>
</body>
</html>

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS basic box model: parsing width with invalid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-width">
<meta name="assert" content="width supports only the grammar '[<length> | <percentage>] | available | min-content | max-content | fit-content | auto'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("width", "complex");
test_invalid_value("width", "none");
test_invalid_value("width", "min-content available");
test_invalid_value("width", "max-content 10px");
test_invalid_value("width", "20% available");
test_invalid_value("width", "-10px");
test_invalid_value("width", "-20%");
test_invalid_value("width", "60");
test_invalid_value("width", "10px 20%");
test_invalid_value("width", "10px border-box");
test_invalid_value("width", "content-box 20%");
</script>
</body>
</html>

View file

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS basic box model: parsing width with valid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-width">
<meta name="assert" content="width supports the full grammar '[<length> | <percentage>] | available | min-content | max-content | fit-content | auto'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("width", "auto");
test_valid_value("width", "10px");
test_valid_value("width", "20%");
test_valid_value("width", "calc(2em + 3ex)");
test_valid_value("width", "min-content");
test_valid_value("width", "max-content");
test_valid_value("width", "fit-content");
// The following is not yet supported by browsers:
// test_valid_value("width", "available");
</script>
</body>
</html>

View file

@ -0,0 +1,34 @@
<!doctype html>
<title>all: initial on unknown XML tree</title>
<link rel=help href=https://www.w3.org/TR/css-cascade-3/#all-shorthand>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<script>
const iframe = document.createElement("iframe");
const setup_test = async_test("setup");
iframe.onload = setup_test.step_func_done(function() {
const root = iframe.contentDocument.documentElement;
// we need the empty stylesheet to avoid default XSLT views of the XML
const style = iframe.contentDocument.createElementNS("http://www.w3.org/1999/xhtml", "style");
root.appendChild(style);
const cs = iframe.contentWindow.getComputedStyle(root);
let actual_initial = Object.create(null);
for (let i = 0; i < cs.length; i++) {
let prop_name = cs[i];
actual_initial[prop_name] = cs[prop_name];
}
test(() => {
style.textContent = ":root { color: blue }";
assert_equals(cs["color"], "rgb(0, 0, 255)");
}, "stylesheet takes effect");
style.textContent = ":root { all: initial; direction: initial; unicode-bidi: initial; } style { display: none; }";
for (let prop_name in actual_initial) {
test(() => {
assert_equals(cs[prop_name], actual_initial[prop_name]);
}, prop_name);
}
});
iframe.src = URL.createObjectURL(new Blob(["<foo/>"], { type: "application/xml" }));
document.body.appendChild(iframe);
</script>

View file

@ -14,4 +14,4 @@ img {
</style>
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<img src="/css/support/60x60-red.png" />
<img src="/css/support/60x60-red.png" alt="Image download support must be enabled" />

View file

@ -9,7 +9,11 @@ rtc {
display: ruby-text-container;
font-size: 1rem;
}
rtc::after {
content: "PASS";
position: absolute;
}
</style>
<p>This test passes if you can see the word PASS below.
<div><ruby><rtc>PASS</rtc></ruby></div>
<div><ruby><rtc></rtc></ruby></div>

View file

@ -0,0 +1,3 @@
suggested_reviewers:
- rebeccahughes
- lilles

View file

@ -12,6 +12,8 @@
</head>
<body>
<script>
test_invalid_value("background-image", "radial-gradient(at top 0px, red, blue)");
// The following were supported in an earlier version of the spec.
// https://github.com/w3c/csswg-drafts/issues/2140
// Deprecated in Blink with support to be removed in M68, around July 2018.

View file

@ -0,0 +1,15 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>CSS Logical Properties: Flow-Relative Border Shorthands</title>
<link rel="author" title="Oriol Brufau" href="mailto:obrufau@igalia.com" />
<link rel="help" href="https://drafts.csswg.org/css-logical/#border-shorthands">
<meta name="assert" content="This test checks the interaction of the flow-relative border-* shorthand properties with the physical ones in different writing modes." />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script src="./resources/test-box-properties.js"></script>
<script>
runTests(createBoxPropertyGroup("border-*", {type: ["length", "border-style", "color"]}));
</script>

View file

@ -90,14 +90,14 @@
* }, logical: {
* inlineStart: "margin-inline-start", inlineEnd: "margin-inline-end",
* blockStart: "margin-block-start", blockEnd: "margin-block-end",
* }, type: "length", prerequisites: "...", property: "'margin-*'" }
* }, type: ["length"], prerequisites: "...", property: "'margin-*'" }
*
* @param {string} property
* A string representing the property names, like "margin-*".
* @param {Object} descriptor
* @param {string} descriptor.type
* @param {string|string[]} descriptor.type
* Describes the kind of values accepted by the property, like "length".
* Must be a key from the `testValues` object.
* Must be a key or a collection of keys from the `testValues` object.
* @param {Object={}} descriptor.prerequisites
* Represents property declarations that are needed by `property` to work.
* For example, border-width properties require a border style.
@ -115,7 +115,8 @@
physical[physicalSide] = isInset ? physicalSide : property.replace("*", physicalSide);
prerequisites += makeDeclaration(descriptor.prerequisites, physicalSide);
}
return {name, logical, physical, type: descriptor.type, prerequisites, property};
const type = [].concat(descriptor.type);
return {name, logical, physical, type, prerequisites, property};
};
/**
@ -134,7 +135,7 @@
horizontal: `${prefix}width`,
vertical: `${prefix}height`,
},
type: "length",
type: ["length"],
prerequisites: makeDeclaration({display: "block"}),
property: (prefix ? prefix.slice(0, -1) + " " : "") + "sizing",
};
@ -147,7 +148,9 @@
* An object returned by createBoxPropertyGroup or createSizingPropertyGroup.
*/
exports.runTests = function(group) {
const values = testValues[group.type];
const values = testValues[group.type[0]].map(function(_, i) {
return group.type.map(type => testValues[type][i]).join(" ");
});
const logicals = Object.values(group.logical);
const physicals = Object.values(group.physical);
@ -158,8 +161,8 @@
expected.push([logicalProp, values[i]]);
}
testCSSValues("logical properties in inline style", testElement.style, expected);
testElement.style.cssText = "";
}, `Test that logical ${group.property} properties are supported.`);
testElement.style.cssText = "";
for (const writingMode of writingModes) {
for (const style of writingMode.styles) {

View file

@ -0,0 +1,153 @@
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-scroll-snap-1" />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
div {
position: absolute;
}
.scroller-x {
overflow: scroll;
scroll-snap-type: x mandatory;
width: 500px;
height: 500px;
}
.scroller-y {
overflow: scroll;
scroll-snap-type: y mandatory;
width: 500px;
height: 500px;
}
.space {
width: 4000px;
height: 4000px;
}
.target {
scroll-snap-align: start;
}
.large-x {
width: 3000px;
height: 400px;
background-color: yellow;
}
.large-y {
width: 400px;
height: 2000px;
background-color: green;
}
.small {
height: 200px;
width: 200px;
background-color: black;
}
</style>
<div class="scroller-x" id="one-target">
<div id="space"></div>
<div class="large-x target" id="single" style="left: 200px;"></div>
</div>
<div class="scroller-x" id="x">
<div class="space"></div>
<div style="left: 200px;">
<div class="target large-x"></div>
<div class="target small" style="left: 200px"></div>
<div class="target small" style="left: 600px"></div>
<div class="target small" style="left: 1200px"></div>
</div>
</div>
<div class="scroller-y" id="y">
<div class="space"></div>
<div style="top: 200px;">
<div class="target large-y"></div>
<div class="target small" style="top: 200px"></div>
<div class="target small" style="top: 600px"></div>
<div class="target small" style="top: 1200px"></div>
</div>
</div>
<div class="scroller-x" id="two-axes" style="scroll-snap-type: both mandatory">
<div class="space"></div>
<div class="target large-x" style="top: 200px"></div>
</div>
<script>
var one_target_scroller = document.getElementById("one-target");
var scroller_x = document.getElementById("x");
var scroller_y = document.getElementById("y");
var two_axes_scroller = document.getElementById("two-axes");
test(() => {
one_target_scroller.scrollTo(10, 0);
assert_equals(one_target_scroller.scrollLeft, 200);
assert_equals(one_target_scroller.scrollTop, 0);
}, "Snaps to the snap position if the snap area doesn't cover the snapport on x.");
test(() => {
var right_align = 3200 - one_target_scroller.clientWidth;
one_target_scroller.scrollTo(right_align, 0);
assert_equals(one_target_scroller.scrollLeft, right_align);
assert_equals(one_target_scroller.scrollTop, 0);
}, "Snaps to the snap position if the snap area covers the snapport on x on the right border.");
// We use end alignment for this test so that we don't fall on a snap
// position when the snap area just covers the snapport on the left border.
test(() => {
document.getElementById("single").style.scrollSnapAlign = 'end';
one_target_scroller.scrollTo(200, 0);
assert_equals(one_target_scroller.scrollLeft, 200);
assert_equals(one_target_scroller.scrollTop, 0);
}, "Snaps to the snap position if the snap area covers the snapport on x on the left border.");
test(() => {
scroller_x.scrollTo(500, 0);
assert_equals(scroller_x.scrollLeft, 400);
assert_equals(scroller_x.scrollTop, 0);
}, "Snaps if the distance between the previous(400) and next(800) " +
"snap positions is smaller than snapport(500) on x.");
test(() => {
scroller_y.scrollTo(0, 500);
assert_equals(scroller_y.scrollLeft, 0);
assert_equals(scroller_y.scrollTop, 400);
}, "Snaps if the distance between the previous(400) and next(800) " +
"snap positions is smaller than snapport(500) on y.");
test(() => {
scroller_x.scrollTo(900, 0);
assert_equals(scroller_x.scrollLeft, 900);
assert_equals(scroller_x.scrollTop, 0);
}, "Snap to current scroll position which is a valid snap position, " +
"as the snap area covers snapport on x and the distance between the " +
"previous(800) and next(1400) is larger than snapport(500).");
test(() => {
scroller_y.scrollTo(0, 900);
assert_equals(scroller_y.scrollLeft, 0);
assert_equals(scroller_y.scrollTop, 900);
}, "Snap to current scroll position which is a valid snap position, " +
"as the snap area covers snapport on y and the distance between the " +
"previous(800) and next(1400) is larger than snapport(500).");
test(() => {
scroller_x.scrollTo(1500, 0);
assert_equals(scroller_x.scrollLeft, 1500);
assert_equals(scroller_x.scrollTop, 0);
}, "Snap to current scroll position which is a valid snap position, as the " +
"snap area covers snapport on x and there is no subsequent snap positions.");
test(() => {
scroller_y.scrollTo(0, 1500);
assert_equals(scroller_y.scrollLeft, 0);
assert_equals(scroller_y.scrollTop, 1500);
}, "Snap to current scroll position which is a valid snap position, as the " +
"snap area covers snapport on y and there is no subsequent snap positions.");
test(() => {
two_axes_scroller.scrollTo(10, 100);
assert_equals(two_axes_scroller.scrollLeft, 10);
assert_equals(two_axes_scroller.scrollTop, 200);
}, "Snap to current scroll position on x as the area is covering x axis." +
"However, we snap to the specified snap position on y as the area is not " +
"covering y axis.");
</script>

View file

@ -8,41 +8,55 @@ body {
overflow: scroll;
scroll-snap-type: both mandatory;
}
div {
position: absolute;
}
.scroller {
overflow: scroll;
scroll-snap-type: both mandatory;
}
#div-scroller {
#inner-scroller {
top: 3000px;
width: 800px;
height: 800px;
}
.content {
.space {
left: 0px;
top: 0px;
width: 2100px;
height: 2100px;
}
.target {
width: 1000px;
height: 1000px;
width: 600px;
height: 600px;
scroll-snap-align: start;
float: left;
}
.left {
left: 0px;
}
.right {
left: 1000px;
}
.top {
top: 0px;
}
.bottom {
top: 1000px;
}
</style>
<body class="scroller">
<div class="content" id="content">
<div class="target"></div>
<div class="target"></div>
<div class="target"></div>
<div class="target"></div>
</div>
<div class="scroller" id="div-scroller">
<div class="content">
<div class="target"></div>
<div class="target"></div>
<div class="target"></div>
<div class="target"></div>
</div>
<div class="space"></div>
<div class="target left top"></div>
<div class="target right top"></div>
<div class="target left bottom"></div>
<div class="target right bottom"></div>
<div class="scroller" id="inner-scroller">
<div class="space"></div>
<div class="target left top"></div>
<div class="target right top"></div>
<div class="target left bottom"></div>
<div class="target right bottom"></div>
</div>
</body>
@ -55,7 +69,7 @@ function format_dict(dict) {
return `{${props.join(', ')}}`;
}
var divScroller = document.getElementById("div-scroller");
var divScroller = document.getElementById("inner-scroller");
var viewport = document.scrollingElement;
[
[{left: 800}, 1000, 0],
@ -140,6 +154,4 @@ var viewport = document.scrollingElement;
assert_equals(window.scrollY, expectedY);
}, `scrollBy(${format_dict(input)}) on window lands on (${expectedX}, ${expectedY})`);
});
document.body.removeChild(document.getElementById("content"));
</script>

View file

@ -0,0 +1,44 @@
<!DOCTYPE html>
<title>CSS Text: A sequence of collapsible spaces at the end of a line is removed</title>
<link rel='help' href='https://drafts.csswg.org/css-text-3/#white-space-phase-2'>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
#container > div {
display: inline-block;
-font-family: Ahem;
font-size: 10px;
}
</style>
<body>
<div id=log></div>
<div id=container>
<div>1111</div>
<div>1111 </div>
<div> 1111</div>
<div> 1111 </div>
<div>1111<br></div>
<div>1111<br> </div>
<div>1111 <br></div>
<div>1111 <br> </div>
</div>
<script>
(function () {
const epsilon = 1;
let elements = Array.from(container.children);
let reference = elements[0];
let reference_width = reference.offsetWidth;
for (let element of elements) {
test(() => {
assert_approx_equals(element.offsetWidth, reference_width, epsilon);
}, escapeSpaces(element.innerHTML));
}
})();
function escapeSpaces(text) {
return text
.replace(/ /g, '&#x20;')
.replace(/\n/g, '&#x0A;')
}
</script>
</body>

View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Transform Module Level 1: parsing transform-box with invalid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-transforms/#transform-box-property">
<meta name="assert" content="transform-box supports only the grammar 'content-box | border-box | fill-box | stroke-box | view-box'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("transform-box", "margin-box");
test_invalid_value("transform-box", "padding-box");
test_invalid_value("transform-box", "fill-box view-box");
</script>
</body>
</html>

View file

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Transform Module Level 1: parsing transform-box with valid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-transforms/#transform-box-property">
<meta name="assert" content="transform-box supports the full grammar 'content-box | border-box | fill-box | stroke-box | view-box'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("transform-box", "content-box");
test_valid_value("transform-box", "border-box");
test_valid_value("transform-box", "fill-box");
test_valid_value("transform-box", "stroke-box");
test_valid_value("transform-box", "view-box");
</script>
</body>
</html>

View file

@ -0,0 +1,45 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Transform Module Level 2: parsing transform with invalid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-transforms-2/#transform-property">
<meta name="assert" content="transform supports only the grammar 'none | <transform-list>'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("transform", "none scale(2)");
test_invalid_value("transform", "translateX(3%) none");
test_invalid_value("transform", "matrix(1, 2)");
test_invalid_value("transform", "translate(1px, 2px, 3px)");
test_invalid_value("transform", "translateX(-4px, 5px)");
test_invalid_value("transform", "translateY(4%, 5%)");
test_invalid_value("transform", "scale(6, 7, 8)");
test_invalid_value("transform", "scaleX(1, 2)");
test_invalid_value("transform", "scaleY(3, 4)");
test_invalid_value("transform", "rotate(0, 0)");
test_invalid_value("transform", "rotate(0, 0, 0)");
test_invalid_value("transform", "rotate(0, 0, 0, 0)");
test_invalid_value("transform", "skew(0, 0, 0)");
test_invalid_value("transform", "skewX(0, 0)");
test_invalid_value("transform", "skewY(0, 0)");
test_invalid_value("transform", "scaleX(2), scaleY(3)");
</script>
</body>
</html>

View file

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Transform Module Level 1: parsing transform-origin with invalid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-transforms/#transform-origin-property">
<meta name="assert" content="transform-origin supports only the grammar from spec.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("transform-origin", "1px 2px 3%");
test_invalid_value("transform-origin", "1px 2px left");
test_invalid_value("transform-origin", "1px 2px 3px 4px");
test_invalid_value("transform-origin", "1px left");
test_invalid_value("transform-origin", "top 1px"); // Blink fails.
test_invalid_value("transform-origin", "right left");
test_invalid_value("transform-origin", "top bottom");
</script>
</body>
</html>

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