File tree Expand file tree Collapse file tree 4 files changed +25
-6
lines changed
ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container
ui.tests/test-module/libs/support Expand file tree Collapse file tree 4 files changed +25
-6
lines changed Original file line number Diff line number Diff line change @@ -66,3 +66,5 @@ BLOCK cmp-adaptiveform-container
66
66
## JavaScript Data Attribute Bindings
67
67
68
68
Apply a ` data-cmp-is="adaptiveFormContainer" ` attribute to the ` cmp-adaptiveform-container ` block to enable initialization of the JavaScript component.
69
+
70
+ Applying ` data-cmp-adaptiveform-container-loader ` attribute to the div specifically for applying the loader class on it, it is to ensure that the loading icon should not appear over components.
Original file line number Diff line number Diff line change 63
63
const startTime = new Date ( ) . getTime ( ) ;
64
64
let elements = document . querySelectorAll ( FormContainerV2 . selectors . self ) ;
65
65
for ( let i = 0 ; i < elements . length ; i ++ ) {
66
- elements [ i ] . classList . add ( FormContainerV2 . loadingClass ) ;
66
+ let loaderToAdd = document . querySelector ( "[data-cmp-adaptiveform-container-loader='" + elements [ i ] . id + "']" ) ;
67
+ if ( loaderToAdd ) {
68
+ loaderToAdd . classList . add ( FormContainerV2 . loadingClass ) ;
69
+ }
67
70
console . debug ( "Form loading started" , elements [ i ] . id ) ;
68
71
}
69
72
function onInit ( e ) {
70
73
let formContainer = e . detail ;
71
74
let formEl = formContainer . getFormElement ( ) ;
72
75
setTimeout ( ( ) => {
73
- formEl . classList . remove ( FormContainerV2 . loadingClass ) ;
76
+ let loaderToRemove = document . querySelector ( "[data-cmp-adaptiveform-container-loader='" + formEl . id + "']" ) ;
77
+ if ( loaderToRemove ) {
78
+ loaderToRemove . classList . remove ( FormContainerV2 . loadingClass ) ;
79
+ }
74
80
const timeTaken = new Date ( ) . getTime ( ) - startTime ;
75
81
console . debug ( "Form loading complete" , formEl . id , timeTaken ) ;
76
82
} , 10 ) ;
Original file line number Diff line number Diff line change 42
42
< sly data-sly-use ="${'removeattribute.js' @ referencedPage } "/>
43
43
</ div >
44
44
</ form >
45
-
45
+ < div data-cmp-adaptiveform-container-loader =" ${container.id} " > </ div >
Original file line number Diff line number Diff line change @@ -338,14 +338,20 @@ const waitForFormInit = () => {
338
338
cy . get ( 'form' ) . then ( ( $form ) => {
339
339
const promise = new Cypress . Promise ( ( resolve , reject ) => {
340
340
const listener1 = e => {
341
+ if ( document . querySelector ( "[data-cmp-adaptiveform-container-loader='" + $form [ 0 ] . id + "']" ) . classList . contains ( "cmp-adaptiveform-container--loading" ) ) {
341
342
const isReady = ( ) => {
342
- if ( ! ( $form [ 0 ] . classList . contains ( "cmp-adaptiveform-container--loading" ) ) ) {
343
+ const container = document . querySelector ( "[data-cmp-adaptiveform-container-loader='" + $form [ 0 ] . id + "']" ) ;
344
+ if ( container &&
345
+ e . detail . _path === $form . data ( "cmp-path" ) &&
346
+ ! container . classList . contains ( "cmp-adaptiveform-container--loading" ) ) {
347
+
343
348
resolve ( e . detail ) ;
344
349
}
345
350
setTimeout ( isReady , 0 )
346
351
}
347
352
isReady ( ) ;
348
353
}
354
+ }
349
355
document . addEventListener ( INIT_EVENT , listener1 ) ;
350
356
} )
351
357
return promise
@@ -360,15 +366,20 @@ const waitForFormInitMultipleContiners = () => {
360
366
cy . get ( 'form' ) . each ( ( $form ) => {
361
367
const promise = new Cypress . Promise ( ( resolve , reject ) => {
362
368
const listener1 = e => {
369
+ if ( document . querySelector ( "[data-cmp-adaptiveform-container-loader='" + $form [ 0 ] . id + "']" ) . classList . contains ( "cmp-adaptiveform-container--loading" ) ) {
363
370
const isReady = ( ) => {
364
- if ( e . detail . _path === $form . data ( "cmp-path" ) &&
365
- ! ( $form [ 0 ] . classList . contains ( "cmp-adaptiveform-container--loading" ) ) ) {
371
+ const container = document . querySelector ( "[data-cmp-adaptiveform-container-loader='" + $form [ 0 ] . id + "']" ) ;
372
+ if ( container &&
373
+ e . detail . _path === $form . data ( "cmp-path" ) &&
374
+ ! container . classList . contains ( "cmp-adaptiveform-container--loading" ) ) {
375
+
366
376
resolve ( e . detail ) ;
367
377
}
368
378
setTimeout ( isReady , 0 )
369
379
}
370
380
isReady ( ) ;
371
381
}
382
+ }
372
383
document . addEventListener ( INIT_EVENT , listener1 ) ;
373
384
} )
374
385
You can’t perform that action at this time.
0 commit comments