Skip to content

Commit

Permalink
Add test for issue 324
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinigami92 committed Jan 9, 2022
1 parent d54adf0 commit 09b5414
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 0 deletions.
39 changes: 39 additions & 0 deletions tests/issues/issue-324/formatted.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
mixin section-intro(content)
section.section.section--intro(data-chameleon='black')
.wrapper
.section__header
if content.subhead
p.section__subhead.enter.enter--bottom!= content.subhead
p.section__heading.enter.enter--bottom.enter--delay-1!= content.heading

.section__row
each column in content.content
.section__column
.section__content.enter.enter--bottom.enter--delay-2
p.section__content-subhead!= column.subhead
each paragraph in column.text
p.section__content-text!= paragraph

if content.image
img.section__image.enter.enter--bottom.enter--delay-3(
src=`/${relativeRoot}assets/images/work/${content.image}`,
alt=''
)

if block
block

+section-intro({
subhead: 'Introduction',
heading: 'Helping candidates and employers connect through a streamlined platform, all while ensuring no one is left out. ',
content: [
{
subhead: 'The Problem',
text: ['Employers are eager to higher a diverse workforce, but struggle to manage the daunting process to access talent that meets their needs. Underrepresented job seekers often go unnoticed or worse, get passed up based on existing market biases. ']
},
{
subhead: 'The Solution',
text: ['Create a network that prioritizes inclusivity and transparency by uniting job seekers with employers based on their common strengths. For employers and admins, use thoughtful automation to encourage autonomy.']
}
]
})
31 changes: 31 additions & 0 deletions tests/issues/issue-324/issue-324.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { readFileSync } from 'fs';
import { resolve } from 'path';
import { format } from 'prettier';
import { describe, expect, test } from 'vitest';
import { plugin } from './../../../src/index';

describe('Issues', () => {
test('should respect printWidth for args in call token', () => {
const expected: string = readFileSync(
resolve(__dirname, 'formatted.pug'),
'utf8',
);
const code: string = readFileSync(
resolve(__dirname, 'unformatted.pug'),
'utf8',
);
const actual: string = format(code, {
parser: 'pug',
plugins: [plugin],

semi: true,
trailingComma: 'es5',
singleQuote: true,
printWidth: 80,
tabWidth: 2,
endOfLine: 'auto',
});

expect(actual).toBe(expected);
});
});
36 changes: 36 additions & 0 deletions tests/issues/issue-324/unformatted.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
mixin section-intro(content)
section.section.section--intro(data-chameleon='black')
.wrapper
.section__header
if content.subhead
p.section__subhead.enter.enter--bottom!= content.subhead
p.section__heading.enter.enter--bottom.enter--delay-1!= content.heading

.section__row
each column in content.content
.section__column
.section__content.enter.enter--bottom.enter--delay-2
p.section__content-subhead!= column.subhead
each paragraph in column.text
p.section__content-text!= paragraph

if content.image
img.section__image.enter.enter--bottom.enter--delay-3(src=`/${relativeRoot}assets/images/work/${content.image}`, alt='')

if block
block

+section-intro({
subhead: 'Introduction',
heading: 'Helping candidates and employers connect through a streamlined platform, all while ensuring no one is left out. ',
content: [
{
subhead: 'The Problem',
text: ['Employers are eager to higher a diverse workforce, but struggle to manage the daunting process to access talent that meets their needs. Underrepresented job seekers often go unnoticed or worse, get passed up based on existing market biases. ']
},
{
subhead: 'The Solution',
text: ['Create a network that prioritizes inclusivity and transparency by uniting job seekers with employers based on their common strengths. For employers and admins, use thoughtful automation to encourage autonomy.']
}
]
})

0 comments on commit 09b5414

Please sign in to comment.