Skip to content

Commit

Permalink
Address PR comments
Browse files Browse the repository at this point in the history
Tests have been combined and make better use of the afterEach snapshots.
  • Loading branch information
lekha committed Dec 3, 2020
1 parent ebb7472 commit 6bfe9f1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
11 changes: 1 addition & 10 deletions __tests__/classes/CanvasRenderingContext2D.__getClippingPath.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,9 @@ describe('__getClippingRegion', () => {
expect(region).toStrictEqual(ctx.__getClippingRegion());
});

it('should restore the clipping region correctly when restored', () => {
const region = ctx.__getClippingRegion();
ctx.save();
it('should delete current clipping region when restored', () => {
ctx.rect(1, 2, 3, 4);
ctx.arc(1, 2, 3, 4, 5);
ctx.clip();
expect(region).not.toStrictEqual(ctx.__getClippingRegion());
ctx.restore();
expect(region).toStrictEqual(ctx.__getClippingRegion());
});

it('should delete current clipping region when restored', () => {
ctx.save();
ctx.rect(1, 2, 3, 4);
ctx.arc(1, 2, 3, 4, 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,27 @@

exports[`__getClippingRegion should be empty when there are no path elements 1`] = `Array []`;

exports[`__getClippingRegion should delete current clipping region when restored 1`] = `Array []`;

exports[`__getClippingRegion should restore the clipping region correctly when restored 1`] = `Array []`;
exports[`__getClippingRegion should delete current clipping region when restored 1`] = `
Array [
Object {
"props": Object {
"height": 4,
"width": 3,
"x": 1,
"y": 2,
},
"transform": Array [
1,
0,
0,
1,
0,
0,
],
"type": "rect",
},
]
`;

exports[`__getClippingRegion should save the clipping region correctly when saved 1`] = `
Array [
Expand Down

0 comments on commit 6bfe9f1

Please sign in to comment.