Skip to content

Commit

Permalink
change order of prop overriding
Browse files Browse the repository at this point in the history
  • Loading branch information
mstruebing committed Feb 28, 2019
1 parent ac97191 commit 9e8701e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.compiler.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2966,8 +2966,8 @@ describe('overrides', () => {
expect($element.outerHTML).toMatchInlineSnapshot(`
<input type="checkbox"
class="foo"
readonly
class="foo"
value="on"
>
Expand Down
16 changes: 16 additions & 0 deletions index.component.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,19 @@ it('passes along any additional props to the rendered wrapper element', () => {
`);
});

it('passes along any additional props including title to the rendered wrapper element', () => {
render(<Markdown className="foo" title="bar"># Hello</Markdown>);

expect(root.innerHTML).toMatchInlineSnapshot(`
<h1 data-reactroot
id="hello"
class="foo"
title="bar"
>
Hello
</h1>
`);
});
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down

0 comments on commit 9e8701e

Please sign in to comment.