-
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix class attributes not counting towards attribute wrapping (#503)
- Loading branch information
Showing
10 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
tests/options/pugWrapAttributesThreshold/withAsIsClassNotation/formatted.pug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
div(class="class") | ||
div( | ||
class="class", | ||
attribute="value" | ||
) | ||
.class(attribute="value") | ||
.class( | ||
attribute="value", | ||
another-attribute="another value" | ||
) |
4 changes: 4 additions & 0 deletions
4
tests/options/pugWrapAttributesThreshold/withAsIsClassNotation/unformatted.pug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
div(class="class") | ||
div(class="class" attribute="value") | ||
div.class(attribute="value") | ||
div.class(attribute="value" another-attribute="another value") |
17 changes: 17 additions & 0 deletions
17
...ptions/pugWrapAttributesThreshold/withAsIsClassNotation/with-as-is-class-notation.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { compareFiles } from 'tests/common'; | ||
import { describe, expect, it } from 'vitest'; | ||
|
||
describe('Options', () => { | ||
describe('pugWrapAttributesThreshold', () => { | ||
it('should count attribute classes toward wrapping if pugClassNotation === as-is', async () => { | ||
const { actual, expected } = await compareFiles(import.meta.url, { | ||
formatOptions: { | ||
pugWrapAttributesThreshold: 1, | ||
pugClassNotation: 'as-is', | ||
}, | ||
}); | ||
|
||
expect(actual).toBe(expected); | ||
}); | ||
}); | ||
}); |
10 changes: 10 additions & 0 deletions
10
tests/options/pugWrapAttributesThreshold/withAsIsIdNotation/formatted.pug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
div(id="foo") | ||
div( | ||
id="foo", | ||
attribute="value" | ||
) | ||
#foo(attribute="value") | ||
#foo( | ||
attribute="value", | ||
another-attribute="another value" | ||
) |
4 changes: 4 additions & 0 deletions
4
tests/options/pugWrapAttributesThreshold/withAsIsIdNotation/unformatted.pug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
div(id="foo") | ||
div(id="foo" attribute="value") | ||
div#foo(attribute="value") | ||
div#foo(attribute="value" another-attribute="another value") |
17 changes: 17 additions & 0 deletions
17
tests/options/pugWrapAttributesThreshold/withAsIsIdNotation/with-as-is-id-notation.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { compareFiles } from 'tests/common'; | ||
import { describe, expect, it } from 'vitest'; | ||
|
||
describe('Options', () => { | ||
describe('pugWrapAttributesThreshold', () => { | ||
it('should count attribute IDs toward wrapping if pugIdNotation === as-is', async () => { | ||
const { actual, expected } = await compareFiles(import.meta.url, { | ||
formatOptions: { | ||
pugWrapAttributesThreshold: 1, | ||
pugIdNotation: 'as-is', | ||
}, | ||
}); | ||
|
||
expect(actual).toBe(expected); | ||
}); | ||
}); | ||
}); |
5 changes: 5 additions & 0 deletions
5
tests/options/pugWrapAttributesThreshold/withAttributeClassNotation/formatted.pug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
div(class="class") | ||
div( | ||
class="class", | ||
attribute="value" | ||
) |
2 changes: 2 additions & 0 deletions
2
tests/options/pugWrapAttributesThreshold/withAttributeClassNotation/unformatted.pug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
div(class="class") | ||
div(class="class" attribute="value") |
17 changes: 17 additions & 0 deletions
17
...gWrapAttributesThreshold/withAttributeClassNotation/with-attribute-class-notation.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { compareFiles } from 'tests/common'; | ||
import { describe, expect, it } from 'vitest'; | ||
|
||
describe('Options', () => { | ||
describe('pugWrapAttributesThreshold', () => { | ||
it('should count attribute classes toward wrapping if pugClassNotation === attribute', async () => { | ||
const { actual, expected } = await compareFiles(import.meta.url, { | ||
formatOptions: { | ||
pugWrapAttributesThreshold: 1, | ||
pugClassNotation: 'attribute', | ||
}, | ||
}); | ||
|
||
expect(actual).toBe(expected); | ||
}); | ||
}); | ||
}); |