1- /* eslint-disable no-undef */
2-
31describe ( 'Collapsible Plugin:' , ( ) => {
42 let collapsible , accordion , popout , expandable , expandablePreselect ;
53
@@ -80,8 +78,8 @@ describe('Collapsible Plugin:', () => {
8078 describe ( 'collapsible' , ( ) => {
8179 it ( 'should open all items, keeping all open' , ( done ) => {
8280 // Collapsible body height should be 0 on start when hidden.
83- let headers = expandable . querySelectorAll ( '.collapsible-header' ) ;
84- let bodies = expandable . querySelectorAll ( '.collapsible-body' ) ;
81+ const headers = expandable . querySelectorAll ( '.collapsible-header' ) ;
82+ const bodies = expandable . querySelectorAll ( '.collapsible-body' ) ;
8583 for ( let i = 0 ; i < bodies . length ; i ++ ) {
8684 expect ( bodies [ i ] ) . hasMaxHeightZero (
8785 'because collapsible bodies should be hidden initially.'
@@ -103,9 +101,9 @@ describe('Collapsible Plugin:', () => {
103101 } ) ;
104102
105103 it ( 'should allow preopened sections' , ( ) => {
106- let bodies = expandablePreselect . querySelectorAll ( '.collapsible-body' ) ;
104+ const bodies = expandablePreselect . querySelectorAll ( '.collapsible-body' ) ;
107105 for ( let i = 0 ; i < bodies . length ; i ++ ) {
108- let headerLi = bodies [ i ] . parentNode ;
106+ const headerLi = bodies [ i ] . parentNode ;
109107 if ( i === 1 ) {
110108 expect ( headerLi ) . toHaveClass (
111109 'active' ,
@@ -136,15 +134,15 @@ describe('Collapsible Plugin:', () => {
136134 inDuration : 0 ,
137135 outDuration : 0
138136 } ) ;
139- let bodies = expandable . querySelectorAll ( '.collapsible-body' ) ;
137+ const bodies = expandable . querySelectorAll ( '.collapsible-body' ) ;
140138 expect ( openCallback ) . toEqual ( false , 'because open callback not yet fired' ) ;
141139 expect ( closeCallback ) . toEqual ( false , 'because close callback not yet fired' ) ;
142140 for ( let i = 0 ; i < bodies . length ; i ++ ) {
143141 //TODO replace with alternative for deprecated jasmine-jquery
144142 expect ( bodies [ i ] ) . hasMaxHeightZero (
145143 'because collapsible bodies should be hidden initially.'
146144 ) ;
147- let collapsibleInstance = M . Collapsible . getInstance ( bodies [ i ] . parentNode . parentNode ) ;
145+ const collapsibleInstance = M . Collapsible . getInstance ( bodies [ i ] . parentNode . parentNode ) ;
148146 collapsibleInstance . open ( i ) ;
149147 }
150148 expect ( openCallback ) . toEqual ( true , 'because open callback fired' ) ;
@@ -171,10 +169,10 @@ describe('Collapsible Plugin:', () => {
171169 describe ( 'accordion' , ( ) => {
172170 it ( 'should open first and second items, keeping only second open' , ( done ) => {
173171 // Collapsible body height should be 0 on start when hidden.
174- let firstHeader = accordion . querySelector ( '.collapsible-header' ) ;
175- let firstBody = accordion . querySelector ( '.collapsible-body' ) ;
176- let secondHeader = accordion . querySelectorAll ( '.collapsible-header' ) [ 1 ] ;
177- let secondBody = accordion . querySelectorAll ( '.collapsible-body' ) [ 1 ] ;
172+ const firstHeader = accordion . querySelector ( '.collapsible-header' ) ;
173+ const firstBody = accordion . querySelector ( '.collapsible-body' ) ;
174+ const secondHeader = accordion . querySelectorAll ( '.collapsible-header' ) [ 1 ] ;
175+ const secondBody = accordion . querySelectorAll ( '.collapsible-body' ) [ 1 ] ;
178176 expect ( firstBody ) . hasMaxHeightZero ( 'because accordion bodies should be hidden initially.' ) ;
179177 expect ( secondBody ) . hasMaxHeightZero ( 'because accordion bodies should be hidden initially.' ) ;
180178 // Collapsible body height should be > 0 after being opened.
@@ -200,15 +198,15 @@ describe('Collapsible Plugin:', () => {
200198 describe ( 'popout' , ( ) => {
201199 it ( 'should open first and popout' , ( done ) => {
202200 // Collapsible body height should be 0 on start when hidden.
203- let listItems = popout . querySelectorAll ( 'li' ) ;
204- let firstHeader = popout . querySelector ( '.collapsible-header' ) ;
205- let firstBody = popout . querySelector ( '.collapsible-body' ) ;
201+ const listItems = popout . querySelectorAll ( 'li' ) ;
202+ const firstHeader = popout . querySelector ( '.collapsible-header' ) ;
203+ const firstBody = popout . querySelector ( '.collapsible-body' ) ;
206204 expect ( firstBody ) . hasMaxHeightZero ( 'because accordion bodies should be hidden initially.' ) ;
207205 // Expect margin to be > 0 because not popped out.
208206 for ( let i = 0 ; i < listItems . length ; i ++ ) {
209- let listItemStyles = getComputedStyle ( listItems [ i ] ) ;
210- let marginLeft = parseInt ( listItemStyles . getPropertyValue ( 'margin-left' ) ) ;
211- let marginRight = parseInt ( listItemStyles . getPropertyValue ( 'margin-right' ) ) ;
207+ const listItemStyles = getComputedStyle ( listItems [ i ] ) ;
208+ const marginLeft = parseInt ( listItemStyles . getPropertyValue ( 'margin-left' ) ) ;
209+ const marginRight = parseInt ( listItemStyles . getPropertyValue ( 'margin-right' ) ) ;
212210 expect ( marginLeft ) . toBeGreaterThan (
213211 0 ,
214212 'because closed popout items should have horizontal margins.'
0 commit comments