Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions tests/microformats-v2-unit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@ Tests adhere to the following design principles. New additions to this test seri

## Setting up the tests

Test set-up is the same as for the other test sets, with the exception that the base URL is `http://example.test`. Partial parser implementations may wish to execute tests in a particular orderto test basic features before more complex ones:
Test set-up is the same as for the other test sets, with the exception that the base URL is `http://example.test`. Partial parser implementations may wish to execute tests in a particular order to test basic features before more complex ones:

1. Microformat tests in `names`
2. Property tests in `names`
3. Tests in `properties`
4. Tests in `implied`
5. Tests in `value`
6. Tests in `nested`
6. Tests in `value-title`
7. Tests in `value-date`
8. Tests in `id`
9. Tests in `text`
10. Tests in `nested`
17 changes: 17 additions & 0 deletions tests/microformats-v2-unit/id/id.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<div class="h-test-with-id" id="Valid">
<div class="p-name">NotPartOfTest</div>
</div>

<div id="Invalid">
<div class="h-test-without-id">
<div class="p-name">NotPartOfTest</div>
</div>
</div>

<div class="h-test-not-properties">
<div class="p-name">NotPartOfTest</div>
<div class="p-not-id-p" id="p">P</div>
<div class="u-not-id-u" id="u">http://example.test/U</div>
<div class="dt-not-id-dt" id="dt">Dt</div>
<div class="e-not-id-e" id="e">E</div>
</div>
52 changes: 52 additions & 0 deletions tests/microformats-v2-unit/id/id.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"items": [
{
"type": [
"h-test-with-id"
],
"properties": {
"name": [
"NotPartOfTest"
]
},
"id": "Valid"
},
{
"type": [
"h-test-without-id"
],
"properties": {
"name": [
"NotPartOfTest"
]
}
},
{
"type": [
"h-test-not-properties"
],
"properties": {
"name": [
"NotPartOfTest"
],
"not-id-p": [
"P"
],
"not-id-u": [
"http://example.test/U"
],
"not-id-dt": [
"Dt"
],
"not-id-e": [
{
"html": "E",
"value": "E"
}
]
}
}
],
"rels": {},
"rel-urls": {}
}
8 changes: 8 additions & 0 deletions tests/microformats-v2-unit/nested/nested-id.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<div class="h-test" id="root">
<div class="h-test-child" id="child">
<div class="p-name">NotPartOfTest</div>
</div>
<div class="h-test-p p-test-p" id="p"><div class="p-name">P</div></div>
<div class="h-test-u u-test-u" id="u"><div class="p-name">http://example.test/U</div></div>
<div class="h-test-dt dt-test-dt" id="dt"><div class="p-name">Dt</div></div>
</div>
69 changes: 69 additions & 0 deletions tests/microformats-v2-unit/nested/nested-id.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"items": [
{
"type": [
"h-test"
],
"properties": {
"test-p": [
{
"value": "P",
"type": [
"h-test-p"
],
"properties": {
"name": [
"P"
]
},
"id": "p"
}
],
"test-u": [
{
"value": "http://example.test/U",
"type": [
"h-test-u"
],
"properties": {
"name": [
"http://example.test/U"
]
},
"id": "u"
}
],
"test-dt": [
{
"value": "Dt",
"type": [
"h-test-dt"
],
"properties": {
"name": [
"Dt"
]
},
"id": "dt"
}
]
},
"id": "root",
"children": [
{
"type": [
"h-test-child"
],
"properties": {
"name": [
"NotPartOfTest"
]
},
"id": "child"
}
]
}
],
"rels": {},
"rel-urls": {}
}
8 changes: 8 additions & 0 deletions tests/microformats-v2-unit/nested/nested-property.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<!--
This tests that nested properties are processed, and in the correct order.
-->

<div class="h-test-tree-order">
<div class="p-one">One <span class="p-two">Two <span class="p-three">Three</span> <span class="p-four">Four</span></span></div>
<div class="p-five">Five</div>
</div>
28 changes: 28 additions & 0 deletions tests/microformats-v2-unit/nested/nested-property.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"items": [
{
"type": [
"h-test-tree-order"
],
"properties": {
"one": [
"One Two Three Four"
],
"two": [
"Two Three Four"
],
"three": [
"Three"
],
"four": [
"Four"
],
"five": [
"Five"
]
}
}
],
"rels": {},
"rel-urls": {}
}
7 changes: 7 additions & 0 deletions tests/microformats-v2-unit/nested/tentative-nested-id.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!--
See https://github.com/microformats/microformats2-parsing/issues/51
All parsers except Rust have the same behaviour here
-->
<div class="h-test" id="root">
<div class="h-test-e e-test-e" id="e"><div class="p-name">E</div></div>
</div>
29 changes: 29 additions & 0 deletions tests/microformats-v2-unit/nested/tentative-nested-id.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"items": [
{
"type": [
"h-test"
],
"properties": {
"test-e": [
{
"html": "<div class=\"p-name\">E</div>",
"value": "E",
"type": [
"h-test-e"
],
"properties": {
"name": [
"E"
]
},
"id": "e"
}
]
},
"id": "root"
}
],
"rels": {},
"rel-urls": {}
}
31 changes: 31 additions & 0 deletions tests/microformats-v2-unit/text/tentative-text-basic.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

