diff --git a/package.json b/package.json index 53f121ca9..74ba945cf 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "hermes-parser": "0.22.0", "html-element-attributes": "3.4.0", "html-tag-names": "2.1.0", - "html-ua-styles": "0.0.6", + "html-ua-styles": "0.0.8", "ignore": "5.3.1", "import-meta-resolve": "4.1.0", "iterate-directory-up": "1.1.1", diff --git a/src/language-html/constants.evaluate.js b/src/language-html/constants.evaluate.js index 8c9926ee6..9dad3230c 100644 --- a/src/language-html/constants.evaluate.js +++ b/src/language-html/constants.evaluate.js @@ -34,8 +34,6 @@ const CSS_DISPLAY_TAGS = { // noscript: "inline", // there's no css display for these elements but they behave these ways - details: "block", - summary: "block", meter: "inline-block", progress: "inline-block", object: "inline-block", diff --git a/tests/unit/__snapshots__/html-element-display-values.js.snap b/tests/unit/__snapshots__/html-element-display-values.js.snap deleted file mode 100644 index a2ca74a42..000000000 --- a/tests/unit/__snapshots__/html-element-display-values.js.snap +++ /dev/null @@ -1,155 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`display 1`] = ` -{ - "a": "inline", - "abbr": "inline", - "acronym": "inline", - "address": "block", - "applet": "inline", - "area": "none", - "article": "block", - "aside": "block", - "audio": "inline-block", - "b": "inline", - "base": "none", - "basefont": "none", - "bdi": "inline", - "bdo": "inline", - "bgsound": "inline", - "big": "inline", - "blink": "inline", - "blockquote": "block", - "body": "block", - "br": "inline", - "button": "inline-block", - "canvas": "inline", - "caption": "table-caption", - "center": "block", - "cite": "inline", - "code": "inline", - "col": "table-column", - "colgroup": "table-column-group", - "command": "inline", - "content": "inline", - "data": "inline", - "datalist": "none", - "dd": "block", - "del": "inline", - "details": "block", - "dfn": "inline", - "dialog": "block", - "dir": "block", - "div": "block", - "dl": "block", - "dt": "block", - "element": "inline", - "em": "inline", - "embed": "inline", - "fieldset": "block", - "figcaption": "block", - "figure": "block", - "font": "inline", - "footer": "block", - "form": "block", - "frame": "inline", - "frameset": "inline", - "h1": "block", - "h2": "block", - "h3": "block", - "h4": "block", - "h5": "block", - "h6": "block", - "head": "none", - "header": "block", - "hgroup": "block", - "hr": "block", - "html": "block", - "i": "inline", - "iframe": "inline", - "image": "inline", - "img": "inline", - "input": "inline-block", - "ins": "inline", - "isindex": "inline", - "kbd": "inline", - "keygen": "inline", - "label": "inline", - "legend": "block", - "li": "list-item", - "link": "none", - "listing": "block", - "main": "block", - "map": "inline", - "mark": "inline", - "marquee": "inline-block", - "math": "inline", - "menu": "block", - "menuitem": "inline", - "meta": "none", - "meter": "inline-block", - "multicol": "inline", - "nav": "block", - "nextid": "inline", - "nobr": "inline", - "noembed": "none", - "noframes": "none", - "noscript": "inline", - "object": "inline-block", - "ol": "block", - "optgroup": "block", - "option": "block", - "output": "inline", - "p": "block", - "param": "block", - "picture": "inline", - "plaintext": "block", - "pre": "block", - "progress": "inline-block", - "q": "inline", - "rb": "inline", - "rbc": "inline", - "rp": "none", - "rt": "ruby-text", - "rtc": "inline", - "ruby": "ruby", - "s": "inline", - "samp": "inline", - "script": "block", - "search": "block", - "section": "block", - "select": "inline-block", - "shadow": "inline", - "slot": "contents", - "small": "inline", - "source": "block", - "spacer": "inline", - "span": "inline", - "strike": "inline", - "strong": "inline", - "style": "none", - "sub": "inline", - "summary": "block", - "sup": "inline", - "svg": "inline", - "table": "table", - "tbody": "table-row-group", - "td": "table-cell", - "template": "inline", - "textarea": "inline", - "tfoot": "table-footer-group", - "th": "table-cell", - "thead": "table-header-group", - "time": "inline", - "title": "none", - "tr": "table-row", - "track": "block", - "tt": "inline", - "u": "inline", - "ul": "block", - "var": "inline", - "video": "inline-block", - "wbr": "inline", - "xmp": "block", -} -`; diff --git a/tests/unit/__snapshots__/html-elements.js.snap b/tests/unit/__snapshots__/html-elements.js.snap new file mode 100644 index 000000000..cfe201e21 --- /dev/null +++ b/tests/unit/__snapshots__/html-elements.js.snap @@ -0,0 +1,751 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`htmlTagNames 1`] = ` +[ + { + "display": "inline", + "tagName": "a", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "abbr", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "acronym", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "address", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "applet", + "whiteSpace": "normal", + }, + { + "display": "none", + "tagName": "area", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "article", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "aside", + "whiteSpace": "normal", + }, + { + "display": "inline-block", + "tagName": "audio", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "b", + "whiteSpace": "normal", + }, + { + "display": "none", + "tagName": "base", + "whiteSpace": "normal", + }, + { + "display": "none", + "tagName": "basefont", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "bdi", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "bdo", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "bgsound", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "big", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "blink", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "blockquote", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "body", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "br", + "whiteSpace": "normal", + }, + { + "display": "inline-block", + "tagName": "button", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "canvas", + "whiteSpace": "normal", + }, + { + "display": "table-caption", + "tagName": "caption", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "center", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "cite", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "code", + "whiteSpace": "normal", + }, + { + "display": "table-column", + "tagName": "col", + "whiteSpace": "normal", + }, + { + "display": "table-column-group", + "tagName": "colgroup", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "command", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "content", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "data", + "whiteSpace": "normal", + }, + { + "display": "none", + "tagName": "datalist", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "dd", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "del", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "details", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "dfn", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "dialog", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "dir", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "div", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "dl", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "dt", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "element", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "em", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "embed", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "fieldset", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "figcaption", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "figure", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "font", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "footer", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "form", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "frame", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "frameset", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "h1", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "h2", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "h3", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "h4", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "h5", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "h6", + "whiteSpace": "normal", + }, + { + "display": "none", + "tagName": "head", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "header", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "hgroup", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "hr", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "html", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "i", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "iframe", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "image", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "img", + "whiteSpace": "normal", + }, + { + "display": "inline-block", + "tagName": "input", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "ins", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "isindex", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "kbd", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "keygen", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "label", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "legend", + "whiteSpace": "normal", + }, + { + "display": "list-item", + "tagName": "li", + "whiteSpace": "normal", + }, + { + "display": "none", + "tagName": "link", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "listing", + "whiteSpace": "pre", + }, + { + "display": "block", + "tagName": "main", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "map", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "mark", + "whiteSpace": "normal", + }, + { + "display": "inline-block", + "tagName": "marquee", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "math", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "menu", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "menuitem", + "whiteSpace": "normal", + }, + { + "display": "none", + "tagName": "meta", + "whiteSpace": "normal", + }, + { + "display": "inline-block", + "tagName": "meter", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "multicol", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "nav", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "nextid", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "nobr", + "whiteSpace": "nowrap", + }, + { + "display": "none", + "tagName": "noembed", + "whiteSpace": "normal", + }, + { + "display": "none", + "tagName": "noframes", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "noscript", + "whiteSpace": "normal", + }, + { + "display": "inline-block", + "tagName": "object", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "ol", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "optgroup", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "option", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "output", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "p", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "param", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "picture", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "plaintext", + "whiteSpace": "pre", + }, + { + "display": "block", + "tagName": "pre", + "whiteSpace": "pre", + }, + { + "display": "inline-block", + "tagName": "progress", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "q", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "rb", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "rbc", + "whiteSpace": "normal", + }, + { + "display": "none", + "tagName": "rp", + "whiteSpace": "normal", + }, + { + "display": "ruby-text", + "tagName": "rt", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "rtc", + "whiteSpace": "normal", + }, + { + "display": "ruby", + "tagName": "ruby", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "s", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "samp", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "script", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "search", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "section", + "whiteSpace": "normal", + }, + { + "display": "inline-block", + "tagName": "select", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "shadow", + "whiteSpace": "normal", + }, + { + "display": "contents", + "tagName": "slot", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "small", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "source", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "spacer", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "span", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "strike", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "strong", + "whiteSpace": "normal", + }, + { + "display": "none", + "tagName": "style", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "sub", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "summary", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "sup", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "svg", + "whiteSpace": "normal", + }, + { + "display": "table", + "tagName": "table", + "whiteSpace": "initial", + }, + { + "display": "table-row-group", + "tagName": "tbody", + "whiteSpace": "normal", + }, + { + "display": "table-cell", + "tagName": "td", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "template", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "textarea", + "whiteSpace": "pre-wrap", + }, + { + "display": "table-footer-group", + "tagName": "tfoot", + "whiteSpace": "normal", + }, + { + "display": "table-cell", + "tagName": "th", + "whiteSpace": "normal", + }, + { + "display": "table-header-group", + "tagName": "thead", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "time", + "whiteSpace": "normal", + }, + { + "display": "none", + "tagName": "title", + "whiteSpace": "normal", + }, + { + "display": "table-row", + "tagName": "tr", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "track", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "tt", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "u", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "ul", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "var", + "whiteSpace": "normal", + }, + { + "display": "inline-block", + "tagName": "video", + "whiteSpace": "normal", + }, + { + "display": "inline", + "tagName": "wbr", + "whiteSpace": "normal", + }, + { + "display": "block", + "tagName": "xmp", + "whiteSpace": "pre", + }, +] +`; diff --git a/tests/unit/html-element-display-values.js b/tests/unit/html-element-display-values.js deleted file mode 100644 index 4feee2627..000000000 --- a/tests/unit/html-element-display-values.js +++ /dev/null @@ -1,17 +0,0 @@ -import { htmlTagNames } from "html-tag-names"; - -import { - CSS_DISPLAY_DEFAULT, - CSS_DISPLAY_TAGS, -} from "../../src/language-html/constants.evaluate.js"; - -test("display", () => { - const values = Object.fromEntries( - htmlTagNames.map((tagName) => [ - tagName, - CSS_DISPLAY_TAGS[tagName] ?? CSS_DISPLAY_DEFAULT, - ]), - ); - - expect(values).toMatchSnapshot(); -}); diff --git a/tests/unit/html-elements.js b/tests/unit/html-elements.js new file mode 100644 index 000000000..069338f22 --- /dev/null +++ b/tests/unit/html-elements.js @@ -0,0 +1,19 @@ +import { htmlTagNames } from "html-tag-names"; + +import { + CSS_DISPLAY_DEFAULT, + CSS_DISPLAY_TAGS, + CSS_WHITE_SPACE_DEFAULT, + CSS_WHITE_SPACE_TAGS, +} from "../../src/language-html/constants.evaluate.js"; + +// Snapshot to notify changes +test("htmlTagNames", () => { + const data = htmlTagNames.map((tagName) => ({ + tagName, + display: CSS_DISPLAY_TAGS[tagName] ?? CSS_DISPLAY_DEFAULT, + whiteSpace: CSS_WHITE_SPACE_TAGS[tagName] ?? CSS_WHITE_SPACE_DEFAULT, + })); + + expect(data).toMatchSnapshot(); +}); diff --git a/tests/unit/html-tag-names.js b/tests/unit/html-tag-names.js deleted file mode 100644 index 68f1f35bb..000000000 --- a/tests/unit/html-tag-names.js +++ /dev/null @@ -1,158 +0,0 @@ -import { htmlTagNames } from "html-tag-names"; - -// Snapshot to notify changes -test("htmlTagNames", () => { - expect(htmlTagNames).toMatchInlineSnapshot(` - [ - "a", - "abbr", - "acronym", - "address", - "applet", - "area", - "article", - "aside", - "audio", - "b", - "base", - "basefont", - "bdi", - "bdo", - "bgsound", - "big", - "blink", - "blockquote", - "body", - "br", - "button", - "canvas", - "caption", - "center", - "cite", - "code", - "col", - "colgroup", - "command", - "content", - "data", - "datalist", - "dd", - "del", - "details", - "dfn", - "dialog", - "dir", - "div", - "dl", - "dt", - "element", - "em", - "embed", - "fieldset", - "figcaption", - "figure", - "font", - "footer", - "form", - "frame", - "frameset", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6", - "head", - "header", - "hgroup", - "hr", - "html", - "i", - "iframe", - "image", - "img", - "input", - "ins", - "isindex", - "kbd", - "keygen", - "label", - "legend", - "li", - "link", - "listing", - "main", - "map", - "mark", - "marquee", - "math", - "menu", - "menuitem", - "meta", - "meter", - "multicol", - "nav", - "nextid", - "nobr", - "noembed", - "noframes", - "noscript", - "object", - "ol", - "optgroup", - "option", - "output", - "p", - "param", - "picture", - "plaintext", - "pre", - "progress", - "q", - "rb", - "rbc", - "rp", - "rt", - "rtc", - "ruby", - "s", - "samp", - "script", - "search", - "section", - "select", - "shadow", - "slot", - "small", - "source", - "spacer", - "span", - "strike", - "strong", - "style", - "sub", - "summary", - "sup", - "svg", - "table", - "tbody", - "td", - "template", - "textarea", - "tfoot", - "th", - "thead", - "time", - "title", - "tr", - "track", - "tt", - "u", - "ul", - "var", - "video", - "wbr", - "xmp", - ] - `); -}); diff --git a/yarn.lock b/yarn.lock index 638df4d2c..31daa80a4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4848,10 +4848,10 @@ __metadata: languageName: node linkType: hard -"html-ua-styles@npm:0.0.6": - version: 0.0.6 - resolution: "html-ua-styles@npm:0.0.6" - checksum: 10/6a2ed9b4c211602d2e01b6d865e4680a8cfdd0309771eb3a82eb27dffa575df67d612534e972fa7fc84b6d20d208d73c944f2c1a3cfa577ffa789c2459bbc82c +"html-ua-styles@npm:0.0.8": + version: 0.0.8 + resolution: "html-ua-styles@npm:0.0.8" + checksum: 10/3c1d08af5e40c3b096bf797566e730bdaa70b7ced493e54662a9c0ff62705aaccf1c39fef58b9d48f1dd4c67355c0d4395e0a71b62ee38c78cc3f45bba4a339b languageName: node linkType: hard @@ -7419,7 +7419,7 @@ __metadata: hermes-parser: "npm:0.22.0" html-element-attributes: "npm:3.4.0" html-tag-names: "npm:2.1.0" - html-ua-styles: "npm:0.0.6" + html-ua-styles: "npm:0.0.8" ignore: "npm:5.3.1" import-meta-resolve: "npm:4.1.0" iterate-directory-up: "npm:1.1.1"