[ci] format

This commit is contained in:
natemoo-re 2022-05-31 17:17:36 +00:00 committed by github-actions[bot]
parent 119ecf8d46
commit 9a31e6f1d5
3 changed files with 13 additions and 16 deletions

View file

@ -291,23 +291,27 @@ describe('Astro Markdown', () => {
expect(slots.find('> .fragmentSlot > div').text()).to.contain('1:');
expect(slots.find('> .fragmentSlot > div + p').text()).to.contain('2:');
expect(slots.find('> .pSlot > p[title="hello"]').text()).to.contain('3:');
expect(slots.find('> .defaultSlot').text().replace(/\s+/g, ' ')).to.equal(`
expect(slots.find('> .defaultSlot').text().replace(/\s+/g, ' ')).to.equal(
`
4: Div in default slot
5: Paragraph in fragment in default slot
6: Regular text in default slot
`.replace(/\s+/g, ' '));
`.replace(/\s+/g, ' ')
);
const nestedSlots = $('article').eq(1);
expect(nestedSlots.find('> .fragmentSlot').html()).to.contain('1:');
expect(nestedSlots.find('> .pSlot > p').text()).to.contain('2:');
expect(nestedSlots.find('> .defaultSlot > article').text().replace(/\s+/g, ' ')).to.equal(`
expect(nestedSlots.find('> .defaultSlot > article').text().replace(/\s+/g, ' ')).to.equal(
`
3: nested fragmentSlot
4: nested pSlot
5: nested text in default slot
`.replace(/\s+/g, ' '));
`.replace(/\s+/g, ' ')
);
expect($('article').eq(3).text().replace(/[^❌]/g, '')).to.equal('❌❌❌');
expect($('article').eq(4).text().replace(/[^❌]/g, '')).to.equal('❌❌❌');
});
});

View file

@ -7,9 +7,8 @@ export default function rehypeJsx(): any {
child.tagName = `${child.tagName}`;
});
visit(node, MDX_ELEMENTS, (child: any, index: number | null, parent: any) => {
if (index === null || !Boolean(parent))
return;
if (index === null || !Boolean(parent)) return;
const attrs = child.attributes.reduce((acc: any[], entry: any) => {
let attr = entry.value;
if (attr && typeof attr === 'object') {

View file

@ -49,9 +49,7 @@ describe('components', () => {
it('should normalize children', async () => {
const { code } = await renderMarkdown(`<Component bool={true}>Hello world!</Component>`, {});
chai
.expect(code)
.to.equal(`\n<Component bool={true}>Hello world!</Component>\n`);
chai.expect(code).to.equal(`\n<Component bool={true}>Hello world!</Component>\n`);
});
it('should be able to nest components', async () => {
@ -73,10 +71,6 @@ describe('components', () => {
{}
);
chai
.expect(code)
.to.equal(
`\n<Component><h1 id="hello-world">Hello world!</h1></Component>\n`
);
chai.expect(code).to.equal(`\n<Component><h1 id="hello-world">Hello world!</h1></Component>\n`);
});
});