Sha256: 605d7b626a857d68fbb5899ebd74ea9d65825d8a1752c492e2419f75bd64c0b4

Contents?: true

Size: 1.36 KB

Versions: 30

Compression:

Stored size: 1.36 KB

Contents

require 'spec_helper'

describe 'MultiValueWithHelpInput', type: :input do
  subject { input_for file, field, as: :multi_value_with_help, required: true }
  let(:file) { FileSet.new }

  context "when the field has a translation" do
    let(:field) { :language }
    before do
      allow_any_instance_of(MultiValueWithHelpInput).to receive(:raw_label_text).and_return('Language')
      allow_any_instance_of(MultiValueWithHelpInput).to receive(:translate_from_namespace).and_return('default translation')
      allow_any_instance_of(MultiValueWithHelpInput).to receive(:translate_from_namespace).with(:metadata_help).and_return(
        'The language of the file content.'
      )
    end

    it 'renders help icon' do
      expect(subject).to have_selector('a[data-toggle=popover][data-original-title=Language]')
      expect(subject).to have_selector('a[data-toggle=popover][data-content="The language of the file content."]')
      expect(subject).to have_selector('i.help-icon')
    end
  end

  context "when the field doesn't have a translation" do
    let(:field) { :date_modified }
    it 'renders help icon' do
      expect(subject).to have_selector('a[data-toggle=popover][data-original-title="Date modified"]')
      expect(subject).to have_selector('a[data-toggle=popover][data-content="Date modified"]')
      expect(subject).to have_selector('i.help-icon')
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
curation_concerns-1.0.0.beta4 spec/inputs/multi_value_with_help_input_spec.rb
curation_concerns-1.0.0.beta3 spec/inputs/multi_value_with_help_input_spec.rb
curation_concerns-1.0.0.beta2 spec/inputs/multi_value_with_help_input_spec.rb
curation_concerns-1.0.0.beta1 spec/inputs/multi_value_with_help_input_spec.rb
curation_concerns-0.14.0 spec/inputs/multi_value_with_help_input_spec.rb
curation_concerns-0.14.0.pre4 spec/inputs/multi_value_with_help_input_spec.rb
curation_concerns-0.14.0.pre3 spec/inputs/multi_value_with_help_input_spec.rb
curation_concerns-0.14.0.pre2 spec/inputs/multi_value_with_help_input_spec.rb
curation_concerns-0.14.0.pre1 spec/inputs/multi_value_with_help_input_spec.rb
curation_concerns-0.13.1 spec/inputs/multi_value_with_help_input_spec.rb
curation_concerns-0.13.0 spec/inputs/multi_value_with_help_input_spec.rb
curation_concerns-0.12.0 spec/inputs/multi_value_with_help_input_spec.rb
curation_concerns-0.12.0.pre9 spec/inputs/multi_value_with_help_input_spec.rb
curation_concerns-0.12.0.pre8 spec/inputs/multi_value_with_help_input_spec.rb
curation_concerns-0.12.0.pre7 spec/inputs/multi_value_with_help_input_spec.rb
curation_concerns-0.12.0.pre6 spec/inputs/multi_value_with_help_input_spec.rb
curation_concerns-0.12.0.pre5 spec/inputs/multi_value_with_help_input_spec.rb
curation_concerns-0.12.0.pre4 spec/inputs/multi_value_with_help_input_spec.rb
curation_concerns-0.12.0.pre3 spec/inputs/multi_value_with_help_input_spec.rb
curation_concerns-0.12.0.pre2 spec/inputs/multi_value_with_help_input_spec.rb