Files
test-repo/tests/format/html/attributes/lowercase/format.test.js
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

39 lines
1.0 KiB
JavaScript
Raw Normal View History

import { elementAttributes } from "@prettier/html-attributes";
import { htmlTags } from "@prettier/html-tags";
import { outdent } from "outdent";
const tagWithAttribute = elementAttributes.div
? "div"
: htmlTags.find((tag) => elementAttributes[tag]);
const tagWithoutAttribute = !elementAttributes.span
? "span"
: htmlTags.find((tag) => !elementAttributes[tag]);
runFormatTest(
{
importMeta: import.meta,
snippets: [
outdent`
<${tagWithAttribute}
CLASS="should print as lowercase"
UNKNOWN="should print as UPPERCASE"
>
Tag with attributes
</${tagWithAttribute}>
<${tagWithoutAttribute}
CLASS="should print as lowercase"
UNKNOWN="should print as UPPERCASE"
>
Tag without attributes
</${tagWithoutAttribute}>
<unknown
CLASS="should print as UPPERCASE"
UNKNOWN="should print as UPPERCASE"
>
Non-html element
</unknown>
`,
],
},
["html"],
);