From 58e97e6d8d903d0e52bafdbc7be12b2febd13438 Mon Sep 17 00:00:00 2001 From: Maksym Portianoi Date: Wed, 22 May 2024 14:21:58 -0400 Subject: [PATCH] fix(kinput): update classes (#2182) * fix(kinput): update classes * fix(*): update kinput selectors * test(kinput): fix component tests * fix(ktable): minor fix --- docs/guide/migrating-to-version-9.md | 2 ++ src/components/KFileUpload/KFileUpload.vue | 8 ++++---- src/components/KInput/KInput.cy.ts | 18 +++++++++--------- src/components/KInput/KInput.vue | 15 +++++++-------- src/components/KTable/KTable.vue | 2 +- 5 files changed, 23 insertions(+), 22 deletions(-) diff --git a/docs/guide/migrating-to-version-9.md b/docs/guide/migrating-to-version-9.md index 08271a2655..c01ffe0331 100644 --- a/docs/guide/migrating-to-version-9.md +++ b/docs/guide/migrating-to-version-9.md @@ -463,6 +463,8 @@ This component has been removed. * `form-control` class has been removed * `over-char-limit` class has been removed * `help` class has been changed to `help-text` +* `k-input-wrapper` class has been changed to `k-input` +* `input.k-input` element class has been changed to `.input` #### Constants, Types & Interfaces diff --git a/src/components/KFileUpload/KFileUpload.vue b/src/components/KFileUpload/KFileUpload.vue index a41710c59e..7252ef8148 100644 --- a/src/components/KFileUpload/KFileUpload.vue +++ b/src/components/KFileUpload/KFileUpload.vue @@ -244,8 +244,8 @@ $kFileUploadInputPaddingY: var(--kui-space-40, $kui-space-40); // corresponds to /* Component styles */ .k-file-upload { - :deep(.k-input-wrapper) input[type="file"]::-webkit-file-upload-button, - :deep(.k-input-wrapper) input[type="file"]::file-selector-button { + :deep(.k-input) input[type="file"]::-webkit-file-upload-button, + :deep(.k-input) input[type="file"]::file-selector-button { margin: 0; opacity: 0; padding: 0; @@ -253,8 +253,8 @@ $kFileUploadInputPaddingY: var(--kui-space-40, $kui-space-40); // corresponds to width: 0; } - :deep(.k-input-wrapper) input[type="file"], - :deep(.k-input-wrapper) input[type="file"][disabled] { + :deep(.k-input) input[type="file"], + :deep(.k-input) input[type="file"][disabled] { color: transparent !important; } diff --git a/src/components/KInput/KInput.cy.ts b/src/components/KInput/KInput.cy.ts index 91ff18bdf8..0ea0796aa8 100644 --- a/src/components/KInput/KInput.cy.ts +++ b/src/components/KInput/KInput.cy.ts @@ -102,7 +102,7 @@ describe('KInput', () => { }, }) - cy.get('.k-input-wrapper .help-text').should('contain.text', helpText) + cy.get('.k-input .help-text').should('contain.text', helpText) }) it('shows character count when characterLimit prop is set and exceeded', () => { @@ -115,8 +115,8 @@ describe('KInput', () => { }, }) - cy.get('.k-input-wrapper input.k-input').type(`This input has ${textCharCount} characters`) - cy.get('.k-input-wrapper.input-error .help-text').should('contain.text', `${textCharCount} / ${charLimit}`) + cy.get('.k-input input.input').type(`This input has ${textCharCount} characters`) + cy.get('.k-input.input-error .help-text').should('contain.text', `${textCharCount} / ${charLimit}`) }) it('reacts to text changes', () => { @@ -129,12 +129,12 @@ describe('KInput', () => { }, }) - cy.get('.k-input').should('have.value', inputValue) - cy.get('.k-input').clear() - cy.get('.k-input').type(newValue).then(() => { + cy.get('.input').should('have.value', inputValue) + cy.get('.input').clear() + cy.get('.input').type(newValue).then(() => { // Check for emitted event cy.wrap(Cypress.vueWrapper.emitted()).should('have.property', 'input') - cy.get('.k-input').should('have.value', newValue) + cy.get('.input').should('have.value', newValue) }) }) @@ -147,7 +147,7 @@ describe('KInput', () => { }, }) - cy.get('.k-input-wrapper').find(`[data-testid="${beforeSlot}"]`).should('be.visible') + cy.get('.k-input').find(`[data-testid="${beforeSlot}"]`).should('be.visible') }) it('renders after slot when passed', () => { @@ -159,6 +159,6 @@ describe('KInput', () => { }, }) - cy.get('.k-input-wrapper').find(`[data-testid="${afterSlot}"]`).should('be.visible') + cy.get('.k-input').find(`[data-testid="${afterSlot}"]`).should('be.visible') }) }) diff --git a/src/components/KInput/KInput.vue b/src/components/KInput/KInput.vue index aca864731a..e6d0238000 100644 --- a/src/components/KInput/KInput.vue +++ b/src/components/KInput/KInput.vue @@ -1,7 +1,6 @@