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
Docs Content Update #233
Docs Content Update #233
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.
This looks real good. I haven't done a full grammar check, but so far just that one things in your test.
const quantity = 2; | ||
|
||
const variant = singleProductFixture.product_listing.variants[1]; | ||
|
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.
This doesn't ensure an update was made. You should validate that line items is empty to start.
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.
There will definitely be grammar mistakes 😬
Hmmm.. Ok. I'll take a look at the code for this test. This test was actually from master
. I just literally just copied and pasted it to ensure the old naming of the function still worked and so did the new. (running the same tests with both functions)
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.
@minasmart what I did instead was to get the initial quantity if a line item exists. Then add that to the quantity.
It just didn't feel right to test if it exists first.
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.
Oh, I wasn't suggesting to test if it exists. I just meant that we should assert the transition, so test that our assumptions about initial state are valid, so that we can ensure that a change has occurred
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.
So is it good now? If we take the initial quantity and ensure it has increased it should be good.
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.
Just a couple things. Otherwise, looks great!
@@ -73,20 +73,57 @@ test('it proxies sub total from the underlying cart', function (assert) { | |||
assert.equal(model.subtotal, cartFixture.cart.subtotal_price); | |||
}); | |||
|
|||
test('it creates a line item when you add a variant', function (assert) { | |||
test('it deprecates addVariants to createLineItemsFromVariants', function (assert) { |
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.
Honestly, instead of duplicating the test, I would stub createLineItemsFromVariants
and test that it's called by the deprecated method. Right now, this doesn't test that. It just tests that they have similar functionality (assuming the test bodies are the same).
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.
How would you go about testing that addVariants
calls createLineItemsFromVariants
?
My thought was for the end user it doesn't really matter as long as the functionality is the same.
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.
How were you thinking of testing this @minasmart?
|
||
// fetch a product using resource id | ||
shopClient.fetchAllProducts() | ||
.then(function (products) { |
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 the time being, I would match the style that's in the rest of the project:
doTheThing().then(() => {
// ...
}).then(() => {
// ...
});
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.
Will do... I actually prefer that style vs whats in shopify/javascript
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.
return items.find(function(docClass) { | ||
return docClass.name === key; | ||
}); | ||
}) |
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.
Same here (match style)
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.
Hey assuming in this case it's not adding a space after function
anything else. Linting is totally broken on this file since it's es5.
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.
e818dc3
to
a0d9c3e
Compare
@yomexzo any updates on getting master functional to build and serve docs? |
…tly use the config and this is all documented in src/shopify.js
… Mina deprecated addVariants in favour of a new function called createLineItemsFromVariants which is more inline with naming conventions of other functions within this class
…odel which didn't exist before
…ts were actually added
@minasmart @jamesmacaulay I'd say this PR is ready to go. If you want to review the docs do:
I think maybe the only thing that might be nice to add documentation to is:
There should be an example explaining what Or is this something we just remove from docs because it's "complex". @minasmart could you add in the docs for this section if you feel it's important to keep? |
@minasmart I added a note about sorting order to I documented |
This pull request does the following:
"1234"
for idsWould love if @minasmart @tessalt @yomexzo you could take a look. Unfortunately right now you cannot run
npm run doc:build
currently so to preview the docs inyuidoc
just run:I don't think this PR should be merged in until we can preview the actual docs but I figured I'd put this out there.