-
Notifications
You must be signed in to change notification settings - Fork 23k
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
[FIX] web: fix issue with spread operator #166111
[FIX] web: fix issue with spread operator #166111
Conversation
Hello @aab-odoo can you plz review this fix? It targets to correct version with the unit test. |
assert.containsOnce(webClient, ".o_kanban_view"); | ||
|
||
const links = [ | ||
{ label: "test1 <R&D>", url: "#action={action.id}&id={order.id}&model=purchase.order" }, |
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.
Does this url make sense? I don't think it will be evaluated...
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.
@aab-odoo Yes you are right url doesn't make sense, but here the goal is to check is multiple URL
. i think it's doesn't matter the URL action is correct.
As we have did the same for single url test.
url: "#action={action.id}&id={order.id}&model=purchase.order", |
And yes we can pass here dynamic url, but it'll just increse the line of code not very useful here.
`message test1 <R&D>,test2 <R&D>,test3 <R&D> <R&D>`, | ||
"the notification should have the correct message" | ||
); | ||
assert.containsOnce(webClient, ".o_kanban_view"); |
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 assertion is not really useful.
Instead, could you assert the links href?
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.
Done
ced8766
to
28933a9
Compare
"the notification should have the correct message" | ||
); | ||
const notificationLinks = notificationElement.querySelector(".o_notification_content"); | ||
links.forEach((link, index) => { |
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.
we don't really care about the number of lines in tests. In this case, I definitely prefer 3 assert.strictEqual
lines that are easier to read that a forEach (which is also written on 3 lines btw).
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.
@aab-odoo Yeah, The Changes have been made, Thank you for your suggestion
28933a9
to
7c1665d
Compare
Isuue ===== There was a problem with using the spread operator in this function when links contained multiple URLs. For example, const array = ['a', 'b', 'c']. When we use the spread operator for the first time, the result is 'a', 'b', 'c'. However ,when we try to spread it again, it doesn't work properly, it only shows single link inside notification toast Resolution =========== The implementation was updated to correctly handle multiple URLs by removing the spread operator before links.
7c1665d
to
0d68b5d
Compare
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.
robodoo r+
Isuue ===== There was a problem with using the spread operator in this function when links contained multiple URLs. For example, const array = ['a', 'b', 'c']. When we use the spread operator for the first time, the result is 'a', 'b', 'c'. However ,when we try to spread it again, it doesn't work properly, it only shows single link inside notification toast Resolution =========== The implementation was updated to correctly handle multiple URLs by removing the spread operator before links. closes #166111 Signed-off-by: Aaron Bohy (aab) <[email protected]>
Isuue ===== There was a problem with using the spread operator in this function when links contained multiple URLs. For example, const array = ['a', 'b', 'c']. When we use the spread operator for the first time, the result is 'a', 'b', 'c'. However ,when we try to spread it again, it doesn't work properly, it only shows single link inside notification toast Resolution =========== The implementation was updated to correctly handle multiple URLs by removing the spread operator before links. closes odoo#166111 Signed-off-by: Aaron Bohy (aab) <[email protected]>
Isuue
There was a problem with using the spread operator in this function when links contained multiple URLs. For example, const array = ['a', 'b', 'c']. When we use the spread operator for the first time, the result is 'a', 'b', 'c'. However ,when we try to spread it again, it doesn't work properly, it only shows single link inside notification toast
Resolution
The implementation was updated to correctly handle multiple URLs by removing the spread operator before links.