https://github.com/web-platform-tests/wpt
Raw File
Tip revision: fde5297e01bba6c17ed7a80b606fa0e26e6c2c29 authored by Hallvord R. M. Steen on 01 April 2014, 12:49:35 UTC
minor bugfixes
Tip revision: fde5297
loading-import.html
<!DOCTYPE html>.
<html>
<head>  
<title>HTML Imports</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="author" title="Hajime Morrita" href="mailto:morrita@google.com">
<link rel="help" href="https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/imports/index.html#loading-imports">
<link id="linkImport1" rel="import" href="resources/hello.html">
<link id="linkImport2" rel="import" href="resources/hello.html">
<link id="linkToTypicalHtml" rel="import" href="resources/typical.html">
<link id="linkIncludingSubImport" rel="import" href="resources/sub-parent.html">
</head>
<body>
<div id="log">Running test...</div>
<script>

test(function() {
  var linkImport1 = document.getElementById("linkImport1");
  var linkImport2 = document.getElementById("linkImport2");
  assert_equals(linkImport1.import, linkImport2.import);
  assert_true(linkImport1.import != null);
}, 
"Check on sharing imports. Imports in same location should be represented as same object."
);

test(function() {
  var link = document.getElementById("linkToTypicalHtml");
  assert_equals(link.import.querySelector("p2").parentNode, 
                link.import.querySelector("parent"));
}, 
"Check on HTML Parsing. An HTML parser should be used to parse the import."
);

test(function() {
  var parent = document.getElementById("linkIncludingSubImport");
  var child = parent.import.querySelector("link").imports;
  assert_equals(child.title, "Hello");
}, 
"Check on sub-imports. Sub-improts should be loaded as usual imports."
);

</script>
</body>
</html>
back to top