100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
or-scheduler: swap period with frequency section (#2476)
Koena0bfc53a32b8
diff --git a/ui/component/or-scheduler/src/index.ts b/ui/component/or-scheduler/src/index.tsindex c318be8f4..d1bc15ba1 100644--- a/ui/component/or-scheduler/src/index.ts+++ b/ui/component/or-scheduler/src/index.ts@@ -420,8 +420,8 @@ export class OrScheduler extends translate(i18next)(LitElement) {@or-mwc-input-changed="${(e: OrInputChangedEvent) => this.setCalendarEventType(e.detail.value)}"></or-mwc-input></div></div>- ${this._eventType === EventTypes.recurrence ? this.getRepeatTemplate() : ``}${calendar && (this._eventType === EventTypes.period || this._eventType === EventTypes.recurrence) ? this.getPeriodTemplate(calendar) : ``}+ ${this._eventType === EventTypes.recurrence ? this.getRepeatTemplate() : ``}${this._eventType === EventTypes.recurrence ? this.getEndsTemplate() : ``}</div>`;}diff --git a/ui/component/or-scheduler/test/or-scheduler.test.ts b/ui/component/or-scheduler/test/or-scheduler.test.tsindex 702398e0e..0d4f4e702 100644--- a/ui/component/or-scheduler/test/or-scheduler.test.ts+++ b/ui/component/or-scheduler/test/or-scheduler.test.ts@@ -81,10 +81,10 @@ ct.describe("Default event type should", () => {await expect(dialog.locator("#event-type")).toBeVisible();await expect(dialog.getByRole("button", { name: "Default", exact: true })).toBeVisible();- await expect(dialog.locator("#recurrence")).not.toBeVisible();-await expect(dialog.locator("#period")).not.toBeVisible();+ await expect(dialog.locator("#recurrence")).not.toBeVisible();+await expect(dialog.locator("#recurrence-ends")).not.toBeVisible();});@@ -119,8 +119,6 @@ ct.describe("Period event type should", () => {await expect(dialog.locator("#event-type")).toBeVisible();await expect(dialog.getByRole("button", { name: "Plan an occurrence", exact: true })).toBeVisible();- await expect(dialog.locator("#recurrence")).not.toBeVisible();-await expect(dialog.locator("#period")).toBeVisible();await expect(dialog.locator("label", { hasText: "from" })).toHaveCount(2);await expect(dialog.locator("label", { hasText: "from" }).last()).toBeDisabled();@@ -128,6 +126,8 @@ ct.describe("Period event type should", () => {await expect(dialog.locator("label", { hasText: "to" }).last()).toBeDisabled();await expect(dialog.getByRole("checkbox", { checked: true, name: "All day" })).toBeVisible();+ await expect(dialog.locator("#recurrence")).not.toBeVisible();+await expect(dialog.locator("#recurrence-ends")).not.toBeVisible();});@@ -193,6 +193,13 @@ ct.describe("Recurrence event type should", () => {await expect(dialog.locator("#event-type")).toBeVisible();await expect(dialog.getByRole("button", { name: "Plan a repeating occurrence", exact: true })).toBeVisible();+ await expect(dialog.locator("#period")).toBeVisible();+ await expect(dialog.locator("label", { hasText: "from" })).toHaveCount(2);+ await expect(dialog.locator("label", { hasText: "from" }).last()).toBeDisabled();+ await expect(dialog.locator("label", { hasText: "to" })).toHaveCount(2);+ await expect(dialog.locator("label", { hasText: "to" }).last()).toBeDisabled();+ await expect(dialog.getByRole("checkbox", { checked: true, name: "All day" })).toBeVisible();+await expect(dialog.locator("#recurrence")).toBeVisible();await dialog.getByRole("button", { name: "Day" }).click();for (const [freq, parts] of Object.entries(NOT_APPLICABLE_BY_RRULE_PARTS)) {@@ -227,13 +234,6 @@ ct.describe("Recurrence event type should", () => {await dialog.getByRole("button", { name: FREQUENCIES[freq as Frequency], exact: true }).click({ delay: 100 });}- await expect(dialog.locator("#period")).toBeVisible();- await expect(dialog.locator("label", { hasText: "from" })).toHaveCount(2);- await expect(dialog.locator("label", { hasText: "from" }).last()).toBeDisabled();- await expect(dialog.locator("label", { hasText: "to" })).toHaveCount(2);- await expect(dialog.locator("label", { hasText: "to" }).last()).toBeDisabled();- await expect(dialog.getByRole("checkbox", { checked: true, name: "All day" })).toBeVisible();-const ends = dialog.locator("#recurrence-ends");await expect(ends).toBeVisible();await expect(ends.getByRole("radio", { name: "Never" })).toBeChecked();