From a4ceda8a957017a682c73461c1133baaf4604328 Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Wed, 25 Jan 2023 12:10:07 -0500 Subject: [PATCH 1/4] chore(github): update issue template for v7 beta (#26683) --- .github/ISSUE_TEMPLATE/bug_report.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 7a8d6527b5..786f1e721c 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -21,6 +21,7 @@ body: - label: v4.x - label: v5.x - label: v6.x + - label: v7.x - label: Nightly - type: textarea attributes: From a6874579361db548d961fdee83299d664dd6541b Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Wed, 25 Jan 2023 13:30:03 -0500 Subject: [PATCH 2/4] fix(select): setting options async updates rendered text (#26667) resolves #19324 --- core/src/components/select/select.tsx | 10 +++++++++- .../components/select/test/async/index.html | 10 ++++++---- .../select/test/async/select.e2e.ts | 19 +++++++++++++------ 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/core/src/components/select/select.tsx b/core/src/components/select/select.tsx index 5bf8699c19..90f4f3783b 100644 --- a/core/src/components/select/select.tsx +++ b/core/src/components/select/select.tsx @@ -1,5 +1,5 @@ import type { ComponentInterface, EventEmitter } from '@stencil/core'; -import { Component, Element, Event, Host, Method, Prop, State, Watch, h } from '@stencil/core'; +import { Component, Element, Event, Host, Method, Prop, State, Watch, h, forceUpdate } from '@stencil/core'; import { getIonMode } from '../../global/ionic-global'; import type { @@ -166,6 +166,14 @@ export class Select implements ComponentInterface { this.mutationO = watchForOptions(this.el, 'ion-select-option', async () => { this.updateOverlayOptions(); + + /** + * We need to re-render the component + * because one of the new ion-select-option + * elements may match the value. In this case, + * the rendered selected text should be updated. + */ + forceUpdate(this); }); } diff --git a/core/src/components/select/test/async/index.html b/core/src/components/select/test/async/index.html index 5293fb9bdb..2938aacd84 100644 --- a/core/src/components/select/test/async/index.html +++ b/core/src/components/select/test/async/index.html @@ -29,11 +29,15 @@ + + + + diff --git a/core/src/components/select/test/async/select.e2e.ts b/core/src/components/select/test/async/select.e2e.ts index 8db1aa8966..f35ee77508 100644 --- a/core/src/components/select/test/async/select.e2e.ts +++ b/core/src/components/select/test/async/select.e2e.ts @@ -2,16 +2,23 @@ import { expect } from '@playwright/test'; import { test } from '@utils/test/playwright'; test.describe('select: async', () => { - test('should correctly set the value after a delay', async ({ page, skip }) => { + test.beforeEach(async ({ page, skip }) => { skip.rtl('This is checking internal logic. RTL tests are not needed'); + skip.mode('md'); await page.goto(`/src/components/select/test/async`); - const selectValueSet = await page.spyOnEvent('selectValueSet'); - - const select = await page.locator('#default'); - - await selectValueSet.next(); + }); + test('should correctly set the value after a delay', async ({ page }) => { + const select = page.locator('#default'); + await page.click('#set-contents'); await expect(select).toHaveJSProperty('value', 'bird'); }); + + test('should re-render when options update but value is already set', async ({ page }) => { + const select = page.locator('#with-value'); + await page.click('#set-contents'); + + await expect(select.locator('.select-text')).toHaveText('bird'); + }); }); From 63afc279e5dfd5716fafa2c580d78061e57aba4c Mon Sep 17 00:00:00 2001 From: Amanda Johnston <90629384+amandaejohnston@users.noreply.github.com> Date: Fri, 27 Jan 2023 09:04:07 -0600 Subject: [PATCH 3/4] test(overlays): re-enable hidden focusable element test (#26685) --- core/src/utils/test/overlays/overlays.e2e.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/utils/test/overlays/overlays.e2e.ts b/core/src/utils/test/overlays/overlays.e2e.ts index f2a73b037a..9607f22cc4 100644 --- a/core/src/utils/test/overlays/overlays.e2e.ts +++ b/core/src/utils/test/overlays/overlays.e2e.ts @@ -108,8 +108,8 @@ test.describe('overlays: focus', () => { test.beforeEach(({ skip }) => { skip.rtl(); }); - // TODO FW-3080 - test.skip('should not select a hidden focusable element', async ({ page, browserName }) => { + + test('should not select a hidden focusable element', async ({ page, browserName }) => { await page.setContent(`