Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(pagination)!: remove event.detail payload from events #6047

Merged
merged 2 commits into from
Dec 15, 2022
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
21 changes: 0 additions & 21 deletions src/components/pagination/pagination.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,6 @@ describe("calcite-pagination", () => {
const page = await newE2EPage();
await page.setContent(`<calcite-pagination start="1" total="36" num="10"></calcite-pagination>`);
const toggleSpy = await page.spyOnEvent("calcitePaginationChange");

await page.evaluate(() => {
document.addEventListener("calcitePaginationChange", (event: CustomEvent): void => {
(window as any).eventDetail = event.detail;
});
});

const pages = await page.findAll("calcite-pagination >>> .page");
await pages[1].click();
await page.waitForChanges();
Expand All @@ -129,20 +122,6 @@ describe("calcite-pagination", () => {
expect(selectedPage.innerText).toBe("2");
expect(toggleSpy).toHaveReceivedEventTimes(1);

const eventDetail: any = await page.evaluateHandle(() => {
const detail = (window as any).eventDetail;
return {
num: detail.num,
start: detail.start,
total: detail.total
};
});
const properties = await eventDetail.getProperties();
expect(eventDetail).toBeDefined();
expect(properties.get("num")._remoteObject.value).toBe(10);
expect(properties.get("start")._remoteObject.value).toBe(11);
expect(properties.get("total")._remoteObject.value).toBe(36);

await pages[2].click();
await page.waitForChanges();

Expand Down
12 changes: 2 additions & 10 deletions src/components/pagination/pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,8 @@ export class Pagination implements LocalizedComponent, LocalizedComponent, T9nCo

/**
* Emits when the selected page changes.
*
* @see [PaginationDetail](https://github.com/Esri/calcite-components/blob/master/src/components/pagination/pagination.tsx#L23)
*/
@Event({ cancelable: false }) calcitePaginationChange: EventEmitter<PaginationDetail>;
@Event({ cancelable: false }) calcitePaginationChange: EventEmitter<void>;

// --------------------------------------------------------------------------
//
Expand Down Expand Up @@ -231,13 +229,7 @@ export class Pagination implements LocalizedComponent, LocalizedComponent, T9nCo
}

private emitUpdate() {
const changePayload = {
start: this.start,
total: this.total,
num: this.num
};

this.calcitePaginationChange.emit(changePayload);
this.calcitePaginationChange.emit();
}

//--------------------------------------------------------------------------
Expand Down