From 0cc46303eafb743fa39e28136d1b0e7431344ab9 Mon Sep 17 00:00:00 2001 From: Arthur Taylor Date: Mon, 23 Sep 2024 10:07:02 +0200 Subject: [PATCH] Replace Wikit Lookup component with Codex Replace usages of Wikit's Lookup compontent in `ItemLookup` and `SpellingVariantInput` with the `CdxLookup` component. Bug: T370057 --- cypress/e2e/NewLexemeForm.cy.js | 20 ++- package-lock.json | 47 +++--- package.json | 4 +- src/components/ItemLookup.vue | 139 ++++++++++++------ src/components/LanguageInput.vue | 22 ++- src/components/NewLexemeForm.vue | 2 +- src/components/SpellingVariantInput.vue | 109 +++++++------- tests/integration/NewLexemeForm.test.ts | 32 ++-- tests/unit/components/ItemLookup.test.ts | 42 ++---- .../components/SpellingVariantInput.test.ts | 52 +++---- 10 files changed, 262 insertions(+), 207 deletions(-) diff --git a/cypress/e2e/NewLexemeForm.cy.js b/cypress/e2e/NewLexemeForm.cy.js index ed29565a..82c63db8 100644 --- a/cypress/e2e/NewLexemeForm.cy.js +++ b/cypress/e2e/NewLexemeForm.cy.js @@ -66,13 +66,16 @@ describe( 'NewLexemeForm', () => { cy.get( '.wbl-snl-language-lookup input' ) .type( '=Q123', { delay: 0 } ); checkA11y( '.wbl-snl-language-lookup' ); - cy.get( '.wbl-snl-language-lookup .wikit-OptionsMenu__item' ).click(); + cy.get( 'li.cdx-menu-item' ).contains( 'No match was found' ).should( 'not.exist' ); + checkA11y( '.wbl-snl-language-lookup' ); + cy.get( '.wbl-snl-language-lookup .cdx-menu-item' ).click(); cy.wait( '@LanguageCodeRetrieval' ); cy.get( '.wbl-snl-lexical-category-lookup input' ) .type( '=Q456', { delay: 0 } ); - cy.get( '.wbl-snl-lexical-category-lookup .wikit-OptionsMenu__item' ).click(); + cy.get( 'li.cdx-menu-item' ).contains( 'No match was found' ).should( 'not.exist' ); + cy.get( '.wbl-snl-lexical-category-lookup .cdx-menu-item' ).click(); cy.get( '.wbl-snl-form button' ) .click(); @@ -99,17 +102,20 @@ describe( 'NewLexemeForm', () => { cy.get( '.wbl-snl-language-lookup input' ) .type( '=Q123', { delay: 0 } ); - cy.get( '.wbl-snl-language-lookup .wikit-OptionsMenu__item' ).click(); + cy.get( '.wbl-snl-language-lookup li.cdx-menu-item' ).contains( 'No match was found' ).should( 'not.exist' ); + cy.get( '.wbl-snl-language-lookup .cdx-menu-item' ).click(); cy.get( '.wbl-snl-lexical-category-lookup input' ) .type( '=Q456', { delay: 0 } ); - cy.get( '.wbl-snl-lexical-category-lookup .wikit-OptionsMenu__item' ).click(); + cy.get( '.wbl-snl-lexical-category-lookup li.cdx-menu-item' ).contains( 'No match was found' ).should( 'not.exist' ); + cy.get( '.wbl-snl-lexical-category-lookup .cdx-menu-item' ).click(); cy.wait( '@LanguageCodeRetrieval' ); cy.get( '.wbl-snl-spelling-variant-lookup input' ) .type( 'en-ca', { delay: 0 } ); - cy.get( '.wbl-snl-spelling-variant-lookup .wikit-OptionsMenu__item' ).click(); + cy.get( '.wbl-snl-spelling-variant-lookup li.cdx-menu-item' ).contains( 'No match was found' ).should( 'not.exist' ); + cy.get( '.wbl-snl-spelling-variant-lookup .cdx-menu-item' ).click(); cy.get( '.wbl-snl-form button' ) .click(); @@ -151,12 +157,12 @@ describe( 'NewLexemeForm', () => { cy.get( '.wbl-snl-language-lookup input' ).click(); - cy.get( '.wbl-snl-language-lookup .wikit-OptionsMenu__item__label' ) + cy.get( '.wbl-snl-language-lookup .cdx-menu-item__text__label' ) .then( ( $element ) => { expect( $element ).to.have.text( 'test language' ); } ); - cy.get( '.wbl-snl-language-lookup .wikit-OptionsMenu__item__description' ) + cy.get( '.wbl-snl-language-lookup .cdx-menu-item__text__description' ) .then( ( $element ) => { expect( $element ).to.have.text( 'test language description' ); } ); diff --git a/package-lock.json b/package-lock.json index 431def15..84c2454b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,8 +9,8 @@ "version": "0.0.1", "license": "GPL-2.0-or-later", "dependencies": { - "@wikimedia/codex": "^1.13.1", - "@wikimedia/codex-design-tokens": "^1.13.1", + "@wikimedia/codex": "^1.14.0", + "@wikimedia/codex-design-tokens": "^1.14.0", "@wmde/wikibase-datamodel-types": "^0.2.0", "@wmde/wikit-tokens": "^3.0.0-alpha.12", "@wmde/wikit-vue-components": "^3.0.0-alpha.12", @@ -3552,13 +3552,12 @@ } }, "node_modules/@wikimedia/codex": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/@wikimedia/codex/-/codex-1.13.1.tgz", - "integrity": "sha512-ZfG8EYVGaELU31b5NEaDkzAGQsuc7PFDw9juOst/tNW14w1uqN0ok7WwzyvtwzA7WFWVdu1WiYXtLlKpCsYiyw==", - "license": "GPL-2.0+", + "version": "1.14.0", + "resolved": "https://registry.npmjs.org/@wikimedia/codex/-/codex-1.14.0.tgz", + "integrity": "sha512-BDoqpzcRN0tCWSIYtvb4ukFeSYStz09UZ2VkNPJ/YgtpmcSnFdpEcbL29k1W/BVntuL9XAkv88s0OHKoNX1ikA==", "dependencies": { "@floating-ui/vue": "1.0.6", - "@wikimedia/codex-icons": "1.13.1" + "@wikimedia/codex-icons": "1.14.0" }, "engines": { "node": ">=18", @@ -3569,20 +3568,18 @@ } }, "node_modules/@wikimedia/codex-design-tokens": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/@wikimedia/codex-design-tokens/-/codex-design-tokens-1.13.1.tgz", - "integrity": "sha512-omIdJyp+kW6i0pCxsgqoA3S7htGk7NsqsmMNkm4JOAEzF7ojv9tWFg63/yxp3ENbmF29wiJw9AcKEPDnvjbi0Q==", - "license": "GPL-2.0+", + "version": "1.14.0", + "resolved": "https://registry.npmjs.org/@wikimedia/codex-design-tokens/-/codex-design-tokens-1.14.0.tgz", + "integrity": "sha512-EC+3H1Zi+CLWa++IlEi/5fz4rfRMPCySjUY4plKYwPk0U1jo+uap8+CWjq7NV/RRGzUYm0/LIITEVEpJnK91xg==", "engines": { "node": ">=18", "npm": ">=7.21.0" } }, "node_modules/@wikimedia/codex-icons": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/@wikimedia/codex-icons/-/codex-icons-1.13.1.tgz", - "integrity": "sha512-eJEnelrDGkrmsf9nCylUOK4JQtCxQqdLvyVs8fHqUhzn1deYDE9HERbzhhTiGmBsBvncvuOCSXtl86jaHbqaAA==", - "license": "MIT", + "version": "1.14.0", + "resolved": "https://registry.npmjs.org/@wikimedia/codex-icons/-/codex-icons-1.14.0.tgz", + "integrity": "sha512-KbevrFz4Z5Jw/zadfN3UxDs2owZ9inYP0MqARE4LA3NOWkJpD76e+58KABmAnSUtZ2swMi94CFWex9tODDFg0w==", "engines": { "node": ">=18", "npm": ">=7.21.0" @@ -17671,23 +17668,23 @@ } }, "@wikimedia/codex": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/@wikimedia/codex/-/codex-1.13.1.tgz", - "integrity": "sha512-ZfG8EYVGaELU31b5NEaDkzAGQsuc7PFDw9juOst/tNW14w1uqN0ok7WwzyvtwzA7WFWVdu1WiYXtLlKpCsYiyw==", + "version": "1.14.0", + "resolved": "https://registry.npmjs.org/@wikimedia/codex/-/codex-1.14.0.tgz", + "integrity": "sha512-BDoqpzcRN0tCWSIYtvb4ukFeSYStz09UZ2VkNPJ/YgtpmcSnFdpEcbL29k1W/BVntuL9XAkv88s0OHKoNX1ikA==", "requires": { "@floating-ui/vue": "1.0.6", - "@wikimedia/codex-icons": "1.13.1" + "@wikimedia/codex-icons": "1.14.0" } }, "@wikimedia/codex-design-tokens": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/@wikimedia/codex-design-tokens/-/codex-design-tokens-1.13.1.tgz", - "integrity": "sha512-omIdJyp+kW6i0pCxsgqoA3S7htGk7NsqsmMNkm4JOAEzF7ojv9tWFg63/yxp3ENbmF29wiJw9AcKEPDnvjbi0Q==" + "version": "1.14.0", + "resolved": "https://registry.npmjs.org/@wikimedia/codex-design-tokens/-/codex-design-tokens-1.14.0.tgz", + "integrity": "sha512-EC+3H1Zi+CLWa++IlEi/5fz4rfRMPCySjUY4plKYwPk0U1jo+uap8+CWjq7NV/RRGzUYm0/LIITEVEpJnK91xg==" }, "@wikimedia/codex-icons": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/@wikimedia/codex-icons/-/codex-icons-1.13.1.tgz", - "integrity": "sha512-eJEnelrDGkrmsf9nCylUOK4JQtCxQqdLvyVs8fHqUhzn1deYDE9HERbzhhTiGmBsBvncvuOCSXtl86jaHbqaAA==" + "version": "1.14.0", + "resolved": "https://registry.npmjs.org/@wikimedia/codex-icons/-/codex-icons-1.14.0.tgz", + "integrity": "sha512-KbevrFz4Z5Jw/zadfN3UxDs2owZ9inYP0MqARE4LA3NOWkJpD76e+58KABmAnSUtZ2swMi94CFWex9tODDFg0w==" }, "@wmde/eslint-config-wikimedia-typescript": { "version": "0.2.12", diff --git a/package.json b/package.json index d878afb1..e771402a 100644 --- a/package.json +++ b/package.json @@ -43,8 +43,8 @@ "node": ">=16" }, "dependencies": { - "@wikimedia/codex": "^1.13.1", - "@wikimedia/codex-design-tokens": "^1.13.1", + "@wikimedia/codex": "^1.14.0", + "@wikimedia/codex-design-tokens": "^1.14.0", "@wmde/wikibase-datamodel-types": "^0.2.0", "@wmde/wikit-tokens": "^3.0.0-alpha.12", "@wmde/wikit-vue-components": "^3.0.0-alpha.12", diff --git a/src/components/ItemLookup.vue b/src/components/ItemLookup.vue index ec67129d..172f15f4 100644 --- a/src/components/ItemLookup.vue +++ b/src/components/ItemLookup.vue @@ -1,10 +1,20 @@