Skip to content

Commit 8b8c576

Browse files
test(ui): type skill menu viewport stub
1 parent 98892f4 commit 8b8c576

1 file changed

Lines changed: 25 additions & 23 deletions

File tree

‎ui/src/pages/chat/chat-view.test.ts‎

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3698,29 +3698,31 @@ describe("chat slash menu accessibility", () => {
36983698
animationFrames.push(callback);
36993699
return animationFrames.length;
37003700
});
3701-
vi.spyOn(HTMLElement.prototype, "getBoundingClientRect").mockImplementation(function () {
3702-
const height = 28;
3703-
let top = 0;
3704-
if (this.classList.contains("slash-menu-item")) {
3705-
const scrollRegion = this.closest<HTMLElement>(".slash-menu__scroll");
3706-
const options = Array.from(
3707-
scrollRegion?.querySelectorAll<HTMLElement>(".slash-menu-item") ?? [],
3708-
);
3709-
top = options.indexOf(this) * height - (scrollRegion?.scrollTop ?? 0);
3710-
}
3711-
const bottom = this.classList.contains("slash-menu__scroll") ? height * 2 : top + height;
3712-
return {
3713-
bottom,
3714-
height: bottom - top,
3715-
left: 0,
3716-
right: 240,
3717-
top,
3718-
width: 240,
3719-
x: 0,
3720-
y: top,
3721-
toJSON: () => ({}),
3722-
};
3723-
});
3701+
vi.spyOn(HTMLElement.prototype, "getBoundingClientRect").mockImplementation(
3702+
function (this: HTMLElement) {
3703+
const height = 28;
3704+
let top = 0;
3705+
if (this.classList.contains("slash-menu-item")) {
3706+
const scrollRegion = this.closest<HTMLElement>(".slash-menu__scroll");
3707+
const options = Array.from(
3708+
scrollRegion?.querySelectorAll<HTMLElement>(".slash-menu-item") ?? [],
3709+
);
3710+
top = options.indexOf(this) * height - (scrollRegion?.scrollTop ?? 0);
3711+
}
3712+
const bottom = this.classList.contains("slash-menu__scroll") ? height * 2 : top + height;
3713+
return {
3714+
bottom,
3715+
height: bottom - top,
3716+
left: 0,
3717+
right: 240,
3718+
top,
3719+
width: 240,
3720+
x: 0,
3721+
y: top,
3722+
toJSON: () => ({}),
3723+
};
3724+
},
3725+
);
37243726
const { container } = createReactiveDraftHarness();
37253727
document.body.append(container);
37263728
inputDraftAtEnd(container, "Use $");

0 commit comments

Comments
 (0)