1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-06-27 01:19:00 +02:00

refactor: improve GeneralSelect prop types (#841)

* refactor: improve GeneralSelect prop types

* refactor: intercept ui config requests in auth spec
This commit is contained in:
olav 2022-04-06 12:08:57 +02:00 committed by GitHub
parent 6efa9fe75c
commit 73652b66e9
4 changed files with 19 additions and 21 deletions

View File

@ -4,7 +4,7 @@ export {};
describe('auth', () => {
it('renders the password login', () => {
cy.intercept('GET', '/api/admin/user', {
cy.intercept('GET', '/api/admin/**', {
statusCode: 401,
body: {
defaultHidden: false,
@ -29,7 +29,7 @@ describe('auth', () => {
});
it('renders does not render password login if defaultHidden is true', () => {
cy.intercept('GET', '/api/admin/user', {
cy.intercept('GET', '/api/admin/**', {
statusCode: 401,
body: {
defaultHidden: true,
@ -48,7 +48,7 @@ describe('auth', () => {
it('renders google auth when options are specified', () => {
const ssoPath = '/auth/google/login';
cy.intercept('GET', '/api/admin/user', {
cy.intercept('GET', '/api/admin/**', {
statusCode: 401,
body: {
defaultHidden: true,
@ -77,7 +77,7 @@ describe('auth', () => {
it('renders oidc auth when options are specified', () => {
const ssoPath = '/auth/oidc/login';
cy.intercept('GET', '/api/admin/user', {
cy.intercept('GET', '/api/admin/**', {
statusCode: 401,
body: {
defaultHidden: true,
@ -106,7 +106,7 @@ describe('auth', () => {
it('renders saml auth when options are specified', () => {
const ssoPath = '/auth/saml/login';
cy.intercept('GET', '/api/admin/user', {
cy.intercept('GET', '/api/admin/**', {
statusCode: 401,
body: {
defaultHidden: true,
@ -133,7 +133,7 @@ describe('auth', () => {
});
it('can visit forgot password when password auth is enabled', () => {
cy.intercept('GET', '/api/admin/user', {
cy.intercept('GET', '/api/admin/**', {
statusCode: 401,
body: {
defaultHidden: false,
@ -151,7 +151,7 @@ describe('auth', () => {
it('renders demo auth correctly', () => {
const email = 'hello@hello.com';
cy.intercept('GET', '/api/admin/user', {
cy.intercept('GET', '/api/admin/**', {
statusCode: 401,
body: {
defaultHidden: false,
@ -174,7 +174,7 @@ describe('auth', () => {
it('renders email auth correctly', () => {
const email = 'hello@hello.com';
cy.intercept('GET', '/api/admin/user', {
cy.intercept('GET', '/api/admin/**', {
statusCode: 401,
body: {
defaultHidden: false,

View File

@ -92,7 +92,6 @@ const ApiTokenForm: React.FC<IApiTokenFormProps> = ({
label="Token Type"
id="api_key_type"
name="type"
// @ts-expect-error
IconComponent={KeyboardArrowDownOutlined}
className={styles.selectInput}
/>
@ -105,7 +104,8 @@ const ApiTokenForm: React.FC<IApiTokenFormProps> = ({
options={selectableProjects}
onChange={e => setProject(e.target.value as string)}
label="Project"
// @ts-expect-error
id="api_key_project"
name="project"
IconComponent={KeyboardArrowDownOutlined}
className={styles.selectInput}
/>
@ -120,7 +120,6 @@ const ApiTokenForm: React.FC<IApiTokenFormProps> = ({
label="Environment"
id="api_key_environment"
name="environment"
// @ts-expect-error
IconComponent={KeyboardArrowDownOutlined}
className={styles.selectInput}
/>

View File

@ -125,14 +125,7 @@ export const ConstraintAccordionEditHeader = ({
autoFocus
options={constraintNameOptions}
value={localConstraint.contextName || ''}
onChange={(
e: React.ChangeEvent<{
name?: string;
value: unknown;
}>
) => {
setContextName(e.target.value as string);
}}
onChange={e => setContextName(String(e.target.value))}
className={styles.headerSelect}
/>
</div>

View File

@ -1,5 +1,11 @@
import React from 'react';
import { FormControl, InputLabel, MenuItem, Select } from '@material-ui/core';
import {
FormControl,
InputLabel,
MenuItem,
Select,
SelectProps,
} from '@material-ui/core';
import { SELECT_ITEM_ID } from 'utils/testIds';
import { KeyboardArrowDownOutlined } from '@material-ui/icons';
@ -10,7 +16,7 @@ export interface ISelectOption {
disabled?: boolean;
}
export interface ISelectMenuProps {
export interface ISelectMenuProps extends SelectProps {
name: string;
id: string;
value?: string;