mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-13 09:07:29 +02:00
* chore(utils): add `removeTitle: false` to svg loader By default, SVGR removes the `<title>` tag from SVG inputs. This hinders a11y since "the `<title>` element provides an accessible, short-text description of any SVG container element or graphics element". Modern browsers also show tooltips on hover for inline SVG with the `<title>` tag. See https://developer.mozilla.org/en-US/docs/Web/SVG/Element/title * fix test
34 lines
949 B
TypeScript
34 lines
949 B
TypeScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
import {getFileLoaderUtils} from '../webpackUtils';
|
|
|
|
describe('getFileLoaderUtils()', () => {
|
|
test('plugin svgo/removeViewBox and removeTitle should be disabled', () => {
|
|
const {oneOf} = getFileLoaderUtils().rules.svg();
|
|
expect(oneOf[0].use).toContainEqual(
|
|
expect.objectContaining({
|
|
loader: require.resolve('@svgr/webpack'),
|
|
options: expect.objectContaining({
|
|
svgoConfig: {
|
|
plugins: [
|
|
{
|
|
name: 'preset-default',
|
|
params: {
|
|
overrides: {
|
|
removeTitle: false,
|
|
removeViewBox: false,
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
}),
|
|
}),
|
|
);
|
|
});
|
|
});
|