Fix centered submit button bottom margin value with modern dark theme#2195
Conversation
WalkthroughThe pull request introduces a new method Changes
Sequence DiagramsequenceDiagram
participant CSS Generator
participant FrmStylesHelper
participant $submit_margin
CSS Generator->>FrmStylesHelper: get_bottom_value($submit_margin)
FrmStylesHelper-->>CSS Generator: Return bottom margin value
CSS Generator->>CSS Generator: Apply bottom margin value
The sequence diagram illustrates how the Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
classes/helpers/FrmStylesHelper.php(1 hunks)css/_single_theme.css.php(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: PHP 8 tests in WP trunk
- GitHub Check: Run PHP Syntax inspection (8.3)
- GitHub Check: Cypress
🔇 Additional comments (2)
css/_single_theme.css.php (1)
257-257: LGTM! The margin-bottom fix is properly implemented.The change correctly implements the margin extraction logic by using
FrmStylesHelper::get_bottom_value()to get the bottom margin value, which addresses the issue with centered submit buttons in the modern dark theme.classes/helpers/FrmStylesHelper.php (1)
956-965: LGTM! The margin value extraction is well implemented.The implementation correctly handles:
- Empty value validation
- Different margin value formats (1-2 parts vs 3-4 parts)
- Proper string splitting and array access
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
tests/phpunit/styles/test_FrmStylesHelper.php (1)
250-252: Consider adding error case test scenarios.While the happy path cases are well covered, consider adding test cases for potential error scenarios:
- Invalid CSS values (e.g., "invalid")
- Malformed spacing (e.g., "5px 10px")
- Mixed units (e.g., "5px 10em 15% 20vh")
// Additional test cases to consider $expected = array( 'invalid' => '', // Invalid value should return empty '5px 10px' => '5px', // Extra spaces '5px 10em 15% 20vh' => '15%', // Mixed units );
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
tests/phpunit/styles/test_FrmStylesHelper.php(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: PHP 8 tests in WP trunk
- GitHub Check: Cypress
- GitHub Check: PHP 7.4 tests in WP trunk
🔇 Additional comments (3)
tests/phpunit/styles/test_FrmStylesHelper.php (3)
238-241: LGTM! Well-documented test method.The test method is properly documented with the
@coversannotation, clearly indicating which method it's testing.
242-248: Comprehensive test cases covering all margin value formats.The test cases effectively cover:
- Empty string: Edge case
- Single value: Direct value
- Two values: Vertical/horizontal format
- Three values: Top/horizontal/bottom format
- Four values: Top/right/bottom/left format
This aligns well with the PR objective of handling both 2-value and 4-value margin formats.
237-253: Verify test coverage against implementation.Let's verify if all edge cases from the implementation are covered in the test cases.
✅ Verification successful
Test coverage is complete and matches implementation logic
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Find the implementation file and check for edge cases echo "Searching for FrmStylesHelper implementation..." rg -l "class FrmStylesHelper" echo "Checking get_bottom_value implementation..." rg -A 10 "function get_bottom_value" echo "Checking for any TODO/FIXME comments related to margin handling..." rg -i "todo|fixme|hack|xxx" -g "**/*Style*"Length of output: 1373
Crabcyborg
left a comment
There was a problem hiding this comment.
Thanks @AbdiTolesa!
🚀
Fix https://github.com/Strategy11/formidable-pro/issues/5557
Quoting Mike's workaround the issue implemented in this PR: