Skip to content

Commit

Permalink
Merge pull request #130 from yutak/shadow-dom/convert-tests
Browse files Browse the repository at this point in the history
shadow-dom: Reorganize the test structure
  • Loading branch information
dglazkov committed Jun 3, 2013
2 parents ee27fe8 + f4cfc73 commit 96e0ce8
Show file tree
Hide file tree
Showing 167 changed files with 5,710 additions and 10,257 deletions.
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
/*
<!DOCTYPE html>
<!--
Distributed under both the W3C Test Suite License [1] and the W3C
3-clause BSD License [2]. To contribute to a W3C Test Suite, see the
policies and contribution forms [3].
[1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
[2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
[3] http://www.w3.org/2004/10/27-testcases
*/

var A_04_01_01 = {
name:'A_04_01_01',
assert:'Upper-boundary encapsulation:' +
'The ownerDocument property of all nodes in shadow tree refers to the document of the shadow host',
link:'http://www.w3.org/TR/shadow-dom/#upper-boundary-encapsulation',
highlight:'The ownerDocument property refers to the document of the shadow host'
};

-->
<html>
<head>
<title>Shadow DOM Test: A_04_01_01</title>
<link rel="author" title="Aleksei Yu. Semenov" href="mailto:sgrekhov@unipro.ru">
<link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
<link rel="author" title="Mikhail Fursov" href="mailto:mfursov@unipro.ru">
<link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#upper-boundary-encapsulation">
<meta name="assert" content="Upper-boundary encapsulation:The ownerDocument property of all nodes in shadow tree refers to the document of the shadow host">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<link rel="stylesheet" href="/resources/testharness.css">
</head>
<body>
<div id="log"></div>
<script>
var A_04_01_01 = new Object();

A_04_01_01.checkOwnerDocument = function (node, expectedOwnerDocument){
assert_equals(node.ownerDocument, expectedOwnerDocument, 'node '+node.nodeName+' ownerDocument is not correct');
Expand All @@ -39,10 +48,7 @@
var s3 = createSR(d.head);
assert_equals(s3.ownerDocument, d, 'Check for d.head node');

}, 'A_04_01_01_T01', PROPS(A_04_01_01, {
author:'Sergey G. Grekhov <sgrekhov@unipro.ru>',
reviewer:'Mikhail Fursov <mfursov@unipro.ru>'
}));
}, 'A_04_01_01_T01');

// shadow host: elements with different depth in the original document
test(function () {
Expand All @@ -64,10 +70,7 @@
var s3 = createSR(e3);
assert_equals(s3.ownerDocument, d, 'Check for a simple element at depth 3: [div.h1.script]');

}, 'A_04_01_01_T02', PROPS(A_04_01_01, {
author:'Mikhail Fursov <mfursov@unipro.ru>',
reviewer:'Sergey G. Grekhov <sgrekhov@unipro.ru>'
}));
}, 'A_04_01_01_T02');


// check that element added to shadow tree automatically gets
Expand All @@ -81,10 +84,7 @@
assert_equals(e.ownerDocument, d, 'the ownerDocument of a node in a shadow tree must refer ' +
'to the document of the shadow host');

}, 'A_04_01_01_T03', PROPS(A_04_01_01, {
author:'Sergey G. Grekhov <sgrekhov@unipro.ru>',
reviewer:'Mikhail Fursov <mfursov@unipro.ru>'
}));
}, 'A_04_01_01_T03');

// shadow tree node: created by different document
test(function () {
Expand All @@ -98,10 +98,7 @@
assert_equals(e.ownerDocument, d1, 'the ownerDocument of an adopted node in a shadow tree ' +
'must refer to the document of the shadow host');

}, 'A_04_01_01_T04', PROPS(A_04_01_01, {
author:'Sergey G. Grekhov <sgrekhov@unipro.ru>',
reviewer:'Mikhail Fursov <mfursov@unipro.ru>'
}));
}, 'A_04_01_01_T04');

// check that all children nodes of shadow root
// get valid owner document when added to shadow tree
Expand All @@ -121,10 +118,7 @@

A_04_01_01.checkOwnerDocument(e1, d1);

}, 'A_04_01_01_T05', PROPS(A_04_01_01, {
author:'Mikhail Fursov <mfursov@unipro.ru>',
reviewer:'Aleksei Yu. Semenov'
}));
}, 'A_04_01_01_T05');

// check that parent element of shadow node still refer to the
// original owner document
Expand All @@ -142,10 +136,7 @@
assert_equals(e1.ownerDocument, d2, 'the ownerDocument of an adopted node parent node in a shadow tree ' +
'must refer to the original document');

}, 'A_04_01_01_T06', PROPS(A_04_01_01, {
author:'Mikhail Fursov <mfursov@unipro.ru>',
reviewer:'Sergey G. Grekhov <sgrekhov@unipro.ru>'
}));
}, 'A_04_01_01_T06');

// shadow tree: any HTML5 element
test(function(){
Expand All @@ -159,7 +150,7 @@
var shadowRoot = createSR(hostElement);
} catch (e) {
// if shadow tree can not be added, can not check the test case.
continue;
continue;
}
var k;
for (k=0; k<HTML5_TAG.length; k++){
Expand All @@ -169,6 +160,7 @@
}
}

}, 'A_04_01_01_T07', PROPS(A_04_01_01, {
author:'Aleksei Yu. Semenov'
}));
}, 'A_04_01_01_T07');
</script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
/*
<!DOCTYPE html>
<!--
Distributed under both the W3C Test Suite License [1] and the W3C
3-clause BSD License [2]. To contribute to a W3C Test Suite, see the
policies and contribution forms [3].
[1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
[2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
[3] http://www.w3.org/2004/10/27-testcases
*/

var A_04_01_02 = {
name:'A_04_01_02',
assert:'Upper-boundary encapsulation: ' +
'The shadow nodes and named shadow elements are not accessible using shadow host\'s ' +
'document DOM tree accessors',
link:'http://www.w3.org/TR/shadow-dom/#upper-boundary-encapsulation',
highlight:'The nodes and named elements are not accessible using shadow host\'s document DOM tree accessors'
};

-->
<html>
<head>
<title>Shadow DOM Test: A_04_01_02</title>
<link rel="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru">
<link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
<link rel="author" title="Mikhail Fursov" href="mailto:mfursov@unipro.ru">
<link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#upper-boundary-encapsulation">
<meta name="assert" content="Upper-boundary encapsulation: The shadow nodes and named shadow elements are not accessible using shadow host's document DOM tree accessors">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<link rel="stylesheet" href="/resources/testharness.css">
</head>
<body>
<div id="log"></div>
<script>
// check that 'body' accessor is not exposed
// when added to shadow tree
test(function () {
Expand All @@ -33,10 +40,7 @@
assert_not_equals(d1.body, d2_body, '"body" in shadow DOM must not be exposed ' +
'via the "document.body" DOM accessor');

}, 'A_04_01_02_T01', PROPS(A_04_01_02, {
author:'Sergey G. Grekhov <sgrekhov@unipro.ru>',
reviewer:'Mikhail Fursov <mfursov@unipro.ru>'
}));
}, 'A_04_01_02_T01');

// check that 'head' accessor is not exposed
// when added to shadow tree
Expand All @@ -57,10 +61,7 @@
assert_equals(d2.title, '', '"title" text in shadow DOM must not be ' +
'exposed via "document.title" DOM accessor');

}, 'A_04_01_02_T02', PROPS(A_04_01_02, {
author:'Sergey G. Grekhov <sgrekhov@unipro.ru>',
reviewer:'Mikhail Fursov <mfursov@unipro.ru>'
}));
}, 'A_04_01_02_T02');

// check that element is not exposed via 'all' accessor
// when added to shadow tree
Expand All @@ -78,10 +79,7 @@
assert_equals(d.all.length, allLengthBefore, 'elements in shadow DOM must not ' +
'be exposed via the "document.all" DOM accessor');

}, 'A_04_01_02_T03', PROPS(A_04_01_02, {
author:'Mikhail Fursov <mfursov@unipro.ru>',
reviewer:'Sergey G. Grekhov <sgrekhov@unipro.ru>'
}));
}, 'A_04_01_02_T03');

// check that element is not exposed via 'anchors' accessor
// when added to shadow tree
Expand All @@ -100,10 +98,7 @@
'"a" elements with "name" attributes in shadow DOM must not ' +
'be exposed via the "document.anchors" DOM accessor');

}, 'A_04_01_02_T04', PROPS(A_04_01_02, {
author:'Mikhail Fursov <mfursov@unipro.ru>',
reviewer:'Sergey G. Grekhov <sgrekhov@unipro.ru>'
}));
}, 'A_04_01_02_T04');

// check that element is not exposed via 'applets' accessor
// when added to shadow tree
Expand All @@ -121,10 +116,7 @@
'be exposed via the "document.applets" DOM accessor');


}, 'A_04_01_02_T05', PROPS(A_04_01_02, {
author:'Mikhail Fursov <mfursov@unipro.ru>',
reviewer:'Sergey G. Grekhov <sgrekhov@unipro.ru>'
}));
}, 'A_04_01_02_T05');

// check that element is not exposed via 'embeds' accessor
// when added to shadow tree
Expand All @@ -140,10 +132,7 @@
assert_equals(d.embeds.length, 0, '"embeds" in shadow DOM must not be exposed via the ' +
'"document.embeds" DOM accessor');

}, 'A_04_01_02_T06', PROPS(A_04_01_02, {
author:'Sergey G. Grekhov <sgrekhov@unipro.ru>',
reviewer:'Mikhail Fursov <mfursov@unipro.ru>'
}));
}, 'A_04_01_02_T06');

// check that element is not exposed via 'forms' accessor
// when added to shadow tree
Expand All @@ -159,10 +148,7 @@
assert_equals(d.forms.length, 0, '"form" elements in shadow DOM must not be exposed via the ' +
'document.forms DOM accessor');

}, 'A_04_01_02_T07', PROPS(A_04_01_02, {
author:'Sergey G. Grekhov <sgrekhov@unipro.ru>',
reviewer:'Mikhail Fursov <mfursov@unipro.ru>'
}));
}, 'A_04_01_02_T07');

// check that element is not exposed via 'images' accessor
// when added to shadow tree
Expand All @@ -178,10 +164,7 @@
assert_equals(d.images.length, 0, '"images" in shadow DOM must not be exposed via the ' +
'"document.images" DOM accessor');

}, 'A_04_01_02_T08', PROPS(A_04_01_02, {
author:'Sergey G. Grekhov <sgrekhov@unipro.ru>',
reviewer:'Mikhail Fursov <mfursov@unipro.ru>'
}));
}, 'A_04_01_02_T08');


// check that 'a' element is not exposed via 'links' accessor
Expand All @@ -200,10 +183,7 @@
'be exposed via the "document.links" DOM accessor');


}, 'A_04_01_02_T09', PROPS(A_04_01_02, {
author:'Sergey G. Grekhov <sgrekhov@unipro.ru>',
reviewer:'Mikhail Fursov <mfursov@unipro.ru>'
}));
}, 'A_04_01_02_T09');

// check that 'area' element is not exposed via 'links' accessor
// when added to shadow tree
Expand All @@ -220,10 +200,7 @@
assert_equals(d.links.length, 0, '"area" elements with href attributes in shadow DOM must ' +
'not be exposed via the "document.links" DOM accessor');

}, 'A_04_01_02_T10', PROPS(A_04_01_02, {
author:'Sergey G. Grekhov <sgrekhov@unipro.ru>',
reviewer:'Mikhail Fursov <mfursov@unipro.ru>'
}));
}, 'A_04_01_02_T10');


// check that element is not exposed via 'scripts' accessor
Expand All @@ -241,10 +218,7 @@
assert_equals(d.scripts.length, 0, '"script" elements in shadow DOM must not be exposed via ' +
'the "document.scripts" DOM accessor');

}, 'A_04_01_02_T11', PROPS(A_04_01_02, {
author:'Sergey G. Grekhov <sgrekhov@unipro.ru>',
reviewer:'Mikhail Fursov <mfursov@unipro.ru>'
}));
}, 'A_04_01_02_T11');


// check that element is not exposed via 'getElementByName' accessor
Expand All @@ -259,10 +233,7 @@
assert_equals(d.getElementsByName('bob').length, 0, 'elements (like "div") in shadow DOM ' +
'must not be exposed via the getElementsByName DOM accessor');

}, 'A_04_01_02_T12_01', PROPS(A_04_01_02, {
author:'Sergey G. Grekhov <sgrekhov@unipro.ru>',
reviewer:'Mikhail Fursov <mfursov@unipro.ru>'
}));
}, 'A_04_01_02_T12_01');


// check that element is not exposed via 'getElementByTagName' accessor
Expand All @@ -281,10 +252,7 @@
assert_equals(d.getElementsByTagName('div').length, 0, 'elements (like "div") in shadow DOM ' +
'must not be exposed via the getElementsByTagName DOM accessor');

}, 'A_04_01_02_T12_02', PROPS(A_04_01_02, {
author:'Mikhail Fursov <mfursov@unipro.ru>',
reviewer:'Sergey G. Grekhov <sgrekhov@unipro.ru>'
}));
}, 'A_04_01_02_T12_02');


// check that element is not exposed via 'getElementByClassName' accessor
Expand All @@ -303,10 +271,7 @@
assert_equals(d.getElementsByClassName('clazz').length, 0, 'elements (like "div") in shadow DOM ' +
'must not be exposed via the getElementsByClassName DOM accessor');

}, 'A_04_01_02_T12_03', PROPS(A_04_01_02, {
author:'Mikhail Fursov <mfursov@unipro.ru>',
reviewer:'Sergey G. Grekhov <sgrekhov@unipro.ru>'
}));
}, 'A_04_01_02_T12_03');

//check that element is not exposed via 'getElementByTagNameNS' accessor
//when added to shadow tree
Expand All @@ -323,6 +288,7 @@
assert_equals(d.getElementsByTagNameNS('http://www.w3c.org/namespace','div').length, 0, 'elements (like "div") in shadow DOM ' +
'must not be exposed via the getElementsByTagNameNS DOM accessor');

}, 'A_04_01_02_T12_04', PROPS(A_04_01_02, {
author:'Aleksei Yu. Semenov <a.semenov@unipro.ru>'
}));
}, 'A_04_01_02_T12_04');
</script>
</body>
</html>
Loading

0 comments on commit 96e0ce8

Please sign in to comment.