Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#60578] Unable to use the date picker for stages #17612

Merged
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion app/forms/projects/life_cycles/form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def base_input_attributes
leading_visual: { icon: :calendar },
datepicker_options: {
inDialog: true,
data: { action: "change->overview--project-life-cycles-form#handleChange" }
data: { action: "change->overview--project-life-cycles-form#previewForm" }
},
wrapper_data_attributes: {
"qa-field-name": qa_field_name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default class ProjectLifeCyclesFormController extends Controller {

declare readonly formTarget:HTMLFormElement;

handleChange(event:Event) {
previewForm(event:Event) {
const target = event.target as HTMLElement;
const previewUrl = this.formTarget.dataset.previewUrl;

Expand All @@ -50,9 +50,6 @@ export default class ProjectLifeCyclesFormController extends Controller {
}

datePickerVisible(element:HTMLElement) {
const nextElement = element.nextElementSibling;
return nextElement
&& nextElement.classList.contains('flatpickr-calendar')
&& nextElement.classList.contains('open');
return element.classList.contains('active');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,13 @@
# Retrying due to a race condition between filling the input vs submitting the form preview.
original_dates = [life_cycle_initiating.start_date, life_cycle_initiating.end_date]
dialog.set_date_for(life_cycle_initiating, value: original_dates)

page.driver.clear_network_traffic
dialog.set_date_for(life_cycle_initiating, value: initiating_dates)

dialog.expect_caption(life_cycle_initiating, text: "Duration: 8 working days")
# Ensure that only 1 ajax request is triggered after setting the date range.
expect(page.driver.browser.network.traffic.size).to eq(1)
end

ready_for_planning_date = start_date + 1.day
Expand Down
Loading