summaryrefslogtreecommitdiff
path: root/spec/helpers
diff options
context:
space:
mode:
authorJacob Schatz <jschatz@gitlab.com>2016-08-05 16:22:01 +0000
committerJacob Schatz <jschatz@gitlab.com>2016-08-05 16:22:01 +0000
commit3e687315e0c42ad24ca2ced832dd2121876625b7 (patch)
tree808ef20144d7bcbe8b9fe5ec1d3408764fe90ead /spec/helpers
parentb29ec1937a0d5765a7d5c1b1a4784c637d75c9cf (diff)
parent9955dc29a863ad997efe2926875c29f963ba94d4 (diff)
downloadgitlab-ce-3e687315e0c42ad24ca2ced832dd2121876625b7.tar.gz
Merge branch '19752-pipelines-finished-at' into 'master'
Update timeago to shorter representation ## What does this MR do? Shortens representation of `Finished at` block in pipelines & builds ## What are the relevant issue numbers? Closes #19752 Part of https://gitlab.com/gitlab-org/gitlab-ce/issues/18920 ## Screenshots (if relevant) ![Screen_Shot_2016-07-14_at_8.54.44_AM](/uploads/85000549c49165d4481422eac5eb0ca9/Screen_Shot_2016-07-14_at_8.54.44_AM.png) See merge request !5225
Diffstat (limited to 'spec/helpers')
-rw-r--r--spec/helpers/application_helper_spec.rb17
1 files changed, 15 insertions, 2 deletions
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb
index bb28866f010..3e15a137e33 100644
--- a/spec/helpers/application_helper_spec.rb
+++ b/spec/helpers/application_helper_spec.rb
@@ -218,12 +218,12 @@ describe ApplicationHelper do
end
it 'includes a default js-timeago class' do
- expect(element.attr('class')).to eq 'time_ago js-timeago js-timeago-pending'
+ expect(element.attr('class')).to eq 'js-timeago js-timeago-pending'
end
it 'accepts a custom html_class' do
expect(element(html_class: 'custom_class').attr('class')).
- to eq 'custom_class js-timeago js-timeago-pending'
+ to eq 'js-timeago custom_class js-timeago-pending'
end
it 'accepts a custom tooltip placement' do
@@ -244,6 +244,19 @@ describe ApplicationHelper do
it 'converts to Time' do
expect { helper.time_ago_with_tooltip(Date.today) }.not_to raise_error
end
+
+ it 'add class for the short format and includes inline script' do
+ timeago_element = element(short_format: 'short')
+ expect(timeago_element.attr('class')).to eq 'js-short-timeago js-timeago-pending'
+ script_element = timeago_element.next_element
+ expect(script_element.name).to eq 'script'
+ end
+
+ it 'add class for the short format and does not include inline script' do
+ timeago_element = element(short_format: 'short', skip_js: true)
+ expect(timeago_element.attr('class')).to eq 'js-short-timeago'
+ expect(timeago_element.next_element).to eq nil
+ end
end
describe 'render_markup' do