Skip to content

Commit

Permalink
refactor(input-date-picker)!: Remove deprecated calciteDatePickerChan…
Browse files Browse the repository at this point in the history
…ge event (#6040)

BREAKING CHANGE: Removed the `calciteDatePickerChange` event, use
`calciteInputDatePickerChange` instead.
  • Loading branch information
eriklharper authored Dec 14, 2022
1 parent d37919e commit 645dd1e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
5 changes: 0 additions & 5 deletions src/components/input-date-picker/input-date-picker.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ describe("calcite-input-date-picker", () => {

const input = await page.find("calcite-input-date-picker");
const changeEvent = await page.spyOnEvent("calciteInputDatePickerChange");
const deprecatedChangeEvent = await page.spyOnEvent("calciteDatePickerChange");

expect(await input.getProperty("value")).toBe("");

Expand All @@ -67,7 +66,6 @@ describe("calcite-input-date-picker", () => {
expect(await input.getProperty("valueAsDate")).toBeDefined();

expect(changeEvent).toHaveReceivedEventTimes(1);
expect(deprecatedChangeEvent).toHaveReceivedEventTimes(1);

await page.keyboard.press("Backspace");
await page.keyboard.press("Backspace");
Expand All @@ -83,7 +81,6 @@ describe("calcite-input-date-picker", () => {
await page.waitForChanges();

expect(changeEvent).toHaveReceivedEventTimes(2);
expect(deprecatedChangeEvent).toHaveReceivedEventTimes(2);

expect(await input.getProperty("value")).toBe("");
expect(await input.getProperty("valueAsDate")).toBeUndefined();
Expand All @@ -96,10 +93,8 @@ describe("calcite-input-date-picker", () => {
element.setProperty("value", "");
await page.waitForChanges();
const changeEvent = await page.spyOnEvent("calciteInputDatePickerChange");
const deprecatedChangeEvent = await page.spyOnEvent("calciteDatePickerChange");

expect(changeEvent).toHaveReceivedEventTimes(0);
expect(deprecatedChangeEvent).toHaveReceivedEventTimes(0);
expect(await element.getProperty("value")).toBe("");
expect(await element.getProperty("valueAsDate")).toBeUndefined();
});
Expand Down
9 changes: 1 addition & 8 deletions src/components/input-date-picker/input-date-picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -374,12 +374,6 @@ export class InputDatePicker
// Events
//
//--------------------------------------------------------------------------
/**
* Fires when a user changes the date.
*
* @deprecated use `calciteInputDatePickerChange` instead.
*/
@Event({ cancelable: false }) calciteDatePickerChange: EventEmitter<Date>;

/**
* Fires when a user changes the date range.
Expand Down Expand Up @@ -1011,9 +1005,8 @@ export class InputDatePicker
this.value = newValue || "";

const changeEvent = this.calciteInputDatePickerChange.emit();
const deprecatedDatePickerChangeEvent = this.calciteDatePickerChange.emit(value as Date);

if (changeEvent.defaultPrevented || deprecatedDatePickerChangeEvent.defaultPrevented) {
if (changeEvent.defaultPrevented) {
this.value = oldValue;
this.setInputValue(oldValue as string);
}
Expand Down

0 comments on commit 645dd1e

Please sign in to comment.