-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
refactor(tests): move canvas events tests from qunit to vitest #10563
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
refactor(tests): move canvas events tests from qunit to vitest #10563
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
|
||
canvas.on('mouse:down', function (options) { | ||
// TODO: fix this, for some reason first target on mouse down is active selection and then second target is the green rectangle | ||
if (options.target instanceof ActiveSelection) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@asturur I don't know how this test worked in qunit but in both jsdom and in the browser the first event that comes here is Active selection and then the green box
I guess you will have to have a look here since you have far more knowledge than I do when it comes to fabric source code
for now I workarounded this with a return if it is now a green box but clearly this is not a solution
Build Stats
|
"mousemove: subTargetCheck: setCursorFromEvent considers subTargets in reverse order, so the top-most subTarget's .hoverCursor takes precedence", | ||
); | ||
|
||
// TODO: ported from qunit, check if is still valid for vitest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ported this thing as well but I don't know if it is relevant
expect(getTarget(), 'should unregister b').toBeFalsy(); | ||
}); | ||
|
||
it.todo('mousemove: subTargetCheck: setCursorFromEvent considers subTargets'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also ported these two as test todos so it doesn't get lost in case it is something that should be actually done
this concludes the porting of tests from qunit to vitest after that is done I will work on making tests run on firefox and webkit as well @asturur maybe you could do the cleanup of the qunit setup for unit tests? |
i ll try to clean up yes |
// expect(!!canvas.actionIsDisabled('br', target, e), 'br action is not disabled lockSkewingX').toBe(false); | ||
// expect(!!canvas.actionIsDisabled('mtr', target, e), 'mtr action is not disabled lockSkewingX').toBe(false); | ||
// }); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right there was this disabled action logic that was never ported to the action themselves i guess. I don't remember very well, controls could be refactored twice and still be sub optimal.
trying to have both a configuration approach and a code approach to default actions and custom actions has proved to be both confusing and hard.
i may have merged too quick. i ll check and fix in case |
this is the last unit test in qunit that was left
there is a todo in the test in one test which I will comment inline