-
Notifications
You must be signed in to change notification settings - Fork 779
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
base: 16j
Are you sure you want to change the base?
16j Solution #74
Conversation
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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-.....
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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}
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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.
No description provided.