Repository navigation
Conversation
Co-Authored-By: Clanker
Co-Authored-By: Clanker
There was a problem hiding this comment.
🟡 Changes recommended
The new specs only cover zero seconds, leaving nonzero-second preservation and browser normalization unverified for step="1" and step="any".
1 open issue
What changed in this PR
Adds optional page objects for datetime range filters on ActiveAdmin 4, allowing tests to fill and read ranges without overriding the base page-object gem’s selectors.
Changes:
- Registers a plugin-specific range filter with timezone-aware readers and input-aware formatting.
- Adds feature coverage, including browser interaction, and documents setup and usage.
- Adds the page-object dependency only to the ActiveAdmin 4 test group.
| File | Description |
|---|---|
spec/page_objects_spec.rb |
Tests filter discovery, range operations, and browser interaction. |
README.md |
Documents optional installation, usage, and migration from selector overrides. |
lib/active_admin_datetimepicker/page_objects/date_time_range_filter.rb |
Implements range writing, reading, formatting, and matching. |
lib/active_admin_datetimepicker/page_objects.rb |
Loads the integration and registers dedicated selectors and the filter class. |
Gemfile |
Adds the optional test dependency for ActiveAdmin 4. |
Review effort: Balanced
|
|
||
| def format_of(input) | ||
| case input[:type] | ||
| when 'datetime-local' then seconds?(input) ? "#{LOCAL_FORMAT}:%S" : LOCAL_FORMAT |
Member
Author
There was a problem hiding this comment.
Added in 6306826: browser specs with step="1" and step="any". They check the written value (10:00:15 kept), from/to, have_range, and have_no_range against the minute-only value. The zero-second end is checked with start_with, because the browser may drop :00.
Co-Authored-By: Clanker
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Adds optional page objects for the datetime range filter, built on active_admin_page_objects 2.x. Apps load them with
require "active_admin_datetimepicker/page_objects", so they no longer overridefilter_range_fromandfilter_range_toglobally.Decisions a reviewer can't see in the diff:
DateTimeRangeFilteris registered for this plugin'sdate_time_rangeinputs only, so the base gem's selectors stay untouched.datetime-local(with seconds whenstepis under a minute),date, or the xdsoft text format.require: false, only on ActiveAdmin 4, because 2.x supports ActiveAdmin 4 only. The gemspec is unchanged.Verified:
CI=1 bundle exec rspec specpasses on ActiveAdmin 4.0.0.beta23 (26 examples) and 3.5 (12 examples). WithoutCI, the dummy app doesn't eager-load and the ActiveAdmin 4 filter specs fail, on master too.