Skip to content

Commit

Permalink
Merge branch 'develop' into feature/CXSPA-9003
Browse files Browse the repository at this point in the history
  • Loading branch information
uroslates authored Jan 13, 2025
2 parents 7daf75f + a7a1014 commit f3123ad
Show file tree
Hide file tree
Showing 9 changed files with 100 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"
type="submit"
[disabled]="disabled || quantity <= 0 || quantity > maxQuantity"
[attr.aria-describedby]="productCode + '_header'"
>
<span
*ngIf="
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,69 @@
<div
[attr.data-preferred-store]="pointOfServiceName.name"
[attr.data-store-is-selected]="
pointOfServiceName.name === (storeSelected$ | async)?.name
"
class="setpreferredstore-container"
(click)="setAsPreferred()"
>
<ng-container *cxFeature="'a11yRepeatingButtonsUniqueLabels'">
<ng-container *ngIf="{ storeSelected: storeSelected$ | async } as data">
<div
[attr.data-preferred-store]="pointOfServiceName.name"
[attr.data-store-is-selected]="
pointOfServiceName.name === data.storeSelected?.name
"
class="setpreferredstore-container"
(click)="setAsPreferred()"
>
<div
[ngClass]="
pointOfServiceName.name === data.storeSelected?.name
? 'icon-selected'
: 'icon-not-selected'
"
>
<cx-icon aria-hidden="true" [type]="ICON_TYPE.HEART"></cx-icon>
</div>
<button
data-text="setPreferredStore.myStore"
[attr.data-preferred-store]="pointOfServiceName.name"
class="set-preferred-heading"
[attr.aria-label]="
(getSetStoreButtonLabel(data.storeSelected?.name || '')
| cxTranslate) +
', ' +
pointOfServiceName.displayName
"
>
{{
getSetStoreButtonLabel(data.storeSelected?.name || '') | cxTranslate
}}
</button>
</div>
</ng-container>
</ng-container>
<ng-container *cxFeature="'!a11yRepeatingButtonsUniqueLabels'">
<div
[ngClass]="{
'icon-selected':
pointOfServiceName.name === (storeSelected$ | async)?.name,
'icon-not-selected':
pointOfServiceName.name !== (storeSelected$ | async)?.name,
}"
>
<cx-icon aria-hidden="true" [type]="ICON_TYPE.HEART"></cx-icon>
</div>
<button
data-text="setPreferredStore.myStore"
[attr.data-preferred-store]="pointOfServiceName.name"
class="set-preferred-heading"
>
{{
[attr.data-store-is-selected]="
pointOfServiceName.name === (storeSelected$ | async)?.name
? ('setPreferredStore.myStore' | cxTranslate)
: ('setPreferredStore.makeThisMyStore' | cxTranslate)
}}
</button>
</div>
"
class="setpreferredstore-container"
(click)="setAsPreferred()"
>
<div
[ngClass]="{
'icon-selected':
pointOfServiceName.name === (storeSelected$ | async)?.name,
'icon-not-selected':
pointOfServiceName.name !== (storeSelected$ | async)?.name,
}"
>
<cx-icon aria-hidden="true" [type]="ICON_TYPE.HEART"></cx-icon>
</div>
<button
data-text="setPreferredStore.myStore"
[attr.data-preferred-store]="pointOfServiceName.name"
class="set-preferred-heading"
>
{{
pointOfServiceName.name === (storeSelected$ | async)?.name
? ('setPreferredStore.myStore' | cxTranslate)
: ('setPreferredStore.makeThisMyStore' | cxTranslate)
}}
</button>
</div>
</ng-container>
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
PreferredStoreFacade,
} from '@spartacus/pickup-in-store/root';
import { IconTestingModule, OutletContextData } from '@spartacus/storefront';
import { MockFeatureDirectivesModule } from 'projects/storefrontlib/shared/test/mock-feature-directives.module';
import { of } from 'rxjs';
import { MockPreferredStoreService } from '../../../core/services/preferred-store.service.spec';
import { SetPreferredStoreComponent } from './set-preferred-store.component';
Expand All @@ -24,7 +25,12 @@ describe('SetPreferredStoreComponent without outlet.context$', () => {
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [SetPreferredStoreComponent],
imports: [I18nTestingModule, IconTestingModule, CommonModule],
imports: [
I18nTestingModule,
IconTestingModule,
CommonModule,
MockFeatureDirectivesModule,
],
providers: [
{ provide: PreferredStoreFacade, useClass: MockPreferredStoreService },
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,15 @@ export class SetPreferredStoreComponent implements OnInit, OnDestroy {
ngOnDestroy() {
this.subscription.unsubscribe();
}

setAsPreferred(): boolean {
this.preferredStoreFacade.setPreferredStore(this.pointOfServiceName);
return false;
}

getSetStoreButtonLabel(storeName: string): string {
return this.pointOfServiceName.name === storeName
? 'setPreferredStore.myStore'
: 'setPreferredStore.makeThisMyStore';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { I18nModule } from '@spartacus/core';
import { FeaturesConfigModule, I18nModule } from '@spartacus/core';
import { StoreFinderOutlets } from '@spartacus/storefinder/root';
import {
IconModule,
Expand All @@ -16,7 +16,7 @@ import {
import { SetPreferredStoreComponent } from './set-preferred-store.component';

@NgModule({
imports: [CommonModule, IconModule, I18nModule],
imports: [CommonModule, IconModule, I18nModule, FeaturesConfigModule],
exports: [SetPreferredStoreComponent],
declarations: [SetPreferredStoreComponent],
providers: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
<button
(click)="toggleOpenHours()"
[attr.aria-expanded]="openHoursOpen"
[attr.aria-label]="
('store.viewHours' | cxTranslate) +
', ' +
storeDetails.displayName
"
class="cx-store-opening-hours-toggle"
>
{{ 'store.viewHours' | cxTranslate }}
Expand Down Expand Up @@ -65,6 +70,9 @@
class="btn btn-secondary btn-block"
[disabled]="!isInStock"
[attr.data-pickup-in-store-button]="storeDetails.name"
[attr.aria-label]="
('store.pickupFromHere' | cxTranslate) + ', ' + storeDetails.displayName
"
>
{{ 'store.pickupFromHere' | cxTranslate }}
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,12 @@ export interface FeatureTogglesInterface {
*/
a11yHideConsentButtonWhenBannerVisible?: boolean;

/**
* Adds a unique `aria-label` to repeating buttons that contain the same text.
* Affects: SetPreferredStoreComponent
*/
a11yRepeatingButtonsUniqueLabels?: boolean;

/**
* Ensures that borders across all UI elements are visible and meet accessibility standards in high-contrast dark and light themes.
* This change is applied globally to enhance usability for users relying on high-contrast modes.
Expand Down Expand Up @@ -1091,6 +1097,7 @@ export const defaultFeatureToggles: Required<FeatureTogglesInterface> = {
a11yFocusOnCardAfterSelecting: false,
a11ySearchableDropdownFirstElementFocus: false,
a11yHideConsentButtonWhenBannerVisible: false,
a11yRepeatingButtonsUniqueLabels: false,
a11yHighContrastBorders: false,
occCartNameAndDescriptionInHttpRequestBody: false,
cmsBottomHeaderSlotUsingFlexStyles: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ if (environment.cpq) {
a11yFocusOnCardAfterSelecting: true,
a11ySearchableDropdownFirstElementFocus: true,
a11yHideConsentButtonWhenBannerVisible: true,
a11yRepeatingButtonsUniqueLabels: true,
a11yHighContrastBorders: true,
cmsBottomHeaderSlotUsingFlexStyles: true,
useSiteThemeService: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</div>
<div class="col-12 col-md-8">
<ng-container *cxFeature="'a11yExpandedFocusIndicator'">
<h2 class="cx-product-name">
<h2 [id]="product.code + '_header'" class="cx-product-name">
<a
[routerLink]="{ cxRoute: 'product', params: product } | cxUrl"
[innerHtml]="product.nameHtml"
Expand Down

0 comments on commit f3123ad

Please sign in to comment.