Skip to content

Fix various classname issues#83

Merged
Sinetheta merged 8 commits intomasterfrom
fix-dropdown-classes
Mar 9, 2026
Merged

Fix various classname issues#83
Sinetheta merged 8 commits intomasterfrom
fix-dropdown-classes

Conversation

@Sinetheta
Copy link
Member

@Sinetheta Sinetheta commented Mar 9, 2026

Description

This PR introduces necessary bug fixes for a few shortcode rendering issues and establishes a robust, local release process using release-it to prepare the plugin for a new patch version.

Bug Fixes

  • Dropdown Classes: Fixed an issue where the bs_dropdown shortcode was outputting duplicate class attributes, resulting in invalid HTML markup.
  • Button Classes: Fixed an issue where bs_button could output duplicate classes.
  • Well Classes: Fixed the default bs_well shortcode outputting an unintended well-unknown class by default.

Release Tooling & DX Improvements

  • release-it Integration: Added release-it for interactive, local changelog generation and version management.
  • Automated WordPress Metadata Bumps: Configured automated hooks in .release-it.json to bump the Version in bootstrap-shortcodes.php and the Stable tag in readme.txt natively when a patch/minor/major version is cut.
  • Disabled CI Auto-Deployment: Disabled the GitHub Actions auto-deploy workflow (.github/workflows/deploy.yml.disabled) in favor of manual, locally-confirmed releases to ensure better quality control and review before releasing to the SVN repository.

How to Test

  1. Check out this branch locally.
  2. Run npm install to ensure release-it is available.
  3. Test the fixed shortcodes ([bs_dropdown], [bs_button], [bs_well]) to ensure the correct HTML is output without any duplicate or unknown classes.
  4. Verify the new release script by running a dry-run: npm run release -- --dry-run to see the proposed version bumps and changelog.

Merged the user-provided class and 'dropdown-toggle' class into a single
class attribute on the anchor tag generated by the bs_dropdown shortcode.
Updated related PHPUnit tests to assert the valid HTML structure.

Possible side effects:
- Any custom JavaScript parsing the raw HTML output of this shortcode and
  expecting a specific invalid structure (two class attributes) will need
  to be updated.
- CSS selectors targeting the 'dropdown-toggle' class will now correctly
  apply alongside any custom classes provided by the user.
Changed the bs_well shortcode default size from 'unknown' to an empty string.
When no size parameter is provided, the shortcode now correctly generates
a single 'well' class instead of 'well well-unknown'. Updated the
PHPUnit tests to reflect this correct markup structure.

Possible side effects:
- Any custom CSS logic incorrectly targeting the non-standard
  'well-unknown' class will stop working. CSS targeting the base
  'well' class will continue functioning as expected.
- Any manual script parsing evaluating the default markup for
  'well-unknown' must be updated.
Changed the default size in bs_button to an empty string to avoid emitting
identical generic classes (e.g. 'btn-default btn-default'). Added logic to
only append a size class if it's explicitly non-empty and differs from the
type parameter. Updated the matching PHPUnit test assertion.

Possible side effects:
- Any custom tools or visual parsing strictly depending on multiple
  instances of the 'btn-default' class to be present simultaneously in the
  same element will need to be updated.
@coderabbitai
Copy link

coderabbitai bot commented Mar 9, 2026

Warning

Rate limit exceeded

@Sinetheta has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 6 minutes and 0 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 32480b73-9140-46be-9d6b-3aad129ff560

📥 Commits

Reviewing files that changed from the base of the PR and between 81cd264 and 1ca5a9e.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (4)
  • CHANGELOG.md
  • bootstrap-shortcodes.php
  • package.json
  • readme.txt

Walkthrough

Adds release automation (.release-it.json and package.json updates) and bumps version to 3.4.3. Refactors shortcode defaults and class-construction logic in button, tab, and well shortcodes. Updates unit tests, changelog, plugin/readme stable tags, and CodeRabbit settings accordingly.

Changes

Cohort / File(s) Summary
Release tooling & metadata
.release-it.json, package.json, CHANGELOG.md
Adds release-it configuration (conventional changelog preset, post-bump hooks), adds release script and devDependencies (release-it, @release-it/conventional-changelog), and documents changelog for 3.4.3.
Plugin metadata
bootstrap-shortcodes.php, readme.txt
Bumped plugin version / Stable tag from 3.4.2 → 3.4.3 in header and readme.
Shortcode implementations
inc/bs_buttons.php, inc/bs_tabs.php, inc/bs_well.php
Changed default size parameters from placeholder strings to empty strings; compute and append size/class modifiers conditionally; consolidated class attribute assembly to avoid duplicates.
Tests
tests/phpunit/ShortcodeButtonsTest.php, tests/phpunit/ShortcodeTabsTest.php, tests/phpunit/ShortcodeWellsTest.php
Updated expected HTML assertions to reflect new class output (removed duplicate btn-default, unified class attribute assertions, removed well-unknown for default).
Tooling config
.coderabbit.yaml
Toggled high_level_summary and poem flags (changed values).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix various classname issues' accurately summarizes the main bug fixes (dropdown, button, and well class issues) which are the primary focus of this PR.
Description check ✅ Passed The description is comprehensive and directly related to the changeset, covering both bug fixes and release tooling improvements with clear explanations and testing instructions.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-dropdown-classes

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
readme.txt (1)

