Sha256: f59014286b21ee61a3bccac07a44fdc874ad6209d3d9e883f61a20a4f3a0c3da

Contents?: true

Size: 1.7 KB

Versions: 33

Compression:

Stored size: 1.7 KB

Contents

# frozen_string_literal: true

require 'spec_helper'
module Quby
  describe "quby/v1/table/item_question_select" do
    let(:question) do
      double(key: :v_1,
             description: "",
             title: "Titel!",
             labels: [],
             html_id: "",
             type: :select,
             options: [double(:item_option,
                              key: :a1, description: 'option1', placeholder: false, hidden: true, view_id: '#a1'),
                       double(:item_option,
                              key: :a2, description: 'option2', placeholder: false, hidden: false, view_id: '#a2')],
             input_data: {},
             show_values: :bulk,
             autocomplete: false,
             disabled: false,
             size: nil,
             unit: nil,
             presentation: :vertical,
             row_span: nil,
             extra_data: nil,
             question_group: nil
      )
    end

    it 'does not render options that have hidden: true' do
      @answer = double(:answer, v_1: 'a2')
      render partial: "quby/v1/table/item_question_select",
             locals: {question: question, subquestion: false, disabled: false, os_cycle: 'a',
                      table: double(:table, columns: 2), validations: nil}

      expect(rendered).to_not include("option1")
    end

    it 'does render options that have hidden: true that are checked' do
      @answer = double(:answer, v_1: 'a1')
      render partial: "quby/v1/table/item_question_select",
             locals: {question: question, subquestion: false, disabled: false, os_cycle: 'a',
                      table: double(:table, columns: 2), validations: nil}

      expect(rendered).to include("option1")
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
quby-5.6.5 spec/views/quby/v1/table/_item_question_select_spec.rb
quby-5.6.3 spec/views/quby/v1/table/_item_question_select_spec.rb
quby-5.6.2 spec/views/quby/v1/table/_item_question_select_spec.rb
quby-5.6.1 spec/views/quby/v1/table/_item_question_select_spec.rb
quby-5.6.0 spec/views/quby/v1/table/_item_question_select_spec.rb
quby-5.5.0 spec/views/quby/v1/table/_item_question_select_spec.rb
quby-5.4.0 spec/views/quby/v1/table/_item_question_select_spec.rb
quby-5.3.1 spec/views/quby/v1/table/_item_question_select_spec.rb
quby-5.3.0 spec/views/quby/v1/table/_item_question_select_spec.rb
quby-5.2.0 spec/views/quby/v1/table/_item_question_select_spec.rb
quby-5.1.3 spec/views/quby/v1/table/_item_question_select_spec.rb
quby-5.1.2 spec/views/quby/v1/table/_item_question_select_spec.rb
quby-5.1.1 spec/views/quby/v1/table/_item_question_select_spec.rb
quby-5.1.0 spec/views/quby/v1/table/_item_question_select_spec.rb
quby-5.0.5 spec/views/quby/v1/table/_item_question_select_spec.rb
quby-5.0.4 spec/views/quby/v1/table/_item_question_select_spec.rb
quby-5.0.3 spec/views/quby/v1/table/_item_question_select_spec.rb
quby-5.0.2 spec/views/quby/v1/table/_item_question_select_spec.rb
quby-5.0.1 spec/views/quby/v1/table/_item_question_select_spec.rb
quby-5.0.0 spec/views/quby/v1/table/_item_question_select_spec.rb