Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add test cases (one is broken)
  • Loading branch information
kachkaev committed Jan 15, 2024
commit 0d2d29c4766627f6774af8435c25fc05482a2e1e
20 changes: 20 additions & 0 deletions tests/lib/rules/enforces-shorthand.js
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,26 @@ ruleTester.run("shorthands", rule, {
`,
errors: [generateError(["overflow-hidden", "text-ellipsis", "whitespace-nowrap"], "truncate")],
},
{
code: "<div className={ctl(`${live && 'bg-white'} w-full px-10 py-10`)}>Leading space trim issue with fix</div>",
output: "<div className={ctl(`${live && 'bg-white'} w-full p-10`)}>Leading space trim issue with fix</div>",
errors: [generateError(["px-10", "py-10"], "p-10")],
},
{
code: "<div className={ctl(`${live && 'bg-white'} w-full px-10 py-10 `)}>Leading space trim issue with fix (2)</div>",
output: "<div className={ctl(`${live && 'bg-white'} w-full p-10 `)}>Leading space trim issue with fix (2)</div>",
errors: [generateError(["px-10", "py-10"], "p-10")],
},
{
code: "<div className={ctl(`w-full px-10 py-10 ${live && 'bg-white'}`)}>Trailing space trim issue with fix</div>",
output: "<div className={ctl(`w-full p-10 ${live && 'bg-white'}`)}>Trailing space trim issue with fix</div>",
Copy link
Contributor Author

@kachkaev kachkaev Jan 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Observed output before the fix:

Suggested change
output: "<div className={ctl(`w-full p-10 ${live && 'bg-white'}`)}>Trailing space trim issue with fix</div>",
output: "<div className={ctl(`w-full p-10${live && 'bg-white'}`)}>Trailing space trim issue with fix</div>",

errors: [generateError(["px-10", "py-10"], "p-10")],
},
{
code: "<div className={ctl(` w-full px-10 py-10 ${live && 'bg-white'}`)}>Trailing space trim issue with fix (2)</div>",
output: "<div className={ctl(` w-full p-10 ${live && 'bg-white'}`)}>Trailing space trim issue with fix (2)</div>",
errors: [generateError(["px-10", "py-10"], "p-10")],
},
{
code: `<div class="h-10 w-10">New size-* utilities</div>`,
output: `<div class="size-10">New size-* utilities</div>`,
Expand Down