Skip to content

Commit b7fca60

Browse files
committed
Add comprehensive dispose() tests and update docs
Introduces a new test suite for the dispose() method covering all major classes, including event unbinding, DOM cleanup, and resource disposal. Updates documentation for Shape.dispose() in both code and type definitions for clarity. Ensures dispose.js is included in test runners.
1 parent 0b2da58 commit b7fca60

File tree

5 files changed

+1542
-2
lines changed

5 files changed

+1542
-2
lines changed

src/shape.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,7 @@ export class Shape extends Element {
354354
/**
355355
* @name Two.Shape#dispose
356356
* @function
357-
* @description Release the element's renderer object and detach any events.
358-
* This cleans up renderer-specific resources and unbinds all event listeners.
357+
* @description Release the shape's bound objects by unbinding relevant events.
359358
*/
360359
dispose() {
361360
// Call parent dispose to preserve renderer type and unbind events

tests/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<script src="./suite/svg-interpreter.js"></script>
2828
<script src="./suite/bounding-box.js"></script>
2929
<script src="./suite/release.js"></script>
30+
<script src="./suite/dispose.js"></script>
3031
<script src="./suite/hit-test.js"></script>
3132
</div>
3233
</body>

tests/noWebGL.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
<script src="./suite/svg-interpreter.js"></script>
2424
<script src="./suite/bounding-box.js"></script>
2525
<script src="./suite/release.js"></script>
26+
<script src="./suite/dispose.js"></script>
2627

2728
</div>
2829
</body>

0 commit comments

Comments
 (0)