Skip to content

Commit a81fc46

Browse files
committed
fix: test valid.js
Within valid.js, the test 'hillcrestpartyrentals.html should return Object with valid: false. not closing <p> tag on line 476' was implemented incorrectly. In fact the HTML is valid. All the p elements without close tags are contained in td elements and, therefore, the closing tag is not required. The return should be true.
1 parent 950865f commit a81fc46

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

test/tests/valid.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,25 @@ describe('parseWithValidation', function () {
2020
result.should.eql(false);
2121
})
2222

23-
it('hillcrestpartyrentals.html should return Object with valid: false. not closing <p> tag on line 476', function () {
23+
// #294: Closing tag is missing but valid HTML is still not parseable
24+
//
25+
// Tag omission in text/html:
26+
// A p element's end tag can be omitted if the p element is immediately
27+
// followed by an address, article, aside, blockquote, details, dialog,
28+
// div, dl, fieldset, figcaption, figure, footer, form, h1, h2, h3, h4,
29+
// h5, h6, header, hgroup, hr, main, menu, nav, ol, p, pre, search,
30+
// section, table, or ul element, or if there is no more content in the
31+
// parent element and the parent element is an HTML element that is not
32+
// an a, audio, del, ins, map, noscript, or video element, or an
33+
// autonomous custom element.
34+
//
35+
// Based on this, hillcrestpartyrentals.html is in fact valid HTML. All
36+
// the p elements missing close tags are contained within td elements
37+
// and, therefore, should be closed when there is no more content in the
38+
// parent td element (i.e. at the `</td>`).
39+
it('hillcrestpartyrentals.html should return Object with valid: true. not closing <p> tag on line 476', function () {
2440
const result = valid(fs.readFileSync(__dirname + '/../assets/html/hillcrestpartyrentals.html').toString());
25-
result.should.eql(false);
41+
result.should.eql(true);
2642
})
2743

2844
it('google.html should return Object with valid: true', function () {

0 commit comments

Comments
 (0)