Skip to content

Commit

Permalink
Tests: Added a missing test for Rect instances preserving source info…
Browse files Browse the repository at this point in the history
…rmation while intersecting with another Rect.
  • Loading branch information
oleq committed Sep 7, 2023
1 parent 21d1597 commit d8672c3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/ckeditor5-utils/tests/dom/rect.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,18 @@ describe( 'Rect', () => {
expect( insersect ).to.not.equal( rect );
} );

it( 'should pass the original Rect source on for further processing', () => {
const elementA = document.createElement( 'div' );
const elementB = document.createElement( 'div' );
const rectA = new Rect( elementA );
const rectB = new Rect( elementB );
const insersect = rectA.getIntersection( rectB );

expect( rectA._source ).to.equal( elementA );
expect( rectB._source ).to.equal( elementB );
expect( insersect._source ).to.equal( elementA );
} );

it( 'should calculate the geometry (#1)', () => {
const rectA = new Rect( {
top: 0,
Expand Down

0 comments on commit d8672c3

Please sign in to comment.