81901: Make expandable section not a link

This commit is contained in:
Yura Bondarenko
2021-08-16 17:02:28 +02:00
parent 214833af68
commit 2fa06d28e3
2 changed files with 6 additions and 4 deletions

View File

@@ -2,13 +2,13 @@
[@bgColor]="{ [@bgColor]="{
value: ((expanded | async) ? 'endBackground' : 'startBackground'), value: ((expanded | async) ? 'endBackground' : 'startBackground'),
params: {endColor: (sidebarActiveBg | async)}}"> params: {endColor: (sidebarActiveBg | async)}}">
<a class="nav-item nav-link d-flex flex-row flex-nowrap" <div class="nav-item nav-link d-flex flex-row flex-nowrap"
role="button" tabindex="0"
[attr.aria-labelledby]="'sidebarName-' + section.id" [attr.aria-labelledby]="'sidebarName-' + section.id"
[attr.aria-expanded]="expanded | async" [attr.aria-expanded]="expanded | async"
[title]="('menu.section.icon.' + section.id) | translate" [title]="('menu.section.icon.' + section.id) | translate"
(click)="toggleSection($event)" (click)="toggleSection($event)"
(keyup.space)="$event.stopPropagation(); toggleSection($event)" (keyup.space)="$event.stopPropagation(); toggleSection($event)"
href="javascript:void(0);"
> >
<div class="shortcut-icon h-100"> <div class="shortcut-icon h-100">
<i class="fas fa-{{section.icon}} fa-fw"></i> <i class="fas fa-{{section.icon}} fa-fw"></i>
@@ -31,5 +31,5 @@
</li> </li>
</ul> </ul>
</div> </div>
</a> </div>
</div> </div>

View File

@@ -10,6 +10,8 @@ import { Component } from '@angular/core';
import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { By } from '@angular/platform-browser'; import { By } from '@angular/platform-browser';
import { TranslateModule } from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';
import { Router } from '@angular/router';
import { RouterStub } from '../../../shared/testing/router.stub';
describe('ExpandableAdminSidebarSectionComponent', () => { describe('ExpandableAdminSidebarSectionComponent', () => {
let component: ExpandableAdminSidebarSectionComponent; let component: ExpandableAdminSidebarSectionComponent;
@@ -53,7 +55,7 @@ describe('ExpandableAdminSidebarSectionComponent', () => {
describe('when the header text is clicked', () => { describe('when the header text is clicked', () => {
beforeEach(() => { beforeEach(() => {
spyOn(menuService, 'toggleActiveSection'); spyOn(menuService, 'toggleActiveSection');
const sidebarToggler = fixture.debugElement.query(By.css('.sidebar-section > a')); const sidebarToggler = fixture.debugElement.query(By.css('.sidebar-section > div.nav-item'));
sidebarToggler.triggerEventHandler('click', { sidebarToggler.triggerEventHandler('click', {
preventDefault: () => {/**/ preventDefault: () => {/**/
} }