Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reset function #123

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Add reset function #123

wants to merge 3 commits into from

Conversation

Tsubashi
Copy link

@Tsubashi Tsubashi commented Aug 10, 2024

I'd like to use this library, but my project uses the reset function pretty heavily which is currently missing from this mock. This PR adds that function to the mock.

@@ -1446,6 +1447,21 @@ export default class CanvasRenderingContext2D {
this._path.push(event);
}

reset() {
if (arguments.length > 0) {
throw new TypeError(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the information thrown standardized?

Copy link
Author

@Tsubashi Tsubashi Aug 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what you mean by this. I tried to make it match the information used in the rect function.

});

it('should throw if any parameters are given', () => {
expect(() => ctx.rect(1)).toThrow(TypeError);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test the throw message.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, something like expect(() => ctx.reset(1)).toThrow(/Failed to execute 'reset' on/);?

@Tsubashi
Copy link
Author

I'm not sure if there is more you need me to do, but if so, please let me know. I am eager to get this merged.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants