@@ -8,7 +8,7 @@ import { createClientRender, fireEvent } from 'test/utils/createClientRender';
88import Autocomplete from './Autocomplete' ;
99import TextField from '@material-ui/core/TextField' ;
1010
11- describe ( '<Autocomplete />' , ( ) => {
11+ describe . only ( '<Autocomplete />' , ( ) => {
1212 let mount ;
1313 let classes ;
1414 const render = createClientRender ( ) ;
@@ -40,22 +40,12 @@ describe('<Autocomplete />', () => {
4040 expect ( input . value ) . to . equal ( '' ) ;
4141 } ) ;
4242
43- it ( 'should apply the hasClearIcon class ' , ( ) => {
43+ it ( 'should apply the icon classes ' , ( ) => {
4444 const { container } = render (
4545 < Autocomplete renderInput = { params => < TextField { ...params } /> } /> ,
4646 ) ;
47- expect ( container . querySelector ( '[class*="MuiAutocomplete-root"]' ) ) . to . have . class (
48- classes . hasClearIcon ,
49- ) ;
50- } ) ;
51-
52- it ( 'should apply the hasPopupIcon class' , ( ) => {
53- const { container } = render (
54- < Autocomplete renderInput = { params => < TextField { ...params } /> } /> ,
55- ) ;
56- expect ( container . querySelector ( '[class*="MuiAutocomplete-root"]' ) ) . to . have . class (
57- classes . hasPopupIcon ,
58- ) ;
47+ expect ( container . querySelector ( `.${ classes . root } ` ) ) . to . have . class ( classes . hasClearIcon ) ;
48+ expect ( container . querySelector ( `.${ classes . root } ` ) ) . to . have . class ( classes . hasPopupIcon ) ;
5949 } ) ;
6050 } ) ;
6151
@@ -574,61 +564,23 @@ describe('<Autocomplete />', () => {
574564 renderInput = { params => < TextField { ...params } /> }
575565 /> ,
576566 ) ;
577- expect ( container . querySelector ( '[class*="MuiAutocomplete-root"]' ) ) . not . to . have . class (
578- classes . hasClearIcon ,
579- ) ;
580- } ) ;
581-
582- it ( 'should still apply the hasPopupIcon class' , ( ) => {
583- const { container } = render (
584- < Autocomplete
585- disabled
586- options = { [ 'one' , 'two' , 'three' ] }
587- renderInput = { params => < TextField { ...params } /> }
588- /> ,
589- ) ;
590- expect ( container . querySelector ( '[class*="MuiAutocomplete-root"]' ) ) . to . have . class (
591- classes . hasPopupIcon ,
592- ) ;
567+ expect ( container . querySelector ( `.${ classes . root } ` ) ) . not . to . have . class ( classes . hasClearIcon ) ;
568+ expect ( container . querySelector ( `.${ classes . root } ` ) ) . to . have . class ( classes . hasPopupIcon ) ;
593569 } ) ;
594570 } ) ;
595571
596572 describe ( 'prop: disableClearable' , ( ) => {
597573 it ( 'should not render the clear button' , ( ) => {
598- const { queryByTitle } = render (
574+ const { queryByTitle, container } = render (
599575 < Autocomplete
600576 disableClearable
601577 options = { [ 'one' , 'two' , 'three' ] }
602578 renderInput = { params => < TextField { ...params } /> }
603579 /> ,
604580 ) ;
605581 expect ( queryByTitle ( 'Clear' ) ) . to . be . null ;
606- } ) ;
607-
608- it ( 'should still apply the hasPopupIcon class' , ( ) => {
609- const { container } = render (
610- < Autocomplete
611- disableClearable
612- options = { [ 'one' , 'two' , 'three' ] }
613- renderInput = { params => < TextField { ...params } /> }
614- /> ,
615- ) ;
616- expect ( container . querySelector ( '[class*="MuiAutocomplete-root"]' ) ) . to . have . class (
617- classes . hasPopupIcon ,
618- ) ;
619- } ) ;
620-
621- it ( 'should not apply the hasClearIcon class' , ( ) => {
622- const { container } = render (
623- < Autocomplete
624- disableClearable
625- options = { [ 'one' , 'two' , 'three' ] }
626- renderInput = { params => < TextField { ...params } /> }
627- /> ,
628- ) ;
629- expect ( container . querySelector ( '[class*="MuiAutocomplete-root"]' ) ) . not . to . have . class (
630- classes . hasClearIcon ,
631- ) ;
582+ expect ( container . querySelector ( `.${ classes . root } ` ) ) . to . have . class ( classes . hasPopupIcon ) ;
583+ expect ( container . querySelector ( `.${ classes . root } ` ) ) . not . to . have . class ( classes . hasClearIcon ) ;
632584 } ) ;
633585 } ) ;
634586 } ) ;
@@ -918,21 +870,6 @@ describe('<Autocomplete />', () => {
918870 fireEvent . keyDown ( document . activeElement , { key : 'Enter' } ) ;
919871 expect ( container . querySelectorAll ( '[class*="MuiChip-root"]' ) ) . to . have . length ( 3 ) ;
920872 } ) ;
921-
922- it ( 'should not apply hasPopupIcon class' , ( ) => {
923- const handleChange = spy ( ) ;
924- const options = [ { name : 'foo' } ] ;
925- const { container } = render (
926- < Autocomplete
927- freeSolo
928- onChange = { handleChange }
929- options = { options }
930- getOptionLabel = { option => option . name }
931- renderInput = { params => < TextField { ...params } autoFocus /> }
932- /> ,
933- ) ;
934- expect ( container ) . not . to . have . class ( classes . hasPopupIcon ) ;
935- } ) ;
936873 } ) ;
937874
938875 describe ( 'prop: onInputChange' , ( ) => {
0 commit comments