diff --git a/index.compiler.spec.js b/index.compiler.spec.js
index efad811e..339c7df7 100644
--- a/index.compiler.spec.js
+++ b/index.compiler.spec.js
@@ -2833,12 +2833,30 @@ describe('overrides', () => {
it('should add props to the appropriate JSX tag if supplied', () => {
render(
compiler('Hello.\n\n', {
- overrides: { p: { props: { className: 'abc' } } },
+ overrides: { p: { props: { className: 'abc', title: 'foo' } } },
})
);
expect(root.children[0].className).toBe('abc');
expect(root.children[0].textContent).toBe('Hello.');
+ expect(root.children[0].title).toBe('foo');
+ });
+
+ it('should override the title property when parsing a link', () => {
+ class FakeLink extends React.Component {
+ render() {
+ const {title, children} = this.props
+ return {children}
+ }
+ }
+
+ render(
+ compiler('[link](https://example.org)', {
+ overrides: { a: {component: FakeLink, props: { title: 'foo' } } },
+ })
+ );
+
+ expect(root.children[0].title).toBe('foo');
});
it('should add props to pre & code tags if supplied', () => {
@@ -2966,8 +2984,8 @@ describe('overrides', () => {
expect($element.outerHTML).toMatchInlineSnapshot(`
diff --git a/index.js b/index.js
index 7f95486a..14398ac3 100644
--- a/index.js
+++ b/index.js
@@ -727,8 +727,8 @@ export function compiler(markdown, options) {
return createElementFn(
getTag(tag, options.overrides),
{
- ...overrideProps,
...props,
+ ...overrideProps,
className:
cx(props && props.className, overrideProps.className) || undefined,
},