File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
ember-basic-dropdown/src/components Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -405,10 +405,28 @@ export default class BasicDropdown extends Component<BasicDropdownSignature> {
405405 } ;
406406
407407 if ( config . environment === 'test' ) {
408- // document doesn't exists in fastboot apps, for this reason we need this check
408+ // document doesn't exist in fastboot apps, for this reason we need this check
409409 if ( typeof document === 'undefined' ) {
410410 return 'ember-basic-dropdown-wormhole' ;
411411 }
412+
413+ // check if destination exists in tests:
414+ if (
415+ config [ 'ember-basic-dropdown' ] &&
416+ config [ 'ember-basic-dropdown' ] . destination
417+ ) {
418+ const destination = config [ 'ember-basic-dropdown' ] . destination ;
419+ if ( document . getElementById ( destination ) !== null ) {
420+ return destination ;
421+ }
422+ }
423+
424+ // check if default element exists in tests:
425+ if ( document . getElementById ( 'ember-basic-dropdown-wormhole' ) !== null ) {
426+ return 'ember-basic-dropdown-wormhole' ;
427+ }
428+
429+ // fall back to rootElement as destination
412430 const rootElement = config [ 'APP' ] ?. rootElement ;
413431 return (
414432 document . querySelector ( rootElement ) ?. id ??
You can’t perform that action at this time.
0 commit comments