diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2017-04-06 21:17:07 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2017-04-07 12:02:59 +0300 |
commit | 6ed59e1263c9d69a48238fa15e4bcce00a83932a (patch) | |
tree | e359c82192b7fe58ac5db3a63ea161e10a31fa88 /spec/features/dashboard | |
parent | 30c8849962f04a69f01a10849105ae549c4e4d26 (diff) |
Hide header counters for issue/mr/todos if zero
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'spec/features/dashboard')
-rw-r--r-- | spec/features/dashboard/issuables_counter_spec.rb | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/spec/features/dashboard/issuables_counter_spec.rb b/spec/features/dashboard/issuables_counter_spec.rb index a1718912fc6..4fca7577e74 100644 --- a/spec/features/dashboard/issuables_counter_spec.rb +++ b/spec/features/dashboard/issuables_counter_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'Navigation bar counter', feature: true, js: true, caching: true do +describe 'Navigation bar counter', feature: true, caching: true do let(:user) { create(:user) } let(:project) { create(:empty_project, namespace: user.namespace) } let(:issue) { create(:issue, project: project) } @@ -13,33 +13,48 @@ describe 'Navigation bar counter', feature: true, js: true, caching: true do end it 'reflects dashboard issues count' do - visit issues_dashboard_path + visit issues_path expect_counters('issues', '1') issue.update(assignee: nil) - visit issues_dashboard_path - expect_counters('issues', '1') + Timecop.travel(3.minutes.from_now) do + visit issues_path + + expect_counters('issues', '0') + end end it 'reflects dashboard merge requests count' do - visit merge_requests_dashboard_path + visit merge_requests_path expect_counters('merge_requests', '1') merge_request.update(assignee: nil) - visit merge_requests_dashboard_path - expect_counters('merge_requests', '1') + Timecop.travel(3.minutes.from_now) do + visit merge_requests_path + + expect_counters('merge_requests', '0') + end + end + + def issues_path + issues_dashboard_path(assignee_id: user.id) + end + + def merge_requests_path + merge_requests_dashboard_path(assignee_id: user.id) end def expect_counters(issuable_type, count) - dashboard_count = find('li.active') - find('.global-dropdown-toggle').click + dashboard_count = find('.nav-links li.active') nav_count = find(".dashboard-shortcuts-#{issuable_type}") + header_count = find(".header-content .#{issuable_type.tr('_', '-')}-count") - expect(nav_count).to have_content(count) expect(dashboard_count).to have_content(count) + expect(nav_count).to have_content(count) + expect(header_count).to have_content(count) end end |