6-6: Consider adding a changelog entry for version 3.4.3.

The version has been bumped but there's no corresponding changelog entry documenting the bug fixes (duplicate class attributes in bs_dropdown, bs_button, bs_well). Users reviewing the changelog won't see what changed in this release.

📝 Suggested changelog addition
 == Changelog ==
 
+= 3.4.3 =
+* Fixed duplicate class attributes in dropdown, button, and well shortcodes
+
 = 3.4.2 =
 * Fix remaining XSS vulnerabilities (e.g. tooltip title escaping)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@readme.txt` at line 6, Add a changelog entry for version 3.4.3 that documents
the bug fixes addressing duplicate class attributes in bs_dropdown, bs_button,
and bs_well; update the project's changelog file with a short header "3.4.3" (or
matching the project's entry format) and list the fixes (e.g. "Fix duplicate
class attributes in bs_dropdown, bs_button, bs_well") so users can see what
changed in this release.
tests/phpunit/ShortcodeTabsTest.php (1)

30-30: Avoid coupling this test to HTML attribute order.

Line 30 verifies the merged classes, but the exact string also requires a specific serialization order for class, id, and data-toggle. Prefer asserting the anchor’s attributes separately, or with an order-independent pattern, so the test stays focused on the single-class regression.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/phpunit/ShortcodeTabsTest.php` at line 30, The test ShortcodeTabsTest
currently asserts the full anchor HTML string (in the assertStringContainsString
call comparing to $output), which couples the test to attribute ordering; change
the test to assert the class merge independently and check other attributes
separately — e.g., use an order-independent check such as
assertStringContainsString for the class fragment (e.g., 'class="my-drop
dropdown-toggle"') and either assertStringContainsString for id and data-toggle
fragments or parse $output with DOMDocument/XPath and assert the <a> element has
the expected class list and attributes; update the assertion that currently
references the exact anchor string so it only verifies class merging and
separately verifies id and data-toggle presence.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@readme.txt`:
- Line 6: Add a changelog entry for version 3.4.3 that documents the bug fixes
addressing duplicate class attributes in bs_dropdown, bs_button, and bs_well;
update the project's changelog file with a short header "3.4.3" (or matching the
project's entry format) and list the fixes (e.g. "Fix duplicate class attributes
in bs_dropdown, bs_button, bs_well") so users can see what changed in this
release.

In `@tests/phpunit/ShortcodeTabsTest.php`:
- Line 30: The test ShortcodeTabsTest currently asserts the full anchor HTML
string (in the assertStringContainsString call comparing to $output), which
couples the test to attribute ordering; change the test to assert the class
merge independently and check other attributes separately — e.g., use an
order-independent check such as assertStringContainsString for the class
fragment (e.g., 'class="my-drop dropdown-toggle"') and either
assertStringContainsString for id and data-toggle fragments or parse $output
with DOMDocument/XPath and assert the <a> element has the expected class list
and attributes; update the assertion that currently references the exact anchor
string so it only verifies class merging and separately verifies id and
data-toggle presence.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ad12b323-54c0-4b9a-8a63-32fc665799c3

📥 Commits

Reviewing files that changed from the base of the PR and between c09566b and 26008e5.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (11)
  • .github/workflows/deploy.yml.disabled
  • .release-it.json
  • bootstrap-shortcodes.php
  • inc/bs_buttons.php
  • inc/bs_tabs.php
  • inc/bs_well.php
  • package.json
  • readme.txt
  • tests/phpunit/ShortcodeButtonsTest.php
  • tests/phpunit/ShortcodeTabsTest.php
  • tests/phpunit/ShortcodeWellsTest.php

@Sinetheta Sinetheta force-pushed the fix-dropdown-classes branch from b6b5769 to 1923d7e Compare March 9, 2026 02:42
Updated the assertion in test_dropdown_item to check for HTML attributes
(class, id, data-toggle) separately using multiple assertStringContainsString
calls. This avoids coupling the test strictly to the exact ordering of strings
generated by an anchor tag, making the test suite less brittle when markup
generation mechanisms change.
@Sinetheta Sinetheta force-pushed the fix-dropdown-classes branch from 81cd264 to 2af9c34 Compare March 9, 2026 02:53
@Sinetheta Sinetheta merged commit b754c37 into master Mar 9, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant