Skip to content

Commit

Permalink
test: add attribute/value to locals, #76
Browse files Browse the repository at this point in the history
  • Loading branch information
Scrum committed Dec 1, 2021
1 parent 0d0a5c8 commit 2b49df4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/attribute.as.locals.spec.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div class="{{ class }}" id="{{ id }}" style="{{ style }}"><content></content></div>
9 changes: 9 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,12 @@ test('Must use parser options', async t => {

t.is(html, expected);
});

test('Must parse attribute as locals', async t => {
const actual = `<module href="./test/attribute.as.locals.spec.html" class="text-center uppercase" id="example" style="display: flex; gap: 2;">Module content</module>`;
const expected = `<div class="text-center uppercase" id="example" style="display: flex; gap: 2;">Module content</div>`;

const html = await posthtml().use(plugin({attributeAsLocals: true})).process(actual).then(result => clean(result.html));

t.is(html, expected);
});

0 comments on commit 2b49df4

Please sign in to comment.