Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions spec/features/inputs/date_time_picker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,29 @@ def picker_input
expect(page).to_not have_css(".xdsoft_today_button", count: 1)
end
end

context "with date time formatted on the backend" do
let(:invoice) { Invoice.first_or_create! }

before do
ActiveadminAddons.datetime_picker_input_format = '%m/%d/%Y %I:%M %P'

register_page(Invoice) do
form do |f|
f.input :updated_at, as: :date_time_picker
f.actions
end
end

visit edit_admin_invoice_path(invoice)
end

it "allows frontend library to parse the date time correctly" do
picker_input.click
year_in_datetime_picker = page.find(".xdsoft_datetimepicker .xdsoft_year").text

expect(year_in_datetime_picker).to eq(invoice.updated_at.year.to_s)
end
end
end
end