Skip to content

Commit

Permalink
Publish Next Version (#404)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and github-actions[bot] committed Feb 18, 2022
1 parent 33ddf04 commit 03aee61
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 58 deletions.
5 changes: 0 additions & 5 deletions .changeset/heavy-wombats-vanish.md

This file was deleted.

52 changes: 0 additions & 52 deletions .changeset/spicy-peas-help.md

This file was deleted.

57 changes: 57 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,62 @@
# pleasantest

## 1.7.0

### Minor Changes

- [#403](https://github.com/cloudfour/pleasantest/pull/403) [`6ceb029`](https://github.com/cloudfour/pleasantest/commit/6ceb029be3152ed7b7d34a1a6b643591f1ce7cf2) Thanks [@calebeby](https://github.com/calebeby)! - Expose `accessibilityTreeSnapshotSerializer`. This is the snapshot serializer that Pleasantest configures Jest to use to format accessibility tree snapshots. It was enabled by default in previous versions, and it still is, just now it is also exposed as an export so you can pass the snapshot serializer to other tools, like [`snapshot-diff`](https://github.com/jest-community/snapshot-diff).

Here's an example of using this:

This part you'd put in your test setup file (configured in Jest's `setupFilesAfterEnv`):

```js
import snapshotDiff from 'snapshot-diff';

expect.addSnapshotSerializer(snapshotDiff.getSnapshotDiffSerializer());
snapshotDiff.setSerializers([
{
test: accessibilityTreeSnapshotSerializer.test,
// @ts-ignore
print: (value) => accessibilityTreeSnapshotSerializer.serialize(value),
diffOptions: () => ({ expand: true }),
},
]);
```

Then in your tests:

```js
const beforeSnap = await getAccessibilityTree(element);

// ... interact with the DOM

const afterSnap = await getAccessibilityTree(element);

expect(snapshotDiff(beforeSnap, afterSnap)).toMatchInlineSnapshot(`
Snapshot Diff:
- First value
+ Second value
region "Summary"
heading "Summary"
text "Summary"
list
listitem
text "Items:"
- text "2"
+ text "5"
link "Checkout"
text "Checkout"
`);
```

The diff provided by snapshotDiff automatically highlights the differences between the snapshots, to make it clear to the test reader what changed in the page accessibility structure as the interactions happened.

### Patch Changes

- [#412](https://github.com/cloudfour/pleasantest/pull/412) [`33ddf04`](https://github.com/cloudfour/pleasantest/commit/33ddf047aef3dfb43fdd31eedc3da491e50b7df9) Thanks [@calebeby](https://github.com/calebeby)! - Ignore HTML comments in `getAccessibilityTree` output (potentially breaking bugfix)

## 1.6.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "pleasantest",
"version": "1.6.0",
"version": "1.7.0",
"engines": {
"node": "^12.2 || 14 || 16 || 17"
},
Expand Down

0 comments on commit 03aee61

Please sign in to comment.