Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(a11y): add a11y selected label improvements to checkout Address/PaymentMethod components #19381

Draft
wants to merge 11 commits into
base: develop
Choose a base branch
from

Conversation

uroslates
Copy link
Contributor

No description provided.

…DeliveryAddress/CheckoutPaymentMethod components
@uroslates uroslates requested review from a team as code owners October 10, 2024 11:49
@github-actions github-actions bot marked this pull request as draft October 10, 2024 11:49
@uroslates uroslates marked this pull request as ready for review October 10, 2024 15:13
Copy link

cypress bot commented Oct 10, 2024

spartacus    Run #45252

Run Properties:  status check passed Passed #45252  •  git commit cbebb7ad03 ℹ️: Merge e3d77e3d59a8a79a06cace548bf8a2ac4484fdc8 into ec946e913298491b43312c165626...
Project spartacus
Run status status check passed Passed #45252
Run duration 11m 58s
Commit git commit cbebb7ad03 ℹ️: Merge e3d77e3d59a8a79a06cace548bf8a2ac4484fdc8 into ec946e913298491b43312c165626...
Committer Uros Lates
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 4
Tests that did not run due to a developer annotating a test with .skip  Pending 2
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 125
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.

@@ -329,4 +335,12 @@ export class CheckoutDeliveryAddressComponent implements OnInit {
protected shouldUseAddressSavedInCart(): boolean {
return !!this.checkoutConfigService?.shouldUseAddressSavedInCart();
}

private getCardRole(isCardSelected: boolean): 'button' | 'region' {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice use of the feature flags here! Lets make this method protected instead of private so that lib users can still access it if they have a need to see/modify it without cloning the repo.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets also add a unit test assertion to check that the role is set correctly since there is some logic here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Addressed both of these in latest commit!

@github-actions github-actions bot marked this pull request as draft October 17, 2024 11:01
@uroslates
Copy link
Contributor Author

).role).toEqual('region');
});

it('should be set to "region" when feature flag is disabled', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't really need to test for the feature flags because they will be removed anyway next major and we can always assume they are active for unit tests. The main thing to test here was that isSelected sets the role correctly. Is it possible to remove any reference to feature flags here?

@@ -500,4 +562,11 @@ describe('CheckoutDeliveryAddressComponent', () => {
expect(getSpinner()).toBeFalsy();
});
});

// describe('getCardRole()', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left over?

expect(component['getCardRole']).toHaveBeenCalledWith(true);
});

it('should be set to "region" when feature flag is disabled', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as below about testing feature flags.

it('should be set to "region" for selected addresses when feature flag is enabled', () => {
spyOn(featureConfig, 'isEnabled').and.returnValue(true);
expect(component.getCardContent(
// isSelected = true!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left over reference note?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Addressed all test related comments in latest commit.

@uroslates uroslates requested a review from Zeyber October 18, 2024 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants