Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/bright-apes-begin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@lynx-js/web-elements": patch
---

Add scrollHeight/scrollWidth getters to XList.
5 changes: 5 additions & 0 deletions .github/lynx-stack.instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
applyTo: "packages/web-platform/web-elements/**/*"
---

When updating web element APIs, add targeted Playwright tests in packages/web-platform/web-elements/tests/web-elements.spec.ts and keep changes minimal.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ export class XList extends HTMLElement {
this.#getListContainer().scrollLeft = val;
}

override get scrollHeight() {
return this.#getListContainer().scrollHeight;
}

override get scrollWidth() {
return this.#getListContainer().scrollWidth;
}

get __scrollTop() {
return super.scrollTop;
}
Expand Down
16 changes: 16 additions & 0 deletions packages/web-platform/web-elements/tests/web-elements.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2141,11 +2141,19 @@ test.describe('web-elements test suite', () => {
return (document.querySelector('x-list') as any)
?.getScrollContainerInfo();
})).jsonValue();
const scrollHeight1 = await page.evaluate(() => {
return (document.querySelector('x-list') as any)?.scrollHeight;
});
const scrollWidth1 = await page.evaluate(() => {
return (document.querySelector('x-list') as any)?.scrollWidth;
});
expect(
typeof info1 === 'object' && info1.scrollLeft === 0
&& info1.scrollTop === 0 && info1.scrollHeight !== 0
&& info1.scrollWidth !== 0,
).toBeTruthy();
expect(scrollHeight1).toBe(info1.scrollHeight);
expect(scrollWidth1).toBe(info1.scrollWidth);
await page.evaluate(() =>
document.querySelector('x-list')?.shadowRoot?.querySelector(
'#content',
Expand All @@ -2157,11 +2165,19 @@ test.describe('web-elements test suite', () => {
return (document.querySelector('x-list') as any)
?.getScrollContainerInfo();
})).jsonValue();
const scrollHeight2 = await page.evaluate(() => {
return (document.querySelector('x-list') as any)?.scrollHeight;
});
const scrollWidth2 = await page.evaluate(() => {
return (document.querySelector('x-list') as any)?.scrollWidth;
});
expect(
typeof info2 === 'object' && info2.scrollLeft === 200
&& info2.scrollTop === 200 && info2.scrollHeight !== 0
&& info2.scrollWidth !== 0,
).toBeTruthy();
expect(scrollHeight2).toBe(info2.scrollHeight);
expect(scrollWidth2).toBe(info2.scrollWidth);
},
);

Expand Down
Loading