Skip to content

Commit

Permalink
test(heading): add test for aria-labels being passed properly (#234)
Browse files Browse the repository at this point in the history
[<img height=20 src=https://readme.com/static/favicon.ico align=center>][demo] | Fixes RM-1571
:---:|:---:

## 🧰 Changes

- Test if aria-label is being applied correctly — Related to this [PR](#230)

## 🧬 QA & Testing

Does the snapshot of the heading component look as expected?

- [Broken on production][prod].
- [Working in this PR app][demo].

[demo]: https://markdown-pr-234.herokuapp.com
[prod]: https://developers.readme.io
  • Loading branch information
macuzi authored Sep 20, 2021
1 parent d284d2d commit 3a5030f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions __tests__/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,8 @@ exports[`export multiple Markdown renderers renders plain markdown as React 1`]

exports[`export multiple Markdown renderers renders plainText from AST 1`] = `"Hello World"`;

exports[`heading 1`] = `"<h2 class=\\"heading heading-2 header-scroll\\" align=\\"\\"><div class=\\"heading-anchor anchor waypoint\\" id=\\"example-header\\"></div><div class=\\"heading-text\\"><div id=\\"section-example-header\\" class=\\"heading-anchor_backwardsCompatibility\\"></div>Example Header</div><a aria-label=\\"Skip link to Example Header\\" class=\\"heading-anchor-icon fa fa-anchor\\" href=\\"#example-header\\"></a></h2>"`;
exports[`image 1`] = `"<p><span aria-label=\\"Image\\" class=\\"img\\" role=\\"button\\" tabindex=\\"0\\"><img src=\\"http://example.com/image.png\\" alt=\\"Image\\" align=\\"\\" caption=\\"\\" height=\\"auto\\" title=\\"\\" width=\\"auto\\"><span class=\\"lightbox\\" role=\\"dialog\\" tabindex=\\"0\\"><span class=\\"lightbox-inner\\"><img src=\\"http://example.com/image.png\\" align=\\"\\" caption=\\"\\" height=\\"auto\\" title=\\"Click to close...\\" width=\\"auto\\" alt=\\"Image\\" class=\\"lightbox-img\\" loading=\\"lazy\\"></span></span></span></p>"`;
exports[`list items 1`] = `
Expand Down
4 changes: 4 additions & 0 deletions __tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ test('image', () => {
expect(mount(markdown.default('![Image](http://example.com/image.png)')).html()).toMatchSnapshot();
});

test('heading', () => {
expect(mount(markdown.default('## Example Header')).html()).toMatchSnapshot();
});

test('magic image', () => {
expect(
mount(
Expand Down

0 comments on commit 3a5030f

Please sign in to comment.