Skip to content

Commit

Permalink
fix: VO does not read the top section of the asm 360 dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
hakwookim committed Oct 26, 2023
1 parent 3838d4c commit 3c5efc0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
import {
DirectionMode,
DirectionService,
FocusDirective,
LaunchDialogService,
} from '@spartacus/storefront';
import { BehaviorSubject, Observable, of, throwError } from 'rxjs';
Expand Down Expand Up @@ -177,6 +178,7 @@ describe('AsmCustomer360Component', () => {
AsmCustomer360Component,
MockAsmCustomer360SectionComponent,
ArgsPipe,
FocusDirective,
],
providers: [
CxDatePipe,
Expand Down Expand Up @@ -327,15 +329,16 @@ describe('AsmCustomer360Component', () => {
mockAsmConfig.asmCustomer360?.tabs?.length
);
});
it('should activate the first tab when dialog opens', () => {
expect(document.activeElement).toBe(
component.tabHeaderItems.toArray()[0].nativeElement
);
it('should activate the close button', () => {
expect(document.activeElement?.className).toBe('close');
});

it('should switch tab selection', () => {
const firstTab = component.tabHeaderItems.toArray()[0].nativeElement;
const secondTab = component.tabHeaderItems.toArray()[1].nativeElement;

component.selectTab(0);

let event = {
code: 'ArrowRight',
stopPropagation: () => {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

import {
AfterViewInit,
ChangeDetectionStrategy,
Component,
ElementRef,
Expand Down Expand Up @@ -51,9 +50,7 @@ import { AsmCustomer360Config } from '../config/asm-customer-360-config';
selector: 'cx-asm-customer-360',
templateUrl: './asm-customer-360.component.html',
})
export class AsmCustomer360Component
implements OnDestroy, OnInit, AfterViewInit
{
export class AsmCustomer360Component implements OnDestroy, OnInit {
@HostBinding('attr.role') role = 'dialog';
@HostBinding('attr.aria-modal') modal = true;
@HostBinding('attr.aria-labelledby') labelledby = 'asm-customer-360-title';
Expand All @@ -71,7 +68,7 @@ export class AsmCustomer360Component
focusConfig: FocusConfig = {
trap: true,
block: true,
autofocus: '.cx-tab-header.active',
autofocus: '.close',
focusOnEscape: true,
};

Expand Down Expand Up @@ -143,10 +140,6 @@ export class AsmCustomer360Component
this.setTabData();
}

ngAfterViewInit(): void {
this.updateTabIndex(this.activeTab);
}

ngOnDestroy(): void {
this.subscription.unsubscribe();
}
Expand Down

0 comments on commit 3c5efc0

Please sign in to comment.