From 1efcb9d89f1c30d1d811e912ec076c87c59dcb34 Mon Sep 17 00:00:00 2001 From: Billy Zhou Date: Sun, 16 Sep 2018 01:45:06 +0800 Subject: [PATCH] Fixed issue #2235 - Overview setting isn't applied on submit (fixes #2235) --- .../javascripts/app/models/overview.coffee | 2 +- test/browser/admin_overview_test.rb | 55 +++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/app/models/overview.coffee b/app/assets/javascripts/app/models/overview.coffee index 4834b94bf..ed109c5f2 100644 --- a/app/assets/javascripts/app/models/overview.coffee +++ b/app/assets/javascripts/app/models/overview.coffee @@ -1,5 +1,5 @@ class App.Overview extends App.Model - @configure 'Overview', 'name', 'prio', 'condition', 'order', 'group_by', 'group_direction', 'view', 'user_ids', 'organization_shared', 'role_ids', 'active' + @configure 'Overview', 'name', 'prio', 'condition', 'order', 'group_by', 'group_direction', 'view', 'user_ids', 'organization_shared', 'out_of_office', 'role_ids', 'active' @extend Spine.Model.Ajax @url: @apiPath + '/overviews' @configure_attributes = [ diff --git a/test/browser/admin_overview_test.rb b/test/browser/admin_overview_test.rb index a6bbae3f0..68de128fe 100644 --- a/test/browser/admin_overview_test.rb +++ b/test/browser/admin_overview_test.rb @@ -125,4 +125,59 @@ class AdminOverviewTest < TestCase get_location( css: "td[title='#{title}']").y] end.sort_by { |x| x[1] }.map { |x| x[0] } end + + # verify fix for issue #2235 - Overview setting isn't applied on submit + def test_overview_toggle_out_of_office_setting + @browser = browser_instance + login( + username: 'master@example.com', + password: 'test', + url: browser_url, + ) + tasks_close_all() + + out_of_office_css = '.content.active .modal select[name="out_of_office"]' + first_overview_css = '.content.active tr[data-id="1"] td' + + click( css: 'a[href="#manage"]' ) + click( css: '.content.active a[href="#manage/overviews"]' ) + + # round 1, open the overview and set out_of_office to true + click( css: first_overview_css ) + modal_ready + watch_for( + css: out_of_office_css, + value: 'no', + ) + select( + css: out_of_office_css, + value: 'yes', + ) + click( css: '.content.active .modal .js-submit' ) + modal_disappear + + # round 2, open the overview and set out_of_office back to false + click( css: first_overview_css ) + modal_ready + watch_for( + css: out_of_office_css, + value: 'yes', + ) + select( + css: out_of_office_css, + value: 'no', + ) + click( css: '.content.active .modal .js-submit' ) + modal_disappear + + # round 3, open the overview and confirm that it's still false + click( css: first_overview_css ) + modal_ready + watch_for( + css: out_of_office_css, + value: 'no', + ) + click( css: '.content.active .modal .js-submit' ) + modal_disappear + end end