@@ -83,8 +83,7 @@ describe('MDCSelectFoundation', () => {
83
83
] ) ;
84
84
} ) ;
85
85
86
- function setupTest (
87
- hasLeadingIcon = true , hasHelperText = false , describedbyElements = '' ) {
86
+ function setupTest ( hasLeadingIcon = true , hasHelperText = false ) {
88
87
const mockAdapter = createMockAdapter ( MDCSelectFoundation ) ;
89
88
const leadingIcon = jasmine . createSpyObj ( 'leadingIcon' , [
90
89
'setDisabled' , 'setAriaLabel' , 'setContent' , 'registerInteractionHandler' ,
@@ -108,8 +107,6 @@ describe('MDCSelectFoundation', () => {
108
107
mockAdapter . getMenuItemTextAtIndex . withArgs ( 0 ) . and . returnValue ( 'foo' ) ;
109
108
mockAdapter . getMenuItemTextAtIndex . withArgs ( 1 ) . and . returnValue ( 'bar' ) ;
110
109
mockAdapter . getMenuItemCount . and . returnValue ( 2 ) ;
111
- mockAdapter . getSelectAnchorAttr . withArgs ( 'aria-describedby' )
112
- . and . returnValue ( describedbyElements ) ;
113
110
114
111
const foundation = new MDCSelectFoundation ( mockAdapter , foundationMap ) ;
115
112
return { foundation, mockAdapter, leadingIcon, helperText} ;
@@ -771,10 +768,10 @@ describe('MDCSelectFoundation', () => {
771
768
( ) => {
772
769
const hasIcon = false ;
773
770
const hasHelperText = true ;
774
- const mockId = 'foobarbazcool' ;
775
771
const { foundation, mockAdapter, helperText} =
776
- setupTest ( hasIcon , hasHelperText , mockId ) ;
772
+ setupTest ( hasIcon , hasHelperText ) ;
777
773
774
+ const mockId = 'foobarbazcool' ;
778
775
helperText . getId . and . returnValue ( mockId ) ;
779
776
helperText . isVisible . and . returnValue ( true ) ;
780
777
@@ -783,59 +780,6 @@ describe('MDCSelectFoundation', () => {
783
780
. toHaveBeenCalledWith ( strings . ARIA_DESCRIBEDBY , mockId ) ;
784
781
} ) ;
785
782
786
- it ( '#setValid, with client ids, sets aria-describedby' , ( ) => {
787
- const hasIcon = false ;
788
- const hasHelperText = true ;
789
- const mockId = 'foobarbazcool' ;
790
- const clientDescribedbyIds = 'id1 id2 id3' ;
791
-
792
- const { foundation, mockAdapter, helperText} =
793
- setupTest ( hasIcon , hasHelperText , clientDescribedbyIds + ' ' + mockId ) ;
794
-
795
- helperText . getId . and . returnValue ( mockId ) ;
796
- helperText . isVisible . and . returnValue ( true ) ;
797
-
798
- foundation . setValid ( false ) ;
799
- expect ( mockAdapter . setSelectAnchorAttr )
800
- . toHaveBeenCalledWith (
801
- strings . ARIA_DESCRIBEDBY , clientDescribedbyIds + ' ' + mockId ) ;
802
- } ) ;
803
-
804
- it ( '#setValid, w/ client ids, remove helpertextId from aria-describedby' ,
805
- ( ) => {
806
- const hasIcon = false ;
807
- const hasHelperText = true ;
808
- const mockId = 'foobarbazcool' ;
809
- const clientDescribedbyIds = `id1 id2 id3` ;
810
-
811
- const { foundation, mockAdapter, helperText} = setupTest (
812
- hasIcon , hasHelperText , clientDescribedbyIds + ' ' + mockId ) ;
813
-
814
- helperText . getId . and . returnValue ( mockId ) ;
815
- helperText . isVisible . and . returnValue ( false ) ;
816
-
817
- foundation . setValid ( false ) ;
818
- expect ( mockAdapter . setSelectAnchorAttr )
819
- . toHaveBeenCalledWith (
820
- strings . ARIA_DESCRIBEDBY , clientDescribedbyIds ) ;
821
- } ) ;
822
-
823
- it ( '#setValid, no client describedby ids, remove aria-describedby' , ( ) => {
824
- const hasIcon = false ;
825
- const hasHelperText = true ;
826
- const mockId = 'foobarbazcool' ;
827
-
828
- const { foundation, mockAdapter, helperText} =
829
- setupTest ( hasIcon , hasHelperText , mockId ) ;
830
-
831
- helperText . getId . and . returnValue ( mockId ) ;
832
- helperText . isVisible . and . returnValue ( false ) ;
833
-
834
- foundation . setValid ( false ) ;
835
- expect ( mockAdapter . removeSelectAnchorAttr )
836
- . toHaveBeenCalledWith ( strings . ARIA_DESCRIBEDBY ) ;
837
- } ) ;
838
-
839
783
it ( '#setValid true sets aria-invalid to false and removes invalid classes' ,
840
784
( ) => {
841
785
const { foundation, mockAdapter} = setupTest ( ) ;
0 commit comments