Skip to content

Conversation

Smrtnyk
Copy link
Contributor

@Smrtnyk Smrtnyk commented Apr 15, 2025

this moves canvas dispose tests from qunit to vitest

Copy link

codesandbox bot commented Apr 15, 2025

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link
Contributor

It seems that you opened a PR but you didn't add a line to the changelog file
Please under the ## [next] version tag, add a line describing the changes of your pr with this format:
ci/chore/tests/feature/fix(): Some extended description #10536
Example:

  refactor(tests): move canvas dispose tests from qunit to vitest [#10536](https://github.com/fabricjs/fabric.js/pull/10536)

expect(canvas.disposed, 'should flag `disposed`').toBeTruthy();
}
called++;
// TODO: check typings, because this runs for both static and normal canvas but it is only typed on normal canvas
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 left this comment here in case you are curious

Copy link
Member

Choose a reason for hiding this comment

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

FabricJS typings have been hard.
The fact that every class of object carries with it the types of the export and the props it expects in the constructor makes everything complicated.

Collection.ts is a piece of code shared between group and staticCanvas so it is a mixin, but TS doesn't really support mixins natively.

The staticCanvas works with fabricObejct while Canvas works with InteractiveObject.

The migration from plain JS to TS was done how it could have been done and bigger rewrites are necessary to make typing smooth.

Our issues are mainly docs and time dedicated to it. If we ever manage to write good docs with explanations and overwies then those refactors are less painful because you know what kind of documentation you have to keep updated as well.

For now it is what is is, autocompletion of classes,properties,custom properties and events works and that is a big upside, the rest will come a piece at time.

Copy link
Contributor

Build Stats

file / KB (diff) bundled minified
fabric 913.863 (0) 301.232 (0)

Copy link
Contributor


> fabric@6.6.2 coverage:report:ci
> nyc report --reporter=text-summary


=============================== Coverage summary ===============================
Statements   : 72.83% ( 20928/28732 )
Branches     : 59.92% ( 3855/6433 )
Functions    : 87.27% ( 1571/1800 )
Lines        : 77.42% ( 16036/20712 )
================================================================================

@asturur asturur merged commit 668c19a into fabricjs:master Apr 16, 2025
21 checks passed
@Smrtnyk Smrtnyk deleted the refactor(tests)-move-canvas-dispose-tests-from-qunit-to-vitest branch April 17, 2025 12:45
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