<!-- There is some uncertainty as to how and how much URLs should be normalized, so this test is segregated -->
<div class="h-test-whitespace-u">
<div class="p-name">NotPartOfTest</div>
<div class="u-ascii"> &#x9;&#xC;&#xD; http://example.test/DoTrim &#xD;&#xC;&#x9; </div>
<div class="u-1-unicode">&#xB;NoTrim&#xB;</div>
<div class="u-2-unicode">&#x85;NoTrim&#x85;</div>
<div class="u-3-unicode">&#xA0;NoTrim&#xA0;</div>
<div class="u-4-unicode">&#x1680;NoTrim&#x1680;</div>
<div class="u-5-unicode">&#x2000;NoTrim&#x2000;</div>
<div class="u-6-unicode">&#x2001;NoTrim&#x2001;</div>
<div class="u-7-unicode">&#x2002;NoTrim&#x2002;</div>
<div class="u-8-unicode">&#x2003;NoTrim&#x2003;</div>
<div class="u-9-unicode">&#x2004;NoTrim&#x2004;</div>
<div class="u-10-unicode">&#x2005;NoTrim&#x2005;</div>
<div class="u-11-unicode">&#x2006;NoTrim&#x2006;</div>
<div class="u-12-unicode">&#x2007;NoTrim&#x2007;</div>
<div class="u-13-unicode">&#x2008;NoTrim&#x2008;</div>
<div class="u-14-unicode">&#x2009;NoTrim&#x2009;</div>
<div class="u-15-unicode">&#x200A;NoTrim&#x200A;</div>
<div class="u-16-unicode">&#x2028;NoTrim&#x2028;</div>
<div class="u-17-unicode">&#x2029;NoTrim&#x2029;</div>
<div class="u-18-unicode">&#x202F;NoTrim&#x202F;</div>
<div class="u-19-unicode">&#x205F;NoTrim&#x205F;</div>
<div class="u-20-unicode">&#x3000;NoTrim&#x3000;</div>
</div>

<div class="h-test-inner-whitespace">
<div class="p-name">NotPartOfTest</div>
<div class="u-u">A &#x9;&#x9;&#xA;&#xA;&#xC;&#xC;&#xD;&#xD;A</div>
</div>
92 changes: 92 additions & 0 deletions tests/microformats-v2-unit/text/tentative-text-basic.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
"items": [
{
"type": [
"h-test-whitespace-u"
],
"properties": {
"name": [
"NotPartOfTest"
],
"ascii": [
"http://example.test/DoTrim"
],
"1-unicode": [
"http://example.test/NoTrim"
],
"2-unicode": [
"http://example.test/%E2%80%A6NoTrim%E2%80%A6"
],
"3-unicode": [
"http://example.test/%C2%A0NoTrim%C2%A0"
],
"4-unicode": [
"http://example.test/%E1%9A%80NoTrim%E1%9A%80"
],
"5-unicode": [
"http://example.test/%E2%80%80NoTrim%E2%80%80"
],
"6-unicode": [
"http://example.test/%E2%80%81NoTrim%E2%80%81"
],
"7-unicode": [
"http://example.test/%E2%80%82NoTrim%E2%80%82"
],
"8-unicode": [
"http://example.test/%E2%80%83NoTrim%E2%80%83"
],
"9-unicode": [
"http://example.test/%E2%80%84NoTrim%E2%80%84"
],
"10-unicode": [
"http://example.test/%E2%80%85NoTrim%E2%80%85"
],
"11-unicode": [
"http://example.test/%E2%80%86NoTrim%E2%80%86"
],
"12-unicode": [
"http://example.test/%E2%80%87NoTrim%E2%80%87"
],
"13-unicode": [
"http://example.test/%E2%80%88NoTrim%E2%80%88"
],
"14-unicode": [
"http://example.test/%E2%80%89NoTrim%E2%80%89"
],
"15-unicode": [
"http://example.test/%E2%80%8ANoTrim%E2%80%8A"
],
"16-unicode": [
"http://example.test/%E2%80%A8NoTrim%E2%80%A8"
],
"17-unicode": [
"http://example.test/%E2%80%A9NoTrim%E2%80%A9"
],
"18-unicode": [
"http://example.test/%E2%80%AFNoTrim%E2%80%AF"
],
"19-unicode": [
"http://example.test/%E2%81%9FNoTrim%E2%81%9F"
],
"20-unicode": [
"http://example.test/%E3%80%80NoTrim%E3%80%80"
]
}
},
{
"type": [
"h-test-inner-whitespace"
],
"properties": {
"name": [
"NotPartOfTest"
],
"u": [
"http://example.test/A%20%20%0C%0CA"
]
}
}
],
"rels": {},
"rel-urls": {}
}
Loading