Przeglądaj źródła

fixing input unit test failure

Torkel Ödegaard 7 lat temu
rodzic
commit
e40d21459a

+ 2 - 1
public/app/core/components/Form/Input.tsx

@@ -1,4 +1,5 @@
 import React, { PureComponent } from 'react';
+import classNames from 'classnames';
 import { ValidationEvents, ValidationRule } from 'app/types';
 import { validate, hasValidationEvent } from 'app/core/utils/validate';
 
@@ -80,7 +81,7 @@ export class Input extends PureComponent<Props> {
   render() {
     const { validationEvents, className, hideErrorMessage, ...restProps } = this.props;
     const { error } = this.state;
-    const inputClassName = 'gf-form-input' + (this.isInvalid ? ' invalid' : '') + ' ' + className;
+    const inputClassName = classNames('gf-form-input', { invalid: this.isInvalid }, className);
     const inputElementProps = this.populateEventPropsWithStatus(restProps, validationEvents);
 
     return (

+ 20 - 20
public/app/core/components/Picker/Unit/UnitPicker.tsx

@@ -36,25 +36,25 @@ export default class UnitPicker extends PureComponent<Props> {
       };
     });
 
-    const styles = {
-      ...ResetStyles,
-      menu: () => ({
-        maxHeight: '75%',
-        overflow: 'scroll',
-      }),
-      menuList: () =>
-        ({
-          overflowY: 'auto',
-          position: 'relative',
-        } as React.CSSProperties),
-      valueContainer: () =>
-        ({
-          overflow: 'hidden',
-          textOverflow: 'ellipsis',
-          maxWidth: '90px',
-          whiteSpace: 'nowrap',
-        } as React.CSSProperties),
-    };
+    // const styles = {
+    //   ...ResetStyles,
+    //   menu: () => ({
+    //     maxHeight: '75%',
+    //     overflow: 'scroll',
+    //   }),
+    //   menuList: () =>
+    //     ({
+    //       overflowY: 'auto',
+    //       position: 'relative',
+    //     } as React.CSSProperties),
+    //   valueContainer: () =>
+    //     ({
+    //       overflow: 'hidden',
+    //       textOverflow: 'ellipsis',
+    //       maxWidth: '90px',
+    //       whiteSpace: 'nowrap',
+    //     } as React.CSSProperties),
+    // };
 
     const value = groupOptions.map(group => {
       return group.options.find(option => option.value === defaultValue);
@@ -74,7 +74,7 @@ export default class UnitPicker extends PureComponent<Props> {
           Group: UnitGroup,
           Option: UnitOption,
         }}
-        styles={styles}
+        styles={ResetStyles}
       />
     );
   }