Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
yhabib committed Dec 18, 2024
1 parent 581b2a0 commit 34b503e
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ describe("ReportingDateRangeSelector", () => {
return { po, component };
};

const getComponentPropValue = (component, propName: string) => {
return component.$$.ctx[component.$$.props[propName]];
};

it("should render the option provided as a prop", async () => {
const { po } = renderComponent({ period: "last-year" });

Expand Down Expand Up @@ -64,12 +68,13 @@ describe("ReportingDateRangeSelector", () => {
const { po, component } = renderComponent();
const allOptions = await po.getAllOptions();

// Click the second option
await allOptions[1].click();
let currentValue = getComponentPropValue(component, "period");
expect(currentValue).toBe("all");

await allOptions[1].click();
await tick();

const currentValue = component.$$.ctx[component.$$.props["period"]];
currentValue = getComponentPropValue(component, "period");
expect(currentValue).toBe("last-year");
});
});

0 comments on commit 34b503e

Please sign in to comment.