Skip to content

Commit 275eb78

Browse files
vaadin-botweb-padawanclaude
authored
test: pin item height in date-picker overlay-content fixture (#11676) (#11725)
Co-authored-by: Serhii Kulykov <iamkulykov@gmail.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 6faa3db commit 275eb78

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

‎packages/date-picker/test/overlay-content.test.js‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ async function customizeFixture({ initialPosition, monthScrollerItems, monthScro
88
const overlay = fixtureSync(`<vaadin-date-picker-overlay-content></vaadin-date-picker-overlay-content>`);
99
await untilOverlayScrolled(overlay);
1010
const monthScroller = overlay._monthScroller;
11+
// Pin item height to a clean integer pixel value so percentage-based buffer
12+
// offsets resolve to whole pixels and revealDate position math stays exact.
13+
monthScroller.style.setProperty('--vaadin-infinite-scroller-item-height', '270px');
1114
monthScroller.style.setProperty('--vaadin-infinite-scroller-buffer-offset', monthScrollerOffset);
1215
monthScroller.style.height = `${270 * monthScrollerItems}px`;
1316
overlay.i18n = getDefaultI18n();
@@ -426,8 +429,7 @@ describe('overlay', () => {
426429
it('should scroll when the month is below the visible area', () => {
427430
const position = monthScroller.position;
428431
overlay.revealDate(new Date(2021, 3, 1), false);
429-
// FIXME: fails with base styles: "expected -51.04545454545455 to equal -51"
430-
expect(monthScroller.position).to.be.closeTo(position + 1, 0.1);
432+
expect(monthScroller.position).to.equal(position + 1);
431433
});
432434
});
433435

@@ -456,8 +458,7 @@ describe('overlay', () => {
456458
it('should scroll when the month is below the visible area', () => {
457459
const position = monthScroller.position;
458460
overlay.revealDate(new Date(2021, 3, 1), false);
459-
// FIXME: fails with base styles: "expected -51.45454545454545 to equal -51.4"
460-
expect(monthScroller.position).to.be.closeTo(position + 0.6, 0.1 /* The bottom 10% offset is ensured by JS */);
461+
expect(monthScroller.position).to.equal(position + 0.6 /* The bottom 10% offset is ensured by JS */);
461462
});
462463
});
463464
});

0 commit comments

Comments
 (0)