OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/spec/features/work_packages/table/milestones_spec.rb

62 lines
1.7 KiB

require 'spec_helper'
describe 'Inline editing milestones', js: true do
let(:user) { FactoryBot.create :admin }
let(:type) { FactoryBot.create :type, is_milestone: true }
let(:project) { FactoryBot.create(:project, types: [type]) }
let!(:work_package) do
FactoryBot.create(:work_package,
project: project,
type: type,
subject: 'Foobar')
end
let!(:wp_table) { Pages::WorkPackagesTable.new(project) }
let!(:query) do
query = FactoryBot.build(:query, user: user, project: project)
query.column_names = %w(subject start_date due_date)
query.filters.clear
query.show_hierarchies = false
query.save!
query
end
before do
login_as(user)
wp_table.visit_query query
wp_table.expect_work_package_listed work_package
end
it 'mapping for start and finish date in the table (regression #26044)' do
start_date = wp_table.edit_field(work_package, :startDate)
due_date = wp_table.edit_field(work_package, :dueDate)
# Open start date
start_date.activate!
start_date.expect_active!
[32880] Display scheduling mode in work package view (full, split & table) (#8410) * Show icon next to start date depending on the scheduling mode * Show modal when opening date edit fields which shall be able to change the dates and the scheduling mode * Introduce flatpickr as a datepicker for the modal of the dateEditField * Use new datepicker within opDatePickerComponent * Reuse existing Datepicker class for better code abstraction * Set dates only when Instance is ready * Let augmentedDatePicker use generic DatePicker class, too. * Remove jQuery UI datepicker specific styles as they do not apply any more. * Use localized strings in new datepicker * Close datepicker only on click outside * Allow single and multi selection of dates and save changes * Update schedulingMode button correctly && remove unused method * Show combined field for start and end date within the WP single view * Show normal datepicker for most date fields and the modal with the extended datepicker only for startDate * Add datepicker edit field and component helper * Correctly save start and end date * Show correct default value for dateEditFields && Adapt some tests to new datepicker and combined date field * Fix date editor spec * Fix expecting datepicker for start/due date as milestone * Prevent overflow on body by using modal-portal class && make edit input for combinedDates visible again to show something in a create form * Only output one debounced change event for op datepicker * Show combined datepickerModal for dueDate in table, too && save correct scheduling value * Hide modal if the showing component gets destroyed * Correctly check for closed datepicker * Add spec for toggling scheduling mode * Fix setting dates to modal * Avoid too many (unnecessary) close events and use keydown instead * Fix date setting and add custom field date spec * Change layout of combined date picker modal * Switch from a range date picker to a multiple selection in order to be able to set only start or due date && Highlight date field that is changed next * Highlight range manually * Highlight dueDate initially when the user clicked on the due date field && handle special case that one of the values is not set yet. In this case we don't want to keep both values but only the newly clicked. * Move helper functions to own class && Improve the range selection to be able highlight ranges over multiple months && Prevent that a start date > due date can be chosen by setting minDate and maxDate * Adapt test to new way of changing the scheduling mode * Handle case that the user clicks on a already selected date and thus deselects it Co-authored-by: Oliver Günther <mail@oliverguenther.de>
4 years ago
# Open second date, closes first
due_date.activate!
due_date.expect_active!
# Close with escape
due_date.cancel_by_escape
start_date.expect_inactive!
due_date.expect_inactive!
start_date.update '2017-08-07'
start_date.expect_inactive!
start_date.expect_state_text '08/07/2017'
due_date.expect_state_text '08/07/2017'
work_package.reload
expect work_package.milestone?
expect(work_package.start_date.iso8601).to eq('2017-08-07')
expect(work_package.due_date.iso8601).to eq('2017-08-07')
end
end