From: Jean-Philippe Lang Date: Sat, 19 Dec 2015 08:14:48 +0000 (+0000) Subject: Merged r14967 to r14969 (#21488). X-Git-Tag: 3.1.4~29 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9619aa98147cbb91c2650bc1eb08f2964a1bddd9;p=redmine.git Merged r14967 to r14969 (#21488). git-svn-id: http://svn.redmine.org/redmine/branches/3.1-stable@14983 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 8d1f8d56a..558235fa6 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -555,7 +555,13 @@ function beforeShowDatePicker(input, inst) { break; case "issue_due_date" : if ($("#issue_start_date").size() > 0) { - default_date = $("#issue_start_date").val(); + var start_date = $("#issue_start_date").val(); + if (start_date != "") { + start_date = new Date(Date.parse(start_date)); + if (start_date > new Date()) { + default_date = $("#issue_start_date").val(); + } + } } break; } diff --git a/test/ui/base.rb b/test/ui/base.rb index f7273e227..dfaa61107 100644 --- a/test/ui/base.rb +++ b/test/ui/base.rb @@ -60,6 +60,11 @@ module Redmine assert_equal '/my/page', current_path end + setup do + # Set the page width higher than 900 to get the full layout with sidebar + page.driver.browser.manage.window.resize_to(1024, 900) + end + teardown do Capybara.reset_sessions! # Forget the (simulated) browser state Capybara.use_default_driver # Revert Capybara.current_driver to Capybara.default_driver diff --git a/test/ui/issues_test_ui.rb b/test/ui/issues_test_ui.rb index 92f4cdd7b..be443575a 100644 --- a/test/ui/issues_test_ui.rb +++ b/test/ui/issues_test_ui.rb @@ -21,7 +21,7 @@ class Redmine::UiTest::IssuesTest < Redmine::UiTest::Base fixtures :projects, :users, :email_addresses, :roles, :members, :member_roles, :trackers, :projects_trackers, :enabled_modules, :issue_statuses, :issues, :enumerations, :custom_fields, :custom_values, :custom_fields_trackers, - :watchers + :watchers, :journals, :journal_details def test_create_issue log_user('jsmith', 'jsmith') @@ -150,15 +150,30 @@ class Redmine::UiTest::IssuesTest < Redmine::UiTest::Base end end - def test_create_issue_start_due_date_default + def test_default_due_date_proposed_in_date_picker log_user('jsmith', 'jsmith') visit '/projects/ecookbook/issues/new' + + # Future start date: due date should default to start date + fill_in 'Start date', :with => '2027-04-01' + fill_in 'Due date', :with => '' + page.first('p#due_date_area img').click + page.first("td.ui-datepicker-days-cell-over a").click + assert_equal '2027-04-01', page.find('input#issue_due_date').value + + # Passed start date: due date should default to today fill_in 'Start date', :with => '2012-04-01' fill_in 'Due date', :with => '' page.first('p#due_date_area img').click page.first("td.ui-datepicker-days-cell-over a").click - assert_equal '2012-04-01', page.find('input#issue_due_date').value + assert_equal Date.today.to_s, page.find('input#issue_due_date').value + end + + def test_default_start_date_proposed_in_date_picker + log_user('jsmith', 'jsmith') + visit '/projects/ecookbook/issues/new' + # Passed due date: start date should default to due date fill_in 'Start date', :with => '' fill_in 'Due date', :with => '2012-04-01' page.first('p#start_date_area img').click