Skip to content

Commit

Permalink
Added test
Browse files Browse the repository at this point in the history
  • Loading branch information
jeawhanlee committed Oct 10, 2024
1 parent c5d1b02 commit b56057d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/BeaconLrc.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,21 @@ describe('BeaconLrc', function() {
_skipElementStub.restore();
});

it('should skip elements with svg use', function() {
const _getElementDepthStub = sinon.stub(beaconLrc, '_getElementDepth');
_getElementDepthStub.returns(1);

const _svgElementStub = sinon.stub(beaconLrc, '_getSvgUseTargets');
_svgElementStub.returns([mockElements[2]]);

const elements = beaconLrc._getLazyRenderElements();
const skippedElement = elements.find(el => el.hash === 'hash3');
assert.strictEqual(skippedElement, undefined);

_getElementDepthStub.restore();
_svgElementStub.restore();
});

it('should return correct distance', () => {
const distance = beaconLrc._getElementDistance(mockElements[2]);
assert.strictEqual(distance, 600);
Expand Down

0 comments on commit b56057d

Please sign in to comment.