Skip to content

fix(elements): Simplify attributes in BaseInline class and improve Span element with specific traits and update related tests.#112

Merged
terabytesoftw merged 1 commit into
mainfrom
fix_mini_80
Dec 11, 2025
Merged

fix(elements): Simplify attributes in BaseInline class and improve Span element with specific traits and update related tests.#112
terabytesoftw merged 1 commit into
mainfrom
fix_mini_80

Conversation

@terabytesoftw
Copy link
Copy Markdown
Contributor

@terabytesoftw terabytesoftw commented Dec 10, 2025

Pull Request

Q A
Is bugfix? ✔️
New feature?
Breaks BC?

Summary by CodeRabbit

Release Notes

  • Refactor

    • Simplified BaseInline element by removing support for certain attributes
    • Enhanced Span element with additional attribute support, including content editing, dragging, microdata handling, and tabindex functionality
  • Tests

    • Updated test suite and annotations to reflect attribute support changes

✏️ Tip: You can customize this high-level summary in your review settings.

…`Span` element with specific traits and update related tests.
@terabytesoftw terabytesoftw added the bug Something isn't working label Dec 10, 2025
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Dec 10, 2025

Walkthrough

The changes redistribute trait usage between BaseInline and Span classes. BaseInline removes support for CanBeAutofocus, HasContentEditable, HasDraggable, HasMicroData, HasSpellcheck, and HasTabindex traits. Span now directly implements four of these traits—HasContentEditable, HasDraggable, HasMicroData, and HasTabindex. Tests are updated to reflect trait removal.

Changes

Cohort / File(s) Summary
BaseInline trait simplification
src/element/BaseInline.php
Removed imports and usages of CanBeAutofocus, HasContentEditable, HasDraggable, HasMicroData, HasSpellcheck, and HasTabindex traits; retained CanBeHidden, HasClass, HasData, HasDir, HasId, HasLang, HasStyle, and HasTitle.
Span trait expansion
src/html/phrasing/Span.php
Added trait imports and usages for HasContentEditable, HasDraggable, HasMicroData, and HasTabindex to extend Span's capabilities.
Test updates
tests/html/phrasing/SpanTest.php
Added #[Group('span')] annotation; removed testRenderWithAutofocus() and testRenderWithSpellcheck() test methods.
Documentation
CHANGELOG.md
Added changelog entry documenting simplification of BaseInline attributes and trait enhancements to Span.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Straightforward trait redistribution with no complex logic changes
  • Test removals align directly with trait removal from BaseInline
  • Changes are homogeneous across files (consistent trait move pattern)

Possibly related PRs

Poem

🐰 A rabbit hops through traits with care,
Some go, some stay, some move elsewhere,
BaseInline rests, now light and lean,
While Span receives what traits have been,
Simpler paths for simpler springs! 🌱

Pre-merge checks and finishing touches

❌ 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%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: simplifying attributes in BaseInline, enhancing Span with specific traits, and updating related tests.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix_mini_80

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@terabytesoftw
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Dec 10, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown

@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.

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/html/phrasing/Span.php (1)

7-8: Localizing rich attribute traits onto Span looks good—ensure consistency across inline elements

Wiring HasContentEditable, HasDraggable, HasMicroData, and HasTabindex directly into Span keeps those capabilities after they were removed from BaseInline and matches the existing tests (contentEditable(), draggable(), item*(), tabIndex()).

If other inline elements should expose the same attributes, consider applying these traits (or a shared composite trait) there as well so the inline API surface stays predictable across elements.

Also applies to: 35-38

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 193a6b0 and b5eb199.

📒 Files selected for processing (4)
  • CHANGELOG.md (1 hunks)
  • src/element/BaseInline.php (1 hunks)
  • src/html/phrasing/Span.php (2 hunks)
  • tests/html/phrasing/SpanTest.php (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
src/element/BaseInline.php (1)
src/mixin/HasAttributes.php (1)
  • attributes (57-63)
src/html/phrasing/Span.php (1)
src/mixin/HasAttributes.php (1)
  • attributes (57-63)
🔇 Additional comments (3)
CHANGELOG.md (1)

116-116: Changelog entry is consistent and clear

The Fix #112 line accurately reflects the code changes (BaseInline simplification, Span traits, and tests) and follows the existing changelog style.

tests/html/phrasing/SpanTest.php (1)

44-47: Additional #[Group('span')] improves test targeting; Span tests align with new trait set

Adding the dedicated span group is useful for focused runs and is consistent with the existing html/phrasing groups. The remaining tests exercise the attributes still available on Span (contentEditable, draggable, microdata, tabindex) after the BaseInline simplification; autofocus and spellcheck coverage was correctly removed alongside those APIs.

If Span::tag()->autofocus() or Span::tag()->spellcheck() were ever part of the public surface, consider whether their removal should be called out as a BC note in docs/release notes even if they were deemed incorrect for <span>.

src/element/BaseInline.php (1)

7-8: BaseInline trait reduction is properly scoped—only Span extends it and restores needed traits

The narrowing of BaseInline's trait surface (removing CanBeAutofocus, HasContentEditable, HasDraggable, HasMicroData, HasSpellCheck, HasTabindex) is intentional and safe. Only one production class extends BaseInline: Span, which explicitly restores HasContentEditable, HasDraggable, HasMicroData, and HasTabindex at line 7. Span's tests confirm it uses these restored traits and does not require CanBeAutofocus or HasSpellcheck. The stub test Tag class doesn't rely on any dropped traits. This refactoring is sound—no breaking changes or missed dependencies.

@terabytesoftw terabytesoftw merged commit a6e54b8 into main Dec 11, 2025
43 checks passed
@terabytesoftw terabytesoftw deleted the fix_mini_80 branch December 11, 2025 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant