microformats / tests

Microformats test suite
http://microformats.org/wiki/microformats2
Creative Commons Zero v1.0 Universal
64 stars 20 forks source link

No test with nested IDs. #120

Open Zegnat opened 4 years ago

Zegnat commented 4 years ago

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 https://github.com/microformats/microformats2-parsing/issues/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.

jgarber623 commented 4 years ago

@Zegnat Just PR'ed this in #121.