diff --git a/package.json b/package.json index ba1d8ac69..40cabb326 100644 --- a/package.json +++ b/package.json @@ -50,6 +50,7 @@ "@braindb/micromark-extension-wiki-link": "0.1.0", "@glimmer/syntax": "0.95.0", "@prettier/cli": "0.12.0", + "@prettier/html-attributes": "0.0.1", "@prettier/html-event-attributes": "0.0.2", "@prettier/html-tags": "2.2.0", "@prettier/parse-srcset": "3.1.0", @@ -80,7 +81,6 @@ "get-stdin": "9.0.0", "graphql": "17.0.2", "hermes-parser": "0.37.0", - "html-element-attributes": "3.5.0", "html-ua-styles": "0.5.0", "ignore": "7.0.6", "import-meta-resolve": "4.2.0", diff --git a/src/language-html/parse/postprocess.js b/src/language-html/parse/postprocess.js index 495e6ff50..77134d1f3 100644 --- a/src/language-html/parse/postprocess.js +++ b/src/language-html/parse/postprocess.js @@ -5,7 +5,10 @@ import { visitAll, } from "angular-html-parser"; import isNonEmptyArray from "../../utilities/is-non-empty-array.js"; -import HTML_ELEMENT_ATTRIBUTES from "../utilities/html-elements-attributes.evaluate.js"; +import { + ELEMENT_ATTRIBUTES, + GLOBAL_ATTRIBUTES, +} from "../utilities/html-elements-attributes.evaluate.js"; import HTML_TAGS from "../utilities/html-tags.evaluate.js"; import isUnknownNamespace from "../utilities/is-unknown-namespace.js"; import { Node } from "./ast.js"; @@ -238,9 +241,9 @@ function normalizeName(node, parseOptions) { attr.name = lowerCaseIf( attr.name, (lowerCasedAttrName) => - HTML_ELEMENT_ATTRIBUTES.has(node.name) && - (HTML_ELEMENT_ATTRIBUTES.get("*").has(lowerCasedAttrName) || - HTML_ELEMENT_ATTRIBUTES.get(node.name).has(lowerCasedAttrName)), + ELEMENT_ATTRIBUTES.has(node.name) && + (GLOBAL_ATTRIBUTES.has(lowerCasedAttrName) || + ELEMENT_ATTRIBUTES.get(node.name).has(lowerCasedAttrName)), ); } } diff --git a/src/language-html/utilities/html-elements-attributes.evaluate.js b/src/language-html/utilities/html-elements-attributes.evaluate.js index ba445f645..42b14c682 100644 --- a/src/language-html/utilities/html-elements-attributes.evaluate.js +++ b/src/language-html/utilities/html-elements-attributes.evaluate.js @@ -1,10 +1,12 @@ -import { htmlElementAttributes } from "html-element-attributes"; +import { elementAttributes, globalAttributes } from "@prettier/html-attributes"; -const HTML_ELEMENT_ATTRIBUTES = new Map( - Object.entries(htmlElementAttributes).map(([tagName, attributes]) => [ +const ELEMENT_ATTRIBUTES = new Map( + Object.entries(elementAttributes).map(([tagName, attributes]) => [ tagName, new Set(attributes), ]), ); -export default HTML_ELEMENT_ATTRIBUTES; +const GLOBAL_ATTRIBUTES = new Set(globalAttributes); + +export { ELEMENT_ATTRIBUTES, GLOBAL_ATTRIBUTES }; diff --git a/tests/unit/__snapshots__/html-elements.js.snap b/tests/unit/__snapshots__/html-elements.js.snap index af5c726cf..751389855 100644 --- a/tests/unit/__snapshots__/html-elements.js.snap +++ b/tests/unit/__snapshots__/html-elements.js.snap @@ -1,758 +1,1452 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing +exports[`Global attributes 1`] = ` +[ + "accesskey", + "autocapitalize", + "autocorrect", + "autofocus", + "class", + "contenteditable", + "dir", + "draggable", + "enterkeyhint", + "exportparts", + "headingoffset", + "headingreset", + "hidden", + "id", + "inert", + "inputmode", + "is", + "itemid", + "itemprop", + "itemref", + "itemscope", + "itemtype", + "lang", + "nonce", + "part", + "popover", + "slot", + "spellcheck", + "style", + "tabindex", + "title", + "translate", + "writingsuggestions", +] +`; + exports[`htmlTagNames 1`] = ` [ { + "attributes": [ + "charset", + "coords", + "download", + "href", + "hreflang", + "name", + "ping", + "referrerpolicy", + "rel", + "rev", + "shape", + "target", + "type", + ], "display": "inline", "tagName": "a", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "abbr", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "acronym", "whiteSpace": "normal", }, { + "attributes": [], "display": "block", "tagName": "address", "whiteSpace": "normal", }, { + "attributes": [ + "align", + "alt", + "archive", + "code", + "codebase", + "height", + "hspace", + "name", + "object", + "vspace", + "width", + ], "display": "inline", "tagName": "applet", "whiteSpace": "normal", }, { + "attributes": [ + "alt", + "coords", + "download", + "href", + "hreflang", + "nohref", + "ping", + "referrerpolicy", + "rel", + "shape", + "target", + "type", + ], "display": "none", "tagName": "area", "whiteSpace": "normal", }, { + "attributes": [], "display": "block", "tagName": "article", "whiteSpace": "normal", }, { + "attributes": [], "display": "block", "tagName": "aside", "whiteSpace": "normal", }, { + "attributes": [ + "autoplay", + "controls", + "crossorigin", + "loading", + "loop", + "muted", + "preload", + "src", + ], "display": "inline-block", "tagName": "audio", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "b", "whiteSpace": "normal", }, { + "attributes": [ + "href", + "target", + ], "display": "none", "tagName": "base", "whiteSpace": "normal", }, { + "attributes": [ + "color", + "face", + "size", + ], "display": "none", "tagName": "basefont", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "bdi", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "bdo", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "bgsound", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "big", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "blink", "whiteSpace": "normal", }, { + "attributes": [ + "cite", + ], "display": "block", "tagName": "blockquote", "whiteSpace": "normal", }, { + "attributes": [ + "alink", + "background", + "bgcolor", + "bottommargin", + "leftmargin", + "link", + "rightmargin", + "text", + "topmargin", + "vlink", + ], "display": "block", "tagName": "body", "whiteSpace": "normal", }, { + "attributes": [ + "clear", + ], "display": "inline", "tagName": "br", "whiteSpace": "normal", }, { + "attributes": [ + "command", + "commandfor", + "disabled", + "form", + "formaction", + "formenctype", + "formmethod", + "formnovalidate", + "formtarget", + "name", + "popovertarget", + "popovertargetaction", + "type", + "value", + ], "display": "inline-block", "tagName": "button", "whiteSpace": "normal", }, { + "attributes": [ + "height", + "width", + ], "display": "inline", "tagName": "canvas", "whiteSpace": "normal", }, { + "attributes": [ + "align", + ], "display": "table-caption", "tagName": "caption", "whiteSpace": "normal", }, { + "attributes": [], "display": "block", "tagName": "center", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "cite", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "code", "whiteSpace": "normal", }, { + "attributes": [ + "align", + "bgcolor", + "char", + "charoff", + "span", + "valign", + "width", + ], "display": "table-column", "tagName": "col", "whiteSpace": "normal", }, { + "attributes": [ + "align", + "bgcolor", + "char", + "charoff", + "span", + "valign", + "width", + ], "display": "table-column-group", "tagName": "colgroup", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "command", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "content", "whiteSpace": "normal", }, { + "attributes": [ + "value", + ], "display": "inline", "tagName": "data", "whiteSpace": "normal", }, { + "attributes": [], "display": "none", "tagName": "datalist", "whiteSpace": "normal", }, { + "attributes": [], "display": "block", "tagName": "dd", "whiteSpace": "normal", }, { + "attributes": [ + "cite", + "datetime", + ], "display": "inline", "tagName": "del", "whiteSpace": "normal", }, { + "attributes": [ + "name", + "open", + ], "display": "block", "tagName": "details", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "dfn", "whiteSpace": "normal", }, { + "attributes": [ + "closedby", + "open", + ], "display": "block", "tagName": "dialog", "whiteSpace": "normal", }, { + "attributes": [ + "compact", + ], "display": "block", "tagName": "dir", "whiteSpace": "normal", }, { + "attributes": [ + "align", + ], "display": "block", "tagName": "div", "whiteSpace": "normal", }, { + "attributes": [ + "compact", + ], "display": "block", "tagName": "dl", "whiteSpace": "normal", }, { + "attributes": [], "display": "block", "tagName": "dt", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "em", "whiteSpace": "normal", }, { + "attributes": [ + "height", + "src", + "type", + "width", + ], "display": "inline", "tagName": "embed", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "fencedframe", "whiteSpace": "normal", }, { + "attributes": [ + "disabled", + "form", + "name", + ], "display": "block", "tagName": "fieldset", "whiteSpace": "normal", }, { + "attributes": [], "display": "block", "tagName": "figcaption", "whiteSpace": "normal", }, { + "attributes": [], "display": "block", "tagName": "figure", "whiteSpace": "normal", }, { + "attributes": [ + "color", + "face", + "size", + ], "display": "inline", "tagName": "font", "whiteSpace": "normal", }, { + "attributes": [], "display": "block", "tagName": "footer", "whiteSpace": "normal", }, { + "attributes": [ + "accept", + "accept-charset", + "action", + "autocomplete", + "enctype", + "method", + "name", + "novalidate", + "rel", + "target", + ], "display": "block", "tagName": "form", "whiteSpace": "normal", }, { + "attributes": [ + "frameborder", + "longdesc", + "marginheight", + "marginwidth", + "name", + "noresize", + "scrolling", + "src", + ], "display": "inline", "tagName": "frame", "whiteSpace": "normal", }, { + "attributes": [ + "cols", + "rows", + ], "display": "inline", "tagName": "frameset", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "geolocation", "whiteSpace": "normal", }, { + "attributes": [ + "align", + ], "display": "block", "tagName": "h1", "whiteSpace": "normal", }, { + "attributes": [ + "align", + ], "display": "block", "tagName": "h2", "whiteSpace": "normal", }, { + "attributes": [ + "align", + ], "display": "block", "tagName": "h3", "whiteSpace": "normal", }, { + "attributes": [ + "align", + ], "display": "block", "tagName": "h4", "whiteSpace": "normal", }, { + "attributes": [ + "align", + ], "display": "block", "tagName": "h5", "whiteSpace": "normal", }, { + "attributes": [ + "align", + ], "display": "block", "tagName": "h6", "whiteSpace": "normal", }, { + "attributes": [ + "profile", + ], "display": "none", "tagName": "head", "whiteSpace": "normal", }, { + "attributes": [], "display": "block", "tagName": "header", "whiteSpace": "normal", }, { + "attributes": [], "display": "block", "tagName": "hgroup", "whiteSpace": "normal", }, { + "attributes": [ + "align", + "color", + "noshade", + "size", + "width", + ], "display": "block", "tagName": "hr", "whiteSpace": "normal", }, { + "attributes": [ + "manifest", + "version", + "xmlns", + ], "display": "block", "tagName": "html", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "i", "whiteSpace": "normal", }, { + "attributes": [ + "align", + "allow", + "allowfullscreen", + "allowpaymentrequest", + "frameborder", + "height", + "loading", + "longdesc", + "marginheight", + "marginwidth", + "name", + "referrerpolicy", + "sandbox", + "scrolling", + "src", + "srcdoc", + "width", + ], "display": "inline", "tagName": "iframe", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "image", "whiteSpace": "normal", }, { + "attributes": [ + "align", + "alt", + "border", + "controls", + "crossorigin", + "decoding", + "fetchpriority", + "height", + "hspace", + "ismap", + "loading", + "longdesc", + "name", + "referrerpolicy", + "sizes", + "src", + "srcset", + "usemap", + "vspace", + "width", + ], "display": "inline", "tagName": "img", "whiteSpace": "normal", }, { + "attributes": [ + "accept", + "align", + "alpha", + "alt", + "autocomplete", + "checked", + "colorspace", + "dirname", + "disabled", + "form", + "formaction", + "formenctype", + "formmethod", + "formnovalidate", + "formtarget", + "height", + "list", + "max", + "maxlength", + "min", + "minlength", + "multiple", + "name", + "pattern", + "placeholder", + "popovertarget", + "popovertargetaction", + "readonly", + "required", + "size", + "src", + "step", + "type", + "value", + "width", + ], "display": "inline-block", "tagName": "input", "whiteSpace": "normal", }, { + "attributes": [ + "cite", + "datetime", + ], "display": "inline", "tagName": "ins", "whiteSpace": "normal", }, { + "attributes": [ + "action", + "prompt", + ], "display": "inline", "tagName": "isindex", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "kbd", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "keygen", "whiteSpace": "normal", }, { + "attributes": [ + "for", + "form", + ], "display": "inline", "tagName": "label", "whiteSpace": "normal", }, { + "attributes": [ + "align", + ], "display": "block", "tagName": "legend", "whiteSpace": "normal", }, { + "attributes": [ + "type", + "value", + ], "display": "list-item", "tagName": "li", "whiteSpace": "normal", }, { + "attributes": [ + "as", + "blocking", + "charset", + "color", + "crossorigin", + "disabled", + "fetchpriority", + "href", + "hreflang", + "imagesizes", + "imagesrcset", + "integrity", + "media", + "referrerpolicy", + "rel", + "rev", + "sizes", + "target", + "type", + ], "display": "none", "tagName": "link", "whiteSpace": "normal", }, { + "attributes": [], "display": "block", "tagName": "listing", "whiteSpace": "pre", }, { + "attributes": [], "display": "block", "tagName": "main", "whiteSpace": "normal", }, { + "attributes": [ + "name", + ], "display": "inline", "tagName": "map", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "mark", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline-block", "tagName": "marquee", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "math", "whiteSpace": "normal", }, { + "attributes": [ + "compact", + ], "display": "block", "tagName": "menu", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "menuitem", "whiteSpace": "normal", }, { + "attributes": [ + "charset", + "content", + "http-equiv", + "media", + "name", + "scheme", + ], "display": "none", "tagName": "meta", "whiteSpace": "normal", }, { + "attributes": [ + "high", + "low", + "max", + "min", + "optimum", + "value", + ], "display": "inline-block", "tagName": "meter", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "multicol", "whiteSpace": "normal", }, { + "attributes": [], "display": "block", "tagName": "nav", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "nextid", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "nobr", "whiteSpace": "nowrap", }, { + "attributes": [], "display": "none", "tagName": "noembed", "whiteSpace": "normal", }, { + "attributes": [], "display": "none", "tagName": "noframes", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "noscript", "whiteSpace": "normal", }, { + "attributes": [ + "align", + "archive", + "border", + "classid", + "codebase", + "codetype", + "data", + "declare", + "form", + "height", + "hspace", + "name", + "standby", + "type", + "typemustmatch", + "usemap", + "vspace", + "width", + ], "display": "inline-block", "tagName": "object", "whiteSpace": "normal", }, { + "attributes": [ + "compact", + "reversed", + "start", + "type", + ], "display": "block", "tagName": "ol", "whiteSpace": "normal", }, { + "attributes": [ + "disabled", + "label", + ], "display": "block", "tagName": "optgroup", "whiteSpace": "normal", }, { + "attributes": [ + "disabled", + "label", + "selected", + "value", + ], "display": "block", "tagName": "option", "whiteSpace": "normal", }, { + "attributes": [ + "for", + "form", + "name", + ], "display": "inline", "tagName": "output", "whiteSpace": "normal", }, { + "attributes": [ + "align", + ], "display": "block", "tagName": "p", "whiteSpace": "normal", }, { + "attributes": [ + "name", + "type", + "value", + "valuetype", + ], "display": "block", "tagName": "param", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "picture", "whiteSpace": "normal", }, { + "attributes": [], "display": "block", "tagName": "plaintext", "whiteSpace": "pre", }, { + "attributes": [ + "width", + "wrap", + ], "display": "block", "tagName": "pre", "whiteSpace": "pre", }, { + "attributes": [ + "max", + "value", + ], "display": "inline-block", "tagName": "progress", "whiteSpace": "normal", }, { + "attributes": [ + "cite", + ], "display": "inline", "tagName": "q", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "rb", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "rbc", "whiteSpace": "normal", }, { + "attributes": [], "display": "none", "tagName": "rp", "whiteSpace": "normal", }, { + "attributes": [], "display": "ruby-text", "tagName": "rt", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "rtc", "whiteSpace": "normal", }, { + "attributes": [], "display": "ruby", "tagName": "ruby", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "s", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "samp", "whiteSpace": "normal", }, { + "attributes": [ + "async", + "blocking", + "charset", + "crossorigin", + "defer", + "fetchpriority", + "integrity", + "language", + "nomodule", + "referrerpolicy", + "src", + "type", + ], "display": "block", "tagName": "script", "whiteSpace": "normal", }, { + "attributes": [], "display": "block", "tagName": "search", "whiteSpace": "normal", }, { + "attributes": [], "display": "block", "tagName": "section", "whiteSpace": "normal", }, { + "attributes": [ + "autocomplete", + "disabled", + "form", + "multiple", + "name", + "required", + "size", + ], "display": "inline-block", "tagName": "select", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "selectedcontent", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "shadow", "whiteSpace": "normal", }, { + "attributes": [ + "name", + ], "display": "contents", "tagName": "slot", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "small", "whiteSpace": "normal", }, { + "attributes": [ + "height", + "media", + "sizes", + "src", + "srcset", + "type", + "width", + ], "display": "block", "tagName": "source", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "spacer", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "span", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "strike", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "strong", "whiteSpace": "normal", }, { + "attributes": [ + "blocking", + "media", + "type", + ], "display": "none", "tagName": "style", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "sub", "whiteSpace": "normal", }, { + "attributes": [], "display": "block", "tagName": "summary", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "sup", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "svg", "whiteSpace": "normal", }, { + "attributes": [ + "align", + "bgcolor", + "border", + "cellpadding", + "cellspacing", + "frame", + "rules", + "summary", + "width", + ], "display": "table", "tagName": "table", "whiteSpace": "initial", }, { + "attributes": [ + "align", + "bgcolor", + "char", + "charoff", + "valign", + ], "display": "table-row-group", "tagName": "tbody", "whiteSpace": "normal", }, { + "attributes": [ + "abbr", + "align", + "axis", + "bgcolor", + "char", + "charoff", + "colspan", + "headers", + "height", + "nowrap", + "rowspan", + "scope", + "valign", + "width", + ], "display": "table-cell", "tagName": "td", "whiteSpace": "normal", }, { + "attributes": [ + "shadowrootclonable", + "shadowrootcustomelementregistry", + "shadowrootdelegatesfocus", + "shadowrootmode", + "shadowrootserializable", + "shadowrootslotassignment", + ], "display": "inline", "tagName": "template", "whiteSpace": "normal", }, { + "attributes": [ + "autocomplete", + "cols", + "dirname", + "disabled", + "form", + "maxlength", + "minlength", + "name", + "placeholder", + "readonly", + "required", + "rows", + "wrap", + ], "display": "inline", "tagName": "textarea", "whiteSpace": "pre-wrap", }, { + "attributes": [ + "align", + "bgcolor", + "char", + "charoff", + "valign", + ], "display": "table-footer-group", "tagName": "tfoot", "whiteSpace": "normal", }, { + "attributes": [ + "abbr", + "align", + "axis", + "bgcolor", + "char", + "charoff", + "colspan", + "headers", + "height", + "nowrap", + "rowspan", + "scope", + "valign", + "width", + ], "display": "table-cell", "tagName": "th", "whiteSpace": "normal", }, { + "attributes": [ + "align", + "bgcolor", + "char", + "charoff", + "valign", + ], "display": "table-header-group", "tagName": "thead", "whiteSpace": "normal", }, { + "attributes": [ + "datetime", + ], "display": "inline", "tagName": "time", "whiteSpace": "normal", }, { + "attributes": [], "display": "none", "tagName": "title", "whiteSpace": "normal", }, { + "attributes": [ + "align", + "bgcolor", + "char", + "charoff", + "valign", + ], "display": "table-row", "tagName": "tr", "whiteSpace": "normal", }, { + "attributes": [ + "default", + "kind", + "label", + "src", + "srclang", + ], "display": "block", "tagName": "track", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "tt", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "u", "whiteSpace": "normal", }, { + "attributes": [ + "compact", + "type", + ], "display": "block", "tagName": "ul", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "var", "whiteSpace": "normal", }, { + "attributes": [ + "autoplay", + "controls", + "crossorigin", + "height", + "loading", + "loop", + "muted", + "playsinline", + "poster", + "preload", + "src", + "width", + ], "display": "inline-block", "tagName": "video", "whiteSpace": "normal", }, { + "attributes": [], "display": "inline", "tagName": "wbr", "whiteSpace": "normal", }, { + "attributes": [], "display": "block", "tagName": "xmp", "whiteSpace": "pre", diff --git a/tests/unit/html-elements.js b/tests/unit/html-elements.js index 18be3ebe6..33f64c03e 100644 --- a/tests/unit/html-elements.js +++ b/tests/unit/html-elements.js @@ -1,3 +1,4 @@ +import { elementAttributes, globalAttributes } from "@prettier/html-attributes"; import { htmlTags } from "@prettier/html-tags"; import { CSS_DISPLAY_DEFAULT, @@ -12,7 +13,12 @@ test("htmlTagNames", () => { tagName, display: CSS_DISPLAY_TAGS[tagName] ?? CSS_DISPLAY_DEFAULT, whiteSpace: CSS_WHITE_SPACE_TAGS[tagName] ?? CSS_WHITE_SPACE_DEFAULT, + attributes: elementAttributes[tagName] ?? [], })); expect(data).toMatchSnapshot(); }); + +test("Global attributes", () => { + expect(globalAttributes).toMatchSnapshot(); +}); diff --git a/yarn.lock b/yarn.lock index 30616bf8b..fb36fb59d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2450,6 +2450,13 @@ __metadata: languageName: node linkType: hard +"@prettier/html-attributes@npm:0.0.1": + version: 0.0.1 + resolution: "@prettier/html-attributes@npm:0.0.1" + checksum: 10/fcc1aae312837164220d6069ddae37790c02570b9798db92cd2cf55621944b6aef2e820faf24a4d2abcfd35315c008a29c1ba3bfc1a1ab4acc122ca399088f44 + languageName: node + linkType: hard + "@prettier/html-event-attributes@npm:0.0.2": version: 0.0.2 resolution: "@prettier/html-event-attributes@npm:0.0.2" @@ -5448,13 +5455,6 @@ __metadata: languageName: node linkType: hard -"html-element-attributes@npm:3.5.0": - version: 3.5.0 - resolution: "html-element-attributes@npm:3.5.0" - checksum: 10/b266e3b6170325f8d70c799692925d46b7686d7438f083bf449af47796175e69494e1f7a583ae18dc0e8703108a9f248eb4efc9016d459f8898c41266f54e4d2 - languageName: node - linkType: hard - "html-escaper@npm:^2.0.0": version: 2.0.2 resolution: "html-escaper@npm:2.0.2" @@ -8249,6 +8249,7 @@ __metadata: "@eslint/js": "npm:10.0.1" "@glimmer/syntax": "npm:0.95.0" "@prettier/cli": "npm:0.12.0" + "@prettier/html-attributes": "npm:0.0.1" "@prettier/html-event-attributes": "npm:0.0.2" "@prettier/html-tags": "npm:2.2.0" "@prettier/parse-srcset": "npm:3.1.0" @@ -8309,7 +8310,6 @@ __metadata: graphql: "npm:17.0.2" graphql-test-suite: "npm:0.0.2" hermes-parser: "npm:0.37.0" - html-element-attributes: "npm:3.5.0" html-ua-styles: "npm:0.5.0" ignore: "npm:7.0.6" import-meta-resolve: "npm:4.2.0"