@@ -42,11 +42,9 @@ const ANIMATION_FRAME = 1;
42
42
function expectTooltipToHaveBeenShown (
43
43
foundation : MDCTooltipFoundation ,
44
44
mockAdapter : jasmine . SpyObj < MDCTooltipAdapter > ) {
45
- if ( foundation . getIsRich ( ) ) {
46
- if ( foundation [ 'isInteractive' ] ) {
47
- expect ( mockAdapter . setAnchorAttribute )
48
- . toHaveBeenCalledWith ( 'aria-expanded' , 'true' ) ;
49
- }
45
+ if ( foundation . isRich ( ) && foundation [ 'interactiveTooltip' ] ) {
46
+ expect ( mockAdapter . setAnchorAttribute )
47
+ . toHaveBeenCalledWith ( 'aria-expanded' , 'true' ) ;
50
48
}
51
49
52
50
expect ( mockAdapter . setAttribute ) . toHaveBeenCalledWith ( 'aria-hidden' , 'false' ) ;
@@ -60,11 +58,9 @@ function expectTooltipToHaveBeenShown(
60
58
function expectTooltipToHaveBeenHidden (
61
59
foundation : MDCTooltipFoundation ,
62
60
mockAdapter : jasmine . SpyObj < MDCTooltipAdapter > ) {
63
- if ( foundation . getIsRich ( ) ) {
64
- if ( foundation [ 'isInteractive' ] ) {
65
- expect ( mockAdapter . setAnchorAttribute )
66
- . toHaveBeenCalledWith ( 'aria-expanded' , 'false' ) ;
67
- }
61
+ if ( foundation . isRich ( ) && foundation [ 'interactiveTooltip' ] ) {
62
+ expect ( mockAdapter . setAnchorAttribute )
63
+ . toHaveBeenCalledWith ( 'aria-expanded' , 'false' ) ;
68
64
}
69
65
70
66
expect ( mockAdapter . setAttribute ) . toHaveBeenCalledWith ( 'aria-hidden' , 'true' ) ;
@@ -79,11 +75,9 @@ function expectTooltipToHaveBeenHidden(
79
75
function expectTooltipNotToHaveBeenHidden (
80
76
foundation : MDCTooltipFoundation ,
81
77
mockAdapter : jasmine . SpyObj < MDCTooltipAdapter > ) {
82
- if ( foundation . getIsRich ( ) ) {
83
- if ( foundation [ 'isInteractive' ] ) {
84
- expect ( mockAdapter . setAnchorAttribute )
85
- . not . toHaveBeenCalledWith ( 'aria-expanded' , 'false' ) ;
86
- }
78
+ if ( foundation . isRich ( ) && foundation [ 'interactiveTooltip' ] ) {
79
+ expect ( mockAdapter . setAnchorAttribute )
80
+ . not . toHaveBeenCalledWith ( 'aria-expanded' , 'false' ) ;
87
81
}
88
82
89
83
expect ( mockAdapter . setAttribute )
@@ -143,48 +137,48 @@ describe('MDCTooltipFoundation', () => {
143
137
] ) ;
144
138
} ) ;
145
139
146
- it ( '#getIsRich returns false for plain tooltip' , ( ) => {
140
+ it ( '#isRich returns false for plain tooltip' , ( ) => {
147
141
const { foundation, mockAdapter} = setUpFoundationTest ( MDCTooltipFoundation ) ;
148
142
mockAdapter . hasClass . withArgs ( CssClasses . RICH ) . and . returnValue ( false ) ;
149
143
foundation . init ( ) ;
150
144
151
- expect ( foundation . getIsRich ( ) ) . toBeFalse ( ) ;
145
+ expect ( foundation . isRich ( ) ) . toBeFalse ( ) ;
152
146
} ) ;
153
147
154
- it ( '#getIsRich returns true for rich tooltip' , ( ) => {
148
+ it ( '#isRich returns true for rich tooltip' , ( ) => {
155
149
const { foundation} =
156
150
setUpFoundationTestForRichTooltip ( MDCTooltipFoundation ) ;
157
151
158
- expect ( foundation . getIsRich ( ) ) . toBeTrue ( ) ;
152
+ expect ( foundation . isRich ( ) ) . toBeTrue ( ) ;
159
153
} ) ;
160
154
161
- it ( '#getIsPersistent returns false for default rich tooltip' , ( ) => {
155
+ it ( '#isPersistent returns false for default rich tooltip' , ( ) => {
162
156
const { foundation} =
163
157
setUpFoundationTestForRichTooltip ( MDCTooltipFoundation ) ;
164
158
165
- expect ( foundation . getIsPersistent ( ) ) . toBeFalse ( ) ;
159
+ expect ( foundation . isPersistent ( ) ) . toBeFalse ( ) ;
166
160
} ) ;
167
161
168
- it ( '#getIsPersistent returns true for persistent rich tooltip' , ( ) => {
162
+ it ( '#isPersistent returns true for persistent rich tooltip' , ( ) => {
169
163
const { foundation} = setUpFoundationTestForRichTooltip (
170
164
MDCTooltipFoundation , { isPersistent : true } ) ;
171
165
172
- expect ( foundation . getIsPersistent ( ) ) . toBeTrue ( ) ;
166
+ expect ( foundation . isPersistent ( ) ) . toBeTrue ( ) ;
173
167
} ) ;
174
168
175
- it ( '#getIsShown returns true if the tooltip is currently shown' , ( ) => {
169
+ it ( '#isShown returns true if the tooltip is currently shown' , ( ) => {
176
170
const { foundation} = setUpFoundationTest ( MDCTooltipFoundation ) ;
177
171
foundation . show ( ) ;
178
172
179
- expect ( foundation . getIsShown ( ) ) . toBeTrue ( ) ;
173
+ expect ( foundation . isShown ( ) ) . toBeTrue ( ) ;
180
174
} ) ;
181
175
182
- it ( '#getIsShown returns false if the tooltip is currently hidden' , ( ) => {
176
+ it ( '#isShown returns false if the tooltip is currently hidden' , ( ) => {
183
177
const { foundation} = setUpFoundationTest ( MDCTooltipFoundation ) ;
184
178
foundation . show ( ) ;
185
179
foundation . hide ( ) ;
186
180
187
- expect ( foundation . getIsShown ( ) ) . toBeFalse ( ) ;
181
+ expect ( foundation . isShown ( ) ) . toBeFalse ( ) ;
188
182
} ) ;
189
183
190
184
it ( '#show modifies tooltip element so it is shown' , ( ) => {
@@ -849,7 +843,7 @@ describe('MDCTooltipFoundation', () => {
849
843
const { foundation, mockAdapter} = setUpFoundationTestForRichTooltip (
850
844
MDCTooltipFoundation , { isPersistent : true } ) ;
851
845
852
- expect ( foundation . isShown ) . toBe ( false ) ;
846
+ expect ( foundation . isShown ( ) ) . toBeFalse ( ) ;
853
847
foundation . handleAnchorClick ( ) ;
854
848
855
849
expectTooltipToHaveBeenShown ( foundation , mockAdapter ) ;
@@ -1038,7 +1032,7 @@ describe('MDCTooltipFoundation', () => {
1038
1032
expect ( foundation . hideTimeout ) . toEqual ( null ) ;
1039
1033
expect ( mockAdapter . setAttribute )
1040
1034
. not . toHaveBeenCalledWith ( 'aria-hidden' , 'true' ) ;
1041
- expect ( foundation . isShown ) . toBeTrue ( ) ;
1035
+ expect ( foundation . isShown ( ) ) . toBeTrue ( ) ;
1042
1036
} ) ;
1043
1037
1044
1038
it ( '#hide clears any pending showTimeout' , ( ) => {
@@ -1571,28 +1565,27 @@ describe('MDCTooltipFoundation', () => {
1571
1565
. toHaveBeenCalledWith ( 'resize' , jasmine . any ( Function ) ) ;
1572
1566
} ) ;
1573
1567
1574
- it ( '#destroy removes the event listeners for default rich tooltips' ,
1575
- ( ) => {
1576
- const { foundation, mockAdapter} =
1577
- setUpFoundationTestForRichTooltip ( MDCTooltipFoundation ) ;
1568
+ it ( '#destroy removes the event listeners for default rich tooltips' , ( ) => {
1569
+ const { foundation, mockAdapter} =
1570
+ setUpFoundationTestForRichTooltip ( MDCTooltipFoundation ) ;
1578
1571
1579
- foundation . destroy ( ) ;
1572
+ foundation . destroy ( ) ;
1580
1573
1581
- expect ( mockAdapter . deregisterEventHandler )
1582
- . toHaveBeenCalledWith ( 'focusout' , jasmine . any ( Function ) ) ;
1583
- expect ( mockAdapter . deregisterEventHandler )
1584
- . toHaveBeenCalledWith ( 'mouseenter' , jasmine . any ( Function ) ) ;
1585
- expect ( mockAdapter . deregisterEventHandler )
1586
- . toHaveBeenCalledWith ( 'mouseleave' , jasmine . any ( Function ) ) ;
1587
- expect ( mockAdapter . deregisterDocumentEventHandler )
1588
- . toHaveBeenCalledWith ( 'click' , jasmine . any ( Function ) ) ;
1589
- expect ( mockAdapter . deregisterDocumentEventHandler )
1590
- . toHaveBeenCalledWith ( 'keydown' , jasmine . any ( Function ) ) ;
1591
- expect ( mockAdapter . deregisterWindowEventHandler )
1592
- . toHaveBeenCalledWith ( 'scroll' , jasmine . any ( Function ) ) ;
1593
- expect ( mockAdapter . deregisterWindowEventHandler )
1594
- . toHaveBeenCalledWith ( 'resize' , jasmine . any ( Function ) ) ;
1595
- } ) ;
1574
+ expect ( mockAdapter . deregisterEventHandler )
1575
+ . toHaveBeenCalledWith ( 'focusout' , jasmine . any ( Function ) ) ;
1576
+ expect ( mockAdapter . deregisterEventHandler )
1577
+ . toHaveBeenCalledWith ( 'mouseenter' , jasmine . any ( Function ) ) ;
1578
+ expect ( mockAdapter . deregisterEventHandler )
1579
+ . toHaveBeenCalledWith ( 'mouseleave' , jasmine . any ( Function ) ) ;
1580
+ expect ( mockAdapter . deregisterDocumentEventHandler )
1581
+ . toHaveBeenCalledWith ( 'click' , jasmine . any ( Function ) ) ;
1582
+ expect ( mockAdapter . deregisterDocumentEventHandler )
1583
+ . toHaveBeenCalledWith ( 'keydown' , jasmine . any ( Function ) ) ;
1584
+ expect ( mockAdapter . deregisterWindowEventHandler )
1585
+ . toHaveBeenCalledWith ( 'scroll' , jasmine . any ( Function ) ) ;
1586
+ expect ( mockAdapter . deregisterWindowEventHandler )
1587
+ . toHaveBeenCalledWith ( 'resize' , jasmine . any ( Function ) ) ;
1588
+ } ) ;
1596
1589
1597
1590
it ( '#destroy removes the event listeners for persistent rich tooltips' ,
1598
1591
( ) => {
0 commit comments