diff options
author | Jacob Schatz <jschatz@gitlab.com> | 2016-06-09 23:39:29 +0300 |
---|---|---|
committer | Jacob Schatz <jschatz@gitlab.com> | 2016-06-09 23:39:29 +0300 |
commit | 2cb4cb2ee3bc2d34eb1c24f7643e7cfae84e4d17 (patch) | |
tree | e60bd4c5800d48d22efaf97f03c3ea6b8d62143c /spec | |
parent | c05604a6c26651fde909a3e3d9ab59cbf4191056 (diff) | |
parent | 541e663c125f322cdbb680a9081f2e8470d9ef4e (diff) |
Merge branch 'issue_17607' into 'master'
Fix local timeago on user dashboard
## What does this MR do?
Fixes incorrect date times on tooltips on the dashboard page
## Are there points in the code the reviewer needs to double check?
Yes, The tooltip has to be recreated again because we needed a custom CSS classname in order to fix the date being splitted into two lines.
## Why was this MR needed?
Because the datetimes were incorrect we have to have the same format for .timeago() instances.
## What are the relevant issue numbers?
#17607
## Screenshots (if relevant)
**Before**
<img src="/uploads/f40cd58e8086d9675262e98a1fe57885/Screen_Shot_2016-05-24_at_7.23.25_PM.png" width="705">
**After**
<img src="/uploads/bd48046ef11659cc742f827b3404fbcd/Screen_Shot_2016-05-24_at_7.22.29_PM.png" width="704">
See merge request !4285
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/dashboard/datetime_on_tooltips_spec.rb | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/spec/features/dashboard/datetime_on_tooltips_spec.rb b/spec/features/dashboard/datetime_on_tooltips_spec.rb new file mode 100644 index 00000000000..365cb445df1 --- /dev/null +++ b/spec/features/dashboard/datetime_on_tooltips_spec.rb @@ -0,0 +1,46 @@ +require 'spec_helper' + +feature 'Tooltips on .timeago dates', feature: true, js: true do + include WaitForAjax + + let(:user) { create(:user) } + let(:project) { create(:project, name: 'test', namespace: user.namespace) } + let(:created_date) { Date.yesterday.to_time } + let(:expected_format) { created_date.strftime('%b %-d, %Y %l:%M%P UTC') } + + context 'on the activity tab' do + before do + project.team << [user, :master] + + Event.create( project: project, author_id: user.id, action: Event::JOINED, + updated_at: created_date, created_at: created_date) + + login_as user + visit user_path(user) + wait_for_ajax() + + page.find('.js-timeago').hover + end + + it 'has the datetime formated correctly' do + expect(page).to have_selector('.local-timeago', text: expected_format) + end + end + + context 'on the snippets tab' do + before do + project.team << [user, :master] + create(:snippet, author: user, updated_at: created_date, created_at: created_date) + + login_as user + visit user_snippets_path(user) + wait_for_ajax() + + page.find('.js-timeago').hover + end + + it 'has the datetime formated correctly' do + expect(page).to have_selector('.local-timeago', text: expected_format) + end + end +end |