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

feat(web-components): update second half of web-components files to resolve strict mode errors #3329

Merged
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
1,514 changes: 1,093 additions & 421 deletions packages/docs/docs.json

Large diffs are not rendered by default.

284 changes: 142 additions & 142 deletions packages/web-components/src/components.d.ts

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ describe("menu group", () => {

expect(page.root).toMatchSnapshot();

const ariaLabel = page.root.getAttribute("aria-label");
const ariaLabel = document
.querySelector("ic-menu-group")
?.getAttribute("aria-label");
expect(ariaLabel).toMatch(page.rootInstance.label);
});

Expand Down Expand Up @@ -93,7 +95,9 @@ describe("menu group", () => {

expect(page.root).toMatchSnapshot();

const ariaLabel = page.root.getAttribute("aria-label");
const ariaLabel = document
.querySelector("ic-menu-group")
?.getAttribute("aria-label");
expect(ariaLabel).toBeNull();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class MenuItem {
/**
* If `true`, the menu item will be in a checked state. This is only applicable when variant is set to `toggle`.
*/
@Prop({ mutable: true, reflect: true }) checked: boolean = false;
@Prop({ mutable: true, reflect: true }) checked?: boolean = false;

/**
* The description displayed in the menu item, below the label.
Expand Down Expand Up @@ -95,7 +95,7 @@ export class MenuItem {
/**
* The variant of the menu item.
*/
@Prop({ mutable: true, reflect: true }) variant: IcMenuItemVariants =
@Prop({ mutable: true, reflect: true }) variant?: IcMenuItemVariants =
"default";

/**
Expand Down Expand Up @@ -180,6 +180,7 @@ export class MenuItem {
const parentEl = this.el.parentElement;

if (
parentEl &&
parentEl.tagName === "IC-MENU-GROUP" &&
(parentEl as HTMLIcMenuGroupElement).label
) {
Expand Down Expand Up @@ -216,7 +217,7 @@ export class MenuItem {
return (
<Host
class={{
["ic-menu-item-disabled"]: this.disabled,
["ic-menu-item-disabled"]: !!this.disabled,
}}
>
<li
Expand All @@ -238,9 +239,7 @@ export class MenuItem {
hreflang={isPropDefined(this.hreflang)}
target={isPropDefined(this.target)}
rel={isPropDefined(this.rel)}
referrerpolicy={
this.referrerpolicy !== undefined ? this.referrerpolicy : null
}
referrerpolicy={this.referrerpolicy}
aria-disabled={`${this.disabled}`}
aria-label={this.getMenuItemAriaLabel()}
aria-haspopup={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe("menu item variants", () => {

expect(page.root).toMatchSnapshot();

page.rootInstance.disabled = false;
page.root?.setAttribute("disabled", "false");

await page.waitForChanges();
expect(page.root).toMatchSnapshot("disabled-removed");
Expand Down Expand Up @@ -68,11 +68,11 @@ describe("menu item variants", () => {
expect(page.rootInstance.variant).toMatch("toggle");
expect(page.rootInstance.checked).toBeFalsy();

const button = page.root.shadowRoot
.querySelector("li > ic-button")
.shadowRoot.querySelector("button");
const button = page.root?.shadowRoot
?.querySelector("li > ic-button")
?.shadowRoot?.querySelector("button");

button.click();
button?.click();
await page.waitForChanges;
});

Expand Down Expand Up @@ -119,7 +119,7 @@ describe("menu item variants", () => {

const element = await document.getElementById("test-menu-item");

await element.click();
await element?.click();

await page.waitForChanges();

Expand Down
Loading
Loading