@@ -78,47 +78,26 @@ testFoundation('#init gracefully exits when css variables are not supported', fa
78
78
td . verify ( adapter . addClass ( cssClasses . ROOT ) , { times : 0 } ) ;
79
79
} ) ;
80
80
81
- testFoundation ( `#init sets ${ strings . VAR_FG_SIZE } to the circumscribing circle's diameter` ,
82
- ( { foundation, adapter, mockRaf} ) => {
83
- const size = 200 ;
84
- td . when ( adapter . computeBoundingRect ( ) ) . thenReturn ( { width : size , height : size / 2 } ) ;
85
- foundation . init ( ) ;
86
- mockRaf . flush ( ) ;
87
- const initialSize = size * numbers . INITIAL_ORIGIN_SCALE ;
88
-
89
- td . verify ( adapter . updateCssVariable ( strings . VAR_FG_SIZE , `${ initialSize } px` ) ) ;
90
- } ) ;
91
-
92
- testFoundation ( `#init centers via ${ strings . VAR_LEFT } and ${ strings . VAR_TOP } when unbounded` ,
93
- ( { foundation, adapter, mockRaf} ) => {
94
- const width = 200 ;
95
- const height = 100 ;
96
- const maxSize = Math . max ( width , height ) ;
97
- const initialSize = maxSize * numbers . INITIAL_ORIGIN_SCALE ;
98
-
99
- td . when ( adapter . computeBoundingRect ( ) ) . thenReturn ( { width, height} ) ;
100
- td . when ( adapter . isUnbounded ( ) ) . thenReturn ( true ) ;
101
- foundation . init ( ) ;
102
- mockRaf . flush ( ) ;
103
-
104
- td . verify ( adapter . updateCssVariable ( strings . VAR_LEFT ,
105
- `${ Math . round ( ( width / 2 ) - ( initialSize / 2 ) ) } px` ) ) ;
106
- td . verify ( adapter . updateCssVariable ( strings . VAR_TOP ,
107
- `${ Math . round ( ( height / 2 ) - ( initialSize / 2 ) ) } px` ) ) ;
108
- } ) ;
109
-
110
81
testFoundation ( '#init registers events for interactions on root element' , ( { foundation, adapter} ) => {
111
82
foundation . init ( ) ;
112
83
113
84
td . verify ( adapter . registerInteractionHandler ( td . matchers . isA ( String ) , td . matchers . isA ( Function ) ) ) ;
114
85
} ) ;
115
86
116
- testFoundation ( '#init registers an event for when a resize occurs' , ( { foundation, adapter} ) => {
87
+ testFoundation ( '#init registers a resize handler for unbounded ripple' , ( { foundation, adapter} ) => {
88
+ td . when ( adapter . isUnbounded ( ) ) . thenReturn ( true ) ;
117
89
foundation . init ( ) ;
118
90
119
91
td . verify ( adapter . registerResizeHandler ( td . matchers . isA ( Function ) ) ) ;
120
92
} ) ;
121
93
94
+ testFoundation ( '#init does not register a resize handler for bounded ripple' , ( { foundation, adapter} ) => {
95
+ td . when ( adapter . isUnbounded ( ) ) . thenReturn ( false ) ;
96
+ foundation . init ( ) ;
97
+
98
+ td . verify ( adapter . registerResizeHandler ( td . matchers . isA ( Function ) ) , { times : 0 } ) ;
99
+ } ) ;
100
+
122
101
testFoundation ( '#init does not register events if CSS custom properties not supported' , ( { foundation, adapter} ) => {
123
102
td . when ( adapter . browserSupportsCssVars ( ) ) . thenReturn ( false ) ;
124
103
foundation . init ( ) ;
@@ -144,8 +123,9 @@ testFoundation('#destroy unregisters all bound interaction handlers', ({foundati
144
123
td . verify ( adapter . deregisterDocumentInteractionHandler ( td . matchers . isA ( String ) , td . matchers . isA ( Function ) ) ) ;
145
124
} ) ;
146
125
147
- testFoundation ( '#destroy unregisters the resize handler' , ( { foundation, adapter} ) => {
126
+ testFoundation ( '#destroy unregisters the resize handler for unbounded ripple ' , ( { foundation, adapter} ) => {
148
127
let resizeHandler ;
128
+ td . when ( adapter . isUnbounded ( ) ) . thenReturn ( true ) ;
149
129
td . when ( adapter . registerResizeHandler ( td . matchers . isA ( Function ) ) ) . thenDo ( ( handler ) => {
150
130
resizeHandler = handler ;
151
131
} ) ;
@@ -155,6 +135,14 @@ testFoundation('#destroy unregisters the resize handler', ({foundation, adapter}
155
135
td . verify ( adapter . deregisterResizeHandler ( resizeHandler ) ) ;
156
136
} ) ;
157
137
138
+ testFoundation ( '#destroy does not unregister resize handler for bounded ripple' , ( { foundation, adapter} ) => {
139
+ td . when ( adapter . isUnbounded ( ) ) . thenReturn ( false ) ;
140
+ foundation . init ( ) ;
141
+ foundation . destroy ( ) ;
142
+
143
+ td . verify ( adapter . deregisterResizeHandler ( td . matchers . isA ( Function ) ) , { times : 0 } ) ;
144
+ } ) ;
145
+
158
146
testFoundation ( `#destroy removes ${ cssClasses . ROOT } ` , ( { foundation, adapter, mockRaf} ) => {
159
147
foundation . destroy ( ) ;
160
148
mockRaf . flush ( ) ;
0 commit comments