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
Add validation to enable Save attributes and Save variations buttons #37046
Add validation to enable Save attributes and Save variations buttons #37046
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## trunk #37046 +/- ##
========================================
Coverage 46.7% 46.7%
+ Complexity 17188 17187 -1
========================================
Files 429 429
Lines 64821 64829 +8
========================================
+ Hits 30251 30276 +25
+ Misses 34570 34553 -17
|
9a2225d
to
b7aa25b
Compare
Test Results SummaryCommit SHA: 7475492
To view the full API test report, click here. To view the full E2E test report, click here. To view all test reports, visit the WooCommerce Test Reports Dashboard. |
var attribute_name = new_attribute_data.find( 'input[name^="attribute_names"]' ).val(); | ||
var attribute_value = new_attribute_data | ||
.find( 'textarea[name^="attribute_values"]' ) | ||
.val(); | ||
|
||
if ( ! attribute_name || ! attribute_value ) { | ||
return; | ||
} |
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.
I removed this validation in this commit because we're already disabling the button and it would duplicate the validation.
I'm not opposed to being more defensive, but I wanted a second opinion.
2dc4aa9
to
23cd959
Compare
@@ -64,6 +64,7 @@ test.describe.serial( 'Add New Variable Product Page', () => { | |||
'val1 | val2' | |||
); | |||
} | |||
await page.keyboard.press( 'ArrowUp' ); |
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 need to call this event because the Playwright method page.fill
is not triggering the keyboard event. I we don't do this the e2e will fail.
I found some bugs, the validation is not keeping track of all actions that can make it change. Some action seems to be making it lose "sync": bug1.movbug2.mov |
# Conflicts: # plugins/woocommerce/includes/admin/meta-boxes/views/html-product-data-variations.php
# Conflicts: # plugins/woocommerce/client/legacy/js/admin/meta-boxes-product-variation.js
# Conflicts: # plugins/woocommerce/includes/admin/meta-boxes/views/html-product-data-variations.php
47e4831
to
932745d
Compare
Nice catch @nathanss! |
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.
Nice job. The issues seem to have been fixed! Approving it.
zen- 6267640, experiencing bug 2 from @nathanss earlier video. |
All Submissions:
Changes proposed in this Pull Request:
This PR disables the
Save attributes
andSave variations
buttons until a value is added in theName
andValue
fields.We want to prevent triggering the action with empty values.
Closes #37021.
How to test the changes in this Pull Request:
Product data
change the product type toVariable product
.Other information:
pnpm --filter=<project> changelog add
?FOR PR REVIEWER ONLY: