diff options
author | Annabel Dunstone <annabel.dunstone@gmail.com> | 2016-07-13 01:52:36 +0300 |
---|---|---|
committer | Alfredo Sumaran <alfredo@gitlab.com> | 2016-08-04 23:01:37 +0300 |
commit | 9955dc29a863ad997efe2926875c29f963ba94d4 (patch) | |
tree | 963604be4cd8b73ae9be90d3c705e2555fd897ec /spec/helpers/application_helper_spec.rb | |
parent | 6df51b35d598a3ec553100323c0f0611e1e3d1e1 (diff) |
Update timeago to shorter representation
Diffstat (limited to 'spec/helpers/application_helper_spec.rb')
-rw-r--r-- | spec/helpers/application_helper_spec.rb | 17 |
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 |