Skip to content

feat(attribute): Add HasImagesrcset trait and imagesrcset() method to manage imagesrcset attribute for HTML elements.#47

Merged
terabytesoftw merged 1 commit into
mainfrom
feature_20
Jan 31, 2026
Merged

feat(attribute): Add HasImagesrcset trait and imagesrcset() method to manage imagesrcset attribute for HTML elements.#47
terabytesoftw merged 1 commit into
mainfrom
feature_20

Conversation

@terabytesoftw
Copy link
Copy Markdown
Contributor

@terabytesoftw terabytesoftw commented Jan 31, 2026

Pull Request

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

Summary by CodeRabbit

  • New Features

    • Added support for the imagesrcset HTML attribute on elements, enabling responsive image source configuration for preload links. The attribute accepts multiple value types including strings, Stringable objects, and enums while maintaining immutability.
  • Tests

    • Added comprehensive test coverage validating attribute storage, rendering behavior, and immutable instance creation.

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

…d to manage `imagesrcset` attribute for HTML elements.
@terabytesoftw terabytesoftw added the enhancement New feature or request label Jan 31, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 31, 2026

📝 Walkthrough

Walkthrough

The PR adds support for the HTML imagesrcset attribute through a new HasImagesrcset trait, introduces an IMAGESRCSET enum case to the Attribute enum, and provides comprehensive unit tests with data providers to verify attribute handling and immutability.

Changes

Cohort / File(s) Summary
Attribute Support
src/HasImagesrcset.php, src/Values/Attribute.php
Introduces the HasImagesrcset trait with an imagesrcset() method for managing the imagesrcset attribute on HTML elements, and adds a corresponding IMAGESRCSET enum case to the Attribute enum.
Test Coverage
tests/HasImagesrcsetTest.php, tests/Support/Provider/ImagesrcsetProvider.php
Adds comprehensive unit tests verifying trait behavior (no attributes when unset, immutability on assignment, correct attribute storage) and a data provider supplying test cases covering empty strings, null values, attribute replacement, and various input formats.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Poem

🐰 With imagesrcset in hand, we preload with care,
New attributes bloom like carrots in the air,
Traits immutable, tests precise,
HTML attributes thrice as nice! 🌟

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding a HasImagesrcset trait and imagesrcset() method to manage the imagesrcset attribute. This directly matches the actual changes across all modified files (trait definition, method implementation, enum addition, tests, and provider).

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

✨ 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 feature_20

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.

@terabytesoftw terabytesoftw merged commit 017326a into main Jan 31, 2026
46 checks passed
@terabytesoftw terabytesoftw deleted the feature_20 branch January 31, 2026 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant