ingenerator / behat-tableassert

Assertions for all sorts of tabular data in behat
BSD 3-Clause "New" or "Revised" License
5 stars 5 forks source link

Why that strict table structure? #20

Open RoSk0 opened 2 years ago

RoSk0 commented 2 years ago

I need to test tables which has headers as a first column , so no thead element.

I went on reading HTML specs to understand if my project produces bad markup , but no, thead is optional as the tbody . Found also very interesting examples of perfectly valid tables here https://www.w3.org/WAI/tutorials/tables/two-headers/.

So my main question is why this project limits the table structure ?

I've done some hackery and I can see that even plain <table><tr><td>Series offered</td><td></td></tr><tr><td></td><td></td></tr></table> is perfectly parsable with minor logic change in HTMLStringTableParser::parseTable().

I understand that comparators are focused on columns at the moment , but that could be change or rather extended.

Extending this project with this type of functionality would rather big task and I want to make sure it is going to be considered/accepted before starting work.

Are there any issues with removing those hard requirements on table structure?

acoulton commented 2 years ago

I think there were two reasons:

We'd be open to a change that made that a soft requirement. I think it's still important that the markup is explicit about what we should count as the header.

How about looking for:

What do you think?

RoSk0 commented 2 years ago

It looks like my timeframes are not allowing me to work further on this.

I believe that imposing restrictions on the mark up is not in scope for testing libraries like this. Configuration should describe existing mark up to the library to help diffing . Any valid HTML should be supported, without additional attributes.