From ff78e6e8ca8ae4dc2a6d401b377dd3977c48824a Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Thu, 30 Jan 2020 12:29:11 -0500 Subject: [PATCH] fix(radio): do not clear value of radio group from radio (#20343) fixes #20323 --- .../components/radio-group/test/search/e2e.ts | 27 +++++++ .../radio-group/test/search/index.html | 81 +++++++++++++++++++ core/src/components/radio/radio.tsx | 3 - 3 files changed, 108 insertions(+), 3 deletions(-) create mode 100644 core/src/components/radio-group/test/search/e2e.ts create mode 100644 core/src/components/radio-group/test/search/index.html diff --git a/core/src/components/radio-group/test/search/e2e.ts b/core/src/components/radio-group/test/search/e2e.ts new file mode 100644 index 0000000000..66af9b2c91 --- /dev/null +++ b/core/src/components/radio-group/test/search/e2e.ts @@ -0,0 +1,27 @@ +import { newE2EPage } from '@stencil/core/testing'; + +test('radio-group: search', async () => { + const page = await newE2EPage({ + url: '/src/components/radio-group/test/search?ionic:_testing=true' + }); + + const screenshotCompares = []; + screenshotCompares.push(await page.compareScreenshot()); + + const radioTwo = await page.find('ion-radio[value=two]'); + await radioTwo.click(); + + const value = await page.find('#value'); + expect(value.textContent).toEqual('Current value: two'); + + const searchbar = await page.find('ion-searchbar'); + await searchbar.click(); + await page.keyboard.type('zero'); + + const valueAgain = await page.find('#value'); + expect(valueAgain.textContent).toEqual('Current value: two'); + + for (const screenshotCompare of screenshotCompares) { + expect(screenshotCompare).toMatchScreenshot(); + } +}); diff --git a/core/src/components/radio-group/test/search/index.html b/core/src/components/radio-group/test/search/index.html new file mode 100644 index 0000000000..e0b0a85ea6 --- /dev/null +++ b/core/src/components/radio-group/test/search/index.html @@ -0,0 +1,81 @@ + + + + + + Radio Group - Search + + + + + + + + + + + + Radio Group - Form + + + + + + Current value: + + + + + + + + + + + + + + diff --git a/core/src/components/radio/radio.tsx b/core/src/components/radio/radio.tsx index 9059cfc171..49326b5d26 100644 --- a/core/src/components/radio/radio.tsx +++ b/core/src/components/radio/radio.tsx @@ -81,9 +81,6 @@ export class Radio implements ComponentInterface { const radioGroup = this.radioGroup; if (radioGroup) { radioGroup.removeEventListener('ionChange', this.updateState); - if (this.checked) { - radioGroup.value = undefined; - } this.radioGroup = null; } }