diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/html-imports/fetching | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/html-imports/fetching')
6 files changed, 110 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html-imports/fetching/already-in-import-map.html b/testing/web-platform/tests/html-imports/fetching/already-in-import-map.html new file mode 100644 index 000000000..a5b006500 --- /dev/null +++ b/testing/web-platform/tests/html-imports/fetching/already-in-import-map.html @@ -0,0 +1,26 @@ +<!DOCTYPE html> +<html> +<head> +<title>Fetching import</title> +<link rel="help" href="http://w3c.github.io/webcomponents/spec/imports/#fetching-import"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + +<link id="first" rel="import" href="resources/hello.html"> +<link id="shouldBeInImportMap" rel="import" href="resources/hello.html"> +<link id="parentOfFirst" rel="import" href="resources/parent-of-hello.html"> + +</head> +<body> +<div id="log"></div> +<script> +test(function() { + assert_true(window.first.import === window.shouldBeInImportMap.import); +}, 'If LOCATION is already in the import map, let IMPORT be the imported document for LOCATION and stop. (1)'); + +test(function() { + assert_true(window.first.import === window.parentOfFirst.import.getElementById('child').import); +}, 'If LOCATION is already in the import map, let IMPORT be the imported document for LOCATION and stop. (2)'); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/html-imports/fetching/loading-attempt.html b/testing/web-platform/tests/html-imports/fetching/loading-attempt.html new file mode 100644 index 000000000..7c1b442b1 --- /dev/null +++ b/testing/web-platform/tests/html-imports/fetching/loading-attempt.html @@ -0,0 +1,76 @@ +<!DOCTYPE html> +<html> +<head> +<title>Fetching import</title> +<link rel="help" href="http://w3c.github.io/webcomponents/spec/imports/#fetching-import"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + +<script> +var onloadWasCalledOnSuccess = false; +var onerrorWasCalledOnSuccess = false; +function helloLoadHandler() { onloadWasCalledOnSuccess = true; } +function helloErrorHandler() { onerrorWasCalledOnSuccess = true; } + +var onloadWasCalledOnFail = false; +var onerrorWasCalledOnFail = false; +function nosuchLoadHandler() { onloadWasCalledOnFail = true; } +function nosuchErrorHandler() { onerrorWasCalledOnFail = true; } +</script> + +<link rel="import" href="resources/hello.html" onload="helloLoadHandler()" onerror="helloLoadHandler()"> +<link rel="import" href="resources/no-such.html" onload="nosuchLoadHandler()" onerror="nosuchErrorHandler()"> + +<script> +test(function() { + assert_true(onloadWasCalledOnSuccess); + assert_false(onerrorWasCalledOnSuccess); +}, 'The loading attempt must be considered successful if IMPORT is not null on the algorithm completion, and failed otherwise. (1)'); + +test(function() { + assert_false(onloadWasCalledOnFail); + assert_true(onerrorWasCalledOnFail); +}, 'The loading attempt must be considered successful if IMPORT is not null on the algorithm completion, and failed otherwise. (2)'); + +t1 = async_test('The loading attempt must be considered successful if IMPORT is not null on the algorithm completion, and failed otherwise. (3)') +t1.step(function() { + var importElement = document.createElement('link'); + importElement.setAttribute('rel', 'import'); + importElement.setAttribute('href', 'resources/dynamic.html'); + importElement.addEventListener("error", assert_unreached); + importElement.addEventListener("load", function() { + t1.done(); + }); + + document.head.appendChild(importElement); +}); + +var onloadWasCalledOnAsync = false; +var onerrorWasCalledOnAsync = false; +var asyncAttemptDone = function() { assert_unreached(); }; + +function asyncLoadHandler() { + onloadWasCalledOnAsync = true; + asyncAttemptDone(); +} +function asyncErrorHandler() { + onerrorWasCalledOnAsync = true; + asyncAttemptDone(); +} + +t2 = async_test('Every import that is not marked as async delays the load event in the Document.'); +asyncAttemptDone = function() { + t2.step(function() { + assert_true(onloadWasCalledOnAsync); + assert_false(onerrorWasCalledOnAsync); + t2.done(); + }); +}; + +</script> +<link rel="import" href="resources/async.html" onload="asyncLoadHandler()" onerror="asyncErrorHandler()" async> +</head> +<body> +<div id="log"></div> +</body> +</html> diff --git a/testing/web-platform/tests/html-imports/fetching/resources/async.html b/testing/web-platform/tests/html-imports/fetching/resources/async.html new file mode 100644 index 000000000..18de08618 --- /dev/null +++ b/testing/web-platform/tests/html-imports/fetching/resources/async.html @@ -0,0 +1,2 @@ +<!DOCTYPE html> +<body>Async</body> diff --git a/testing/web-platform/tests/html-imports/fetching/resources/dynamic.html b/testing/web-platform/tests/html-imports/fetching/resources/dynamic.html new file mode 100644 index 000000000..bf17a13ba --- /dev/null +++ b/testing/web-platform/tests/html-imports/fetching/resources/dynamic.html @@ -0,0 +1,2 @@ +<!DOCTYPE html> +<body>Dyamic</body> diff --git a/testing/web-platform/tests/html-imports/fetching/resources/hello.html b/testing/web-platform/tests/html-imports/fetching/resources/hello.html new file mode 100644 index 000000000..949f6c66a --- /dev/null +++ b/testing/web-platform/tests/html-imports/fetching/resources/hello.html @@ -0,0 +1,2 @@ +<!DOCTYPE html> +<body>Hello</body> diff --git a/testing/web-platform/tests/html-imports/fetching/resources/parent-of-hello.html b/testing/web-platform/tests/html-imports/fetching/resources/parent-of-hello.html new file mode 100644 index 000000000..195e37add --- /dev/null +++ b/testing/web-platform/tests/html-imports/fetching/resources/parent-of-hello.html @@ -0,0 +1,2 @@ +<!DOCTYPE html> +<link id="child" rel="import" href="hello.html"> |