Skip to content

Commit

Permalink
test: ensure that outputs are not visted by alt-text visitor
Browse files Browse the repository at this point in the history
  • Loading branch information
agoose77 committed Jan 27, 2025
1 parent 689a6ad commit be7097f
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions packages/myst-transforms/src/images.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,40 @@ describe('Test imageNoAltTextTransform', () => {
expect(file.messages.length).toBe(1);
expect(file.messages[0].message.includes('was auto-generated')).toBe(true);
});
test('image inside output does not generate warning', () => {
const mdast = {
type: 'root',
children: [
{
type: 'output',
children: [
{
type: 'image',
url: 'https://images.com/cats',
align: 'center',
},
],
},
],
};
const file = new VFile();
imageNoAltTextTransform(mdast, file);
expect(mdast).toEqual({
type: 'root',
children: [
{
type: 'output',
children: [
{
type: 'image',
url: 'https://images.com/cats',
align: 'center',
},
],
},
],
});
// A warning was created
expect(file.messages.length).toBe(0);
});
});

0 comments on commit be7097f

Please # to comment.