Thanks to visit codestin.com
Credit goes to github.com

Skip to content

16j Solution #74

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

Open
wants to merge 2 commits into
base: 16j
Choose a base branch
from
Open

16j Solution #74

wants to merge 2 commits into from

Conversation

SuperSimpleDev
Copy link
Owner

No description provided.

Choose a reason for hiding this comment

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

Hi,

I got the error test suite: renderOrderSummary > updates the delivery option
TypeError: Cannot read properties of null (reading 'checked')

I have no idea why. Can anyone help please?

Choose a reason for hiding this comment

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

Check your class name correctly inside your radio selector input. Had the same error but make sure the classes assigned to delivery option and radio check selector option are different considering the code given here.
delivery-option has simple delivery-option-... and radio-check-selector-input class has delivery-option-input-.....

Choose a reason for hiding this comment

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

hello i have problem in this exercise i got an error:
test suite: renderOrderSummary > updates the delivery option
TypeError: Cannot read properties of null (reading 'click')
at UserContext. (http://127.0.0.1:5500/tests/checkout/orderSummaryTest.js:90:24)
at
is anyone able to help me? thanks a lot if someone can do so...

Copy link

@Pocky1559 Pocky1559 Jan 22, 2025

Choose a reason for hiding this comment

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

Did you set the querySelector in orderSummaryTest.js correctly? it should be .js-delivery-option-${productId1}-3.
if you set it correctly try checking is your add class to the delivery option in ordersummary.js yet. The class should look something like js-delivery-option-${matchingProduct.id}-${deliveryOption.id}

Copy link

@kenshih1989 kenshih1989 Apr 16, 2025

Choose a reason for hiding this comment

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

hello i have problem in this exercise i got an error: test suite: renderOrderSummary > updates the delivery option TypeError: Cannot read properties of null (reading 'click') at UserContext. (http://127.0.0.1:5500/tests/checkout/orderSummaryTest.js:90:24) at is anyone able to help me? thanks a lot if someone can do so...

Hi, please check if you got put the correct code during document.querySelector. Normally this was due to miss out a dot(.) when selecting the class.

Also please take advice from @Pocky1559 to check on the orderSummaryTest.js as well.

Copy link

@GiftinTech GiftinTech Apr 18, 2025

Choose a reason for hiding this comment

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

Instead of the original solution:

expect(cart[0].productId).toEqual(productId1);
expect(cart[0].deliveryOptionId).toEqual('3');,

I wrote this:

expect(productId1 && deliveryOptionId).toEqual(1 && '3');

It worked and looks pretty clean and readable in one line.

NB: I made deliveryOptionId = deliveryOptions[2].id;

@@ -77,4 +77,23 @@ describe('test suite: renderOrderSummary', () => {
expect(cart.length).toEqual(1);
expect(cart[0].productId).toEqual(productId2);
});

it('updates the delivery option', () => {
document.querySelector(`.js-delivery-option-${productId1}-3`).click();
Copy link

@FarhaanAli05 FarhaanAli05 Jun 7, 2025

Choose a reason for hiding this comment

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

For 16j, the click() function does not seem to select the third option, and so, (...).checked).toEqual(true) does not work: "Expected false to equal true."

For now, I set the deliveryOptionId of the first product to '3' in the localStorage.getItem mock.

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.

8 participants