Skip to content

Conversation

Smrtnyk
Copy link
Contributor

@Smrtnyk Smrtnyk commented Apr 20, 2025

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

Copy link

codesandbox bot commented Apr 20, 2025

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview


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) {
Copy link
Contributor Author

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

Copy link
Contributor

Build Stats

file / KB (diff) bundled minified
fabric 913.867 (0) 301.234 (0)

"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
Copy link
Contributor Author

@Smrtnyk Smrtnyk Apr 20, 2025

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');
Copy link
Contributor Author

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

@Smrtnyk
Copy link
Contributor Author

Smrtnyk commented Apr 20, 2025

this concludes the porting of tests from qunit to vitest
After this is in I will open a PR where we also run same tests in chromium using vitest browser mode
it required some tweaks so tests still work on both chromium and jsdom but nothing big

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?
there is logic for qunit unit tests in cli part, in github actions, also some coverage related stuff, and qunit configs
I am not that familiar with github actions stuff and workflows so I don't feel comfortable touching those parts

@asturur
Copy link
Member

asturur commented Apr 21, 2025

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);
// });
});
Copy link
Member

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.

@asturur asturur merged commit 27f371b into fabricjs:master Apr 21, 2025
@asturur
Copy link
Member

asturur commented Apr 21, 2025

i may have merged too quick. i ll check and fix in case

@Smrtnyk Smrtnyk deleted the refactor(tests)-move-canvas-events-from-qunit-to-vitest branch May 9, 2025 04:14
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