From 45c3ae0bf910e55a3e591dcdc5c8fb30f90c18af Mon Sep 17 00:00:00 2001
From: Geido <60598000+geido@users.noreply.github.com>
Date: Mon, 19 Jul 2021 08:07:40 +0200
Subject: [PATCH] chore: Select component refactoring - ColorSchemeControl -
Iteration 5 (#15555)
* Enhance Select
* Transition Select to Antd
* Update test
* Fix Cypress
* Change name to aria-label
* Update Cypress search val
* Test Cypress selection
---
.../explore/visualizations/line.test.ts | 11 +++---
.../explore/components/ColorScheme_spec.jsx | 4 +-
.../controls/ColorSchemeControl.jsx | 39 ++++++++-----------
3 files changed, 23 insertions(+), 31 deletions(-)
diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/line.test.ts b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/line.test.ts
index 26660bc5f..f75fe77cc 100644
--- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/line.test.ts
+++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/line.test.ts
@@ -73,13 +73,12 @@ describe('Visualization > Line', () => {
it('should allow type to search color schemes', () => {
cy.get('#controlSections-tab-display').click();
cy.get('.Control[data-test="color_scheme"]').scrollIntoView();
- cy.get('.Control[data-test="color_scheme"] input[type="text"]')
+ cy.get('.Control[data-test="color_scheme"] input[type="search"]')
.focus()
- .type('air{enter}');
- cy.get('input[name="select-color_scheme"]').should(
- 'have.value',
- 'bnbColors',
- );
+ .type('bnbColors{enter}');
+ cy.get(
+ '.Control[data-test="color_scheme"] .ant-select-selection-item > ul[data-test="bnbColors"]',
+ ).should('exist');
});
it('should work with adhoc metric', () => {
diff --git a/superset-frontend/spec/javascripts/explore/components/ColorScheme_spec.jsx b/superset-frontend/spec/javascripts/explore/components/ColorScheme_spec.jsx
index ab776da70..565c4f9f2 100644
--- a/superset-frontend/spec/javascripts/explore/components/ColorScheme_spec.jsx
+++ b/superset-frontend/spec/javascripts/explore/components/ColorScheme_spec.jsx
@@ -18,7 +18,7 @@
*/
/* eslint-disable no-unused-expressions */
import React from 'react';
-import { Select } from 'src/components/Select';
+import { Select } from 'src/components';
import { getCategoricalSchemeRegistry } from '@superset-ui/core';
import { styledMount as mount } from 'spec/helpers/theming';
import ColorSchemeControl from 'src/explore/components/controls/ColorSchemeControl';
@@ -37,7 +37,7 @@ describe('ColorSchemeControl', () => {
wrapper = mount(