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

feat: Renamed misleading method setCropzoneRect to setCropzoneRatio and created a setCropzoneRect method #746

Closed
wants to merge 2 commits into from

Conversation

Mouradif
Copy link

  • Added method setCropzoneRect()
  • Renamed old method setCropzoneRect() to a more suitable name setCropzoneRatio()
  • Added a single unit test to ensure it works in its most basic scenario

close #596

- Added method setCropzoneRect()
- Renamed old method setCropzoneRect() to a more suitable name setCropzoneRatio()
- Added a single unit test to ensure it works in its most basic scenario
@wenjing-pure
Copy link

Thank you very much. when will this feature be merged and published by the repository maintainer to NPM?

Copy link
Contributor

@lja1018 lja1018 left a comment

Choose a reason for hiding this comment

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

@Mouradif
I'll finish my review.
Please check the lint error.

expect(cropper.getCropzoneRect()).toBeNull();
});
});

describe('setCropzoneRect()', () => {
it('should set cropzone rectangle', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

This test is broken. Please check.

Copy link
Author

@Mouradif Mouradif Mar 30, 2022

Choose a reason for hiding this comment

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

How do you run tests btw? All the tests come out as broken on my end when I run jest because it doesn't resolve imports:

 FAIL  apps/image-editor/tests/flip.spec.js
  ● Test suite failed to run

    Cannot find module '@/graphics' from 'apps/image-editor/tests/flip.spec.js'

      1 | import { fabric } from 'fabric';
    > 2 | import Graphics from '@/graphics';
        | ^
      3 | import Flip from '@/component/flip';
      4 |

Copy link
Contributor

Choose a reason for hiding this comment

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

Did you run npm run test on apps/image-editor?

@@ -258,7 +258,7 @@ imageEditor.setBrush({
width: 20,
color: '#FFFFFF',
});
imageEditor.setCropzoneRect(1 / 1);
imageEditor.setCropzoneRatio(1 / 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add setCropzoneRect type test.

Copy link
Author

Choose a reason for hiding this comment

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

Could you link me to a documentation on type test? I haven't seen these before

Copy link
Contributor

Choose a reason for hiding this comment

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

It means this file. setCropzoneRect changed to setCropzoneRatio so setCropzoneRect is missing.

@Mouradif
Copy link
Author

Mouradif commented Mar 30, 2022

@Mouradif I'll finish my review. Please check the lint error.

Running eslint on the project gives me 6 errors and 9 warnings. None One of them are is related to my changes. Pushing fix now

@stale
Copy link

stale bot commented Jun 12, 2022

This issue has been automatically marked as inactive because there hasn’t been much going on it lately. It is going to be closed after 7 days. Thanks!

@stale stale bot added the inactive label Jun 12, 2022
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

setCropzoneRect method name is misleading + need a real method to set the cropzone rect
3 participants