From 69db16f59a6e6a957b287545930b3f4dd462e051 Mon Sep 17 00:00:00 2001 From: Brandy Carney Date: Tue, 25 Jun 2024 16:36:38 -0400 Subject: [PATCH 1/3] fix(angular): reflect disabled property on item to bind properly in popover --- core/api.txt | 2 +- core/src/components/item/item.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/api.txt b/core/api.txt index ea7d4ab3c6c..aa94edeaf24 100644 --- a/core/api.txt +++ b/core/api.txt @@ -783,7 +783,7 @@ ion-item,prop,button,boolean,false,false,false ion-item,prop,color,"danger" | "dark" | "light" | "medium" | "primary" | "secondary" | "success" | "tertiary" | "warning" | string & Record | undefined,undefined,false,true ion-item,prop,detail,boolean | undefined,undefined,false,false ion-item,prop,detailIcon,string,chevronForward,false,false -ion-item,prop,disabled,boolean,false,false,false +ion-item,prop,disabled,boolean,false,false,true ion-item,prop,download,string | undefined,undefined,false,false ion-item,prop,href,string | undefined,undefined,false,false ion-item,prop,lines,"full" | "inset" | "none" | undefined,undefined,false,false diff --git a/core/src/components/item/item.tsx b/core/src/components/item/item.tsx index 6356c7ddcae..b3c179c17e4 100644 --- a/core/src/components/item/item.tsx +++ b/core/src/components/item/item.tsx @@ -64,7 +64,7 @@ export class Item implements ComponentInterface, AnchorInterface, ButtonInterfac /** * If `true`, the user cannot interact with the item. */ - @Prop() disabled = false; + @Prop({ reflect: true }) disabled = false; /** * This attribute instructs browsers to download a URL instead of navigating to From 4fdcdc202ba9af54a7ffee5566fe0e3da37a8cba Mon Sep 17 00:00:00 2001 From: Brandy Carney Date: Tue, 25 Jun 2024 16:37:22 -0400 Subject: [PATCH 2/3] test(angular): update popover test in test app for keyboard navigation --- .../base/src/app/lazy/home-page/home-page.component.html | 5 +++++ .../app/lazy/popover-inline/popover-inline.component.html | 4 ++-- .../src/app/lazy/popover-inline/popover-inline.component.ts | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/angular/test/base/src/app/lazy/home-page/home-page.component.html b/packages/angular/test/base/src/app/lazy/home-page/home-page.component.html index 314f6e6ae68..3c78cea6951 100644 --- a/packages/angular/test/base/src/app/lazy/home-page/home-page.component.html +++ b/packages/angular/test/base/src/app/lazy/home-page/home-page.component.html @@ -57,5 +57,10 @@ Accordions Test + + + Popovers + + diff --git a/packages/angular/test/base/src/app/lazy/popover-inline/popover-inline.component.html b/packages/angular/test/base/src/app/lazy/popover-inline/popover-inline.component.html index f4f311646cd..d71c5b16e19 100644 --- a/packages/angular/test/base/src/app/lazy/popover-inline/popover-inline.component.html +++ b/packages/angular/test/base/src/app/lazy/popover-inline/popover-inline.component.html @@ -4,8 +4,8 @@ - - {{ item }} + + {{ item.text }} diff --git a/packages/angular/test/base/src/app/lazy/popover-inline/popover-inline.component.ts b/packages/angular/test/base/src/app/lazy/popover-inline/popover-inline.component.ts index 8ebf37f2d07..e05515f9499 100644 --- a/packages/angular/test/base/src/app/lazy/popover-inline/popover-inline.component.ts +++ b/packages/angular/test/base/src/app/lazy/popover-inline/popover-inline.component.ts @@ -13,13 +13,13 @@ import { IonPopover } from "@ionic/angular"; }) export class PopoverInlineComponent { - items: string[] = []; + items: {text: string, disabled?: boolean}[] = []; openPopover(popover: IonPopover) { popover.present(); setTimeout(() => { - this.items = ['A', 'B', 'C', 'D']; + this.items = [{text: 'A'}, {text: 'B'}, {text: 'C', disabled: true}, {text: 'D'}]; }, 1000); } From 9ae73a6589aab3de3338967496317122baf928fe Mon Sep 17 00:00:00 2001 From: Brandy Carney Date: Tue, 25 Jun 2024 17:15:52 -0400 Subject: [PATCH 3/3] test(angular): add a check for the disabled attribute --- .../angular/test/base/e2e/src/lazy/popover.spec.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/angular/test/base/e2e/src/lazy/popover.spec.ts b/packages/angular/test/base/e2e/src/lazy/popover.spec.ts index 20500bb5c32..20bd3a1436c 100644 --- a/packages/angular/test/base/e2e/src/lazy/popover.spec.ts +++ b/packages/angular/test/base/e2e/src/lazy/popover.spec.ts @@ -22,4 +22,14 @@ describe('Popovers: Inline', () => { cy.get('ion-list ion-item:nth-child(3)').should('have.text', 'C'); cy.get('ion-list ion-item:nth-child(4)').should('have.text', 'D'); }); + + it('should have an item with a disabled attribute', () => { + cy.get('ion-button').click(); + + cy.get('ion-popover').should('be.visible'); + + cy.wait(1500); + + cy.get('ion-list ion-item:nth-child(3)').should('have.attr', 'disabled'); + }); });