Skip to content

Commit

Permalink
Simplify and update the test
Browse files Browse the repository at this point in the history
  • Loading branch information
yuriy-fix committed May 8, 2019
1 parent 5721cf3 commit c2bde74
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions test/items.html
Expand Up @@ -449,15 +449,15 @@
const scrollDistance = 150;

// Default indentation is 16
expect(rootOverlay.getBoundingClientRect().top).to.equal(16);
expect(subOverlay1.getBoundingClientRect().top).to.equal(16);
expect(subOverlay2.getBoundingClientRect().top).to.equal(88);
const rootBRCTop = rootOverlay.getBoundingClientRect().top;
const subBRCTop1 = subOverlay1.getBoundingClientRect().top;
const subBRCTop2 = subOverlay2.getBoundingClientRect().top;

scrollElm.scrollTop = scrollDistance;
Polymer.RenderStatus.afterNextRender(rootMenu, () => {
expect(rootOverlay.getBoundingClientRect().top).to.equal(16 - scrollDistance);
expect(subOverlay1.getBoundingClientRect().top).to.equal(16 - scrollDistance);
expect(subOverlay2.getBoundingClientRect().top).to.equal(88 - scrollDistance);
expect(rootOverlay.getBoundingClientRect().top).to.be.closeTo(rootBRCTop - scrollDistance, 1);
expect(subOverlay1.getBoundingClientRect().top).to.be.closeTo(subBRCTop1 - scrollDistance, 1);
expect(subOverlay2.getBoundingClientRect().top).to.be.closeTo(subBRCTop2 - scrollDistance, 1);
done();
});
});
Expand All @@ -466,15 +466,15 @@
const scrollDistance = 150;

// Default indentation is 16
expect(rootOverlay.getBoundingClientRect().left).to.equal(16);
expect(subOverlay1.getBoundingClientRect().left).to.be.closeTo(126, 5);
expect(subOverlay2.getBoundingClientRect().left).to.be.closeTo(253, 5);
const rootBRCLeft = rootOverlay.getBoundingClientRect().left;
const subBRCLeft1 = subOverlay1.getBoundingClientRect().left;
const subBRCLeft2 = subOverlay2.getBoundingClientRect().left;

scrollElm.scrollLeft = scrollDistance;
Polymer.RenderStatus.afterNextRender(rootMenu, () => {
expect(rootOverlay.getBoundingClientRect().left).to.equal(16 - scrollDistance);
expect(subOverlay1.getBoundingClientRect().left).to.be.closeTo(126 - scrollDistance, 5);
expect(subOverlay2.getBoundingClientRect().left).to.be.closeTo(253 - scrollDistance, 5);
expect(rootOverlay.getBoundingClientRect().left).to.be.closeTo(rootBRCLeft - scrollDistance, 1);
expect(subOverlay1.getBoundingClientRect().left).to.be.closeTo(subBRCLeft1 - scrollDistance, 1);
expect(subOverlay2.getBoundingClientRect().left).to.be.closeTo(subBRCLeft2 - scrollDistance, 1);
done();
});
});
Expand Down

0 comments on commit c2bde74

Please sign in to comment.