72c760e9b8
* feat(image): throw if no `alt` is provided * chore: add changeset * docs(image): update README * updated alt text stuff throughout * fixing with-mdx test suite * warn for missing alt text, will throw an error in a future release * final README tweaks Co-authored-by: Tony Sullivan <tony.f.sullivan@outlook.com> Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
33 lines
1 KiB
JavaScript
33 lines
1 KiB
JavaScript
import { expect } from 'chai';
|
|
import { loadFixture } from './test-utils.js';
|
|
import testAdapter from '../../../astro/test/test-adapter.js';
|
|
|
|
let fixture;
|
|
|
|
const errorMessage =
|
|
'The <Picture> component requires you provide alt text. If this picture does not require an accessible label, set alt="".';
|
|
|
|
/** TODO: enable the test once missing alt text throws an error instead of a console warning */
|
|
describe.skip('SSR picture without alt text', function () {
|
|
before(async () => {
|
|
fixture = await loadFixture({
|
|
root: './fixtures/no-alt-text-picture/',
|
|
adapter: testAdapter({ streaming: false }),
|
|
output: 'server',
|
|
});
|
|
await fixture.build();
|
|
});
|
|
|
|
it('throws during build', async () => {
|
|
try {
|
|
const app = await fixture.loadTestAdapterApp();
|
|
const request = new Request('http://example.com/');
|
|
const response = await app.render(request);
|
|
await response.text();
|
|
} catch (err) {
|
|
expect(err.message).to.equal(errorMessage);
|
|
return;
|
|
}
|
|
expect.fail(0, 1, 'Exception not thrown');
|
|
});
|
|
});
|