microformats / tests

Microformats test suite

Home Page:http://microformats.org/wiki/microformats2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No test with nested IDs.

Zegnat opened this issue · comments

Just a drive-by issue while I am doing work on a microformats2 JSON schema. There was a problem with my schema that was not caught by any JSON files in the test suite:

<div id="a" class="h-a"><div id="b" class="p-z h-b"></div><div id="c" class="h-c"></div></div>
{
  "rels": {},
  "rel-urls": {},
  "items": [
    {
      "type": [
        "h-a"
      ],
      "properties": {
        "z": [
          {
            "type": [
              "h-b"
            ],
            "properties": {
              "name": [
                ""
              ]
            },
            "id": "b",
            "value": ""
          }
        ]
      },
      "id": "a",
      "children": [
        {
          "type": [
            "h-c"
          ],
          "properties": {
            "name": [
              ""
            ]
          },
          "id": "c"
        }
      ]
    }
  ]
}

(Output taken from the great and fast in-browser TypeScript parser.)

Microformats within items collections, children collections, and when detected on properties, can all have an id object member with a string value. My schema was getting this wrong and there was no occurrence of this within the test suite to catch it.

We needs tests for this now that microformats/microformats2-parsing#44 has landed in the parsing specification, and has been there since December 2018.

I will probably look into adding a more complete example later.

@Zegnat Just PR'ed this in #121.