Sha256: 34d53ccf4c06c5fff009760efa09dd66d29e1289604b7d01f597a1a54bcba727

Contents?: true

Size: 1.43 KB

Versions: 25

Compression:

Stored size: 1.43 KB

Contents

require 'spec_helper'

describe Uia::Patterns::Selection do
  let(:main) { Uia.find_element id: 'MainFormWindow' }
  Given(:select_list) { main.find(id: 'FruitListBox').as :selection }
  Given(:combo_box) { main.find(id: 'FruitsComboBox').as :selection }

  context 'properties' do
    context '#multi_select?' do
      Then { expect(select_list).to_not be_multi_select }
    end

    context '#selection_required?' do
      Then { expect(select_list).to_not be_selection_required }
    end

    context '#selection_items' do
      let(:respond_to_selections) { lambda { |e| e.respond_to? :add_to_selection } }

      Then { combo_box.selection_items.map(&:name) == ['Apple', 'Caimito', 'Coconut', 'Orange', 'Passion Fruit'] }
      Then { select_list.selection_items.all?(&respond_to_selections) == true }

      context 'multiple levels of #selection_items' do
        Given(:tree_view) { main.find(id: 'treeView').as :selection }

        When { tree_view.selection_items.first.as(:expand_collapse).expand }
        Then { tree_view.selection_items.map(&:name) == ['Parent One', 'Child 1', 'Child 2', 'Parent Two'] }
      end
    end

    context '#selected_items' do
      When do
        main.find(name: 'Toggle Multi-Select').click
        select_list.selection_items.each &:add_to_selection
      end
      Then { expect(select_list.selected_items.map(&:name)).to eq ['Apple', 'Orange', 'Mango'] }
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
uia-0.8 spec/uia/patterns/selection_spec.rb
uia-0.7 spec/uia/patterns/selection_spec.rb
uia-0.7.alpha.1 spec/uia/patterns/selection_spec.rb
uia-0.6 spec/uia/patterns/selection_spec.rb
uia-0.5 spec/uia/patterns/selection_spec.rb
uia-0.4.4 spec/uia/patterns/selection_spec.rb
uia-0.4.3 spec/uia/patterns/selection_spec.rb
uia-0.4.2 spec/uia/patterns/selection_spec.rb
uia-0.4.1 spec/uia/patterns/selection_spec.rb
uia-0.4 spec/uia/patterns/selection_spec.rb
uia-0.3.3 spec/uia/patterns/selection_spec.rb
uia-0.3.2 spec/uia/patterns/selection_spec.rb
uia-0.3.1 spec/uia/patterns/selection_spec.rb
uia-0.3 spec/uia/patterns/selection_spec.rb
uia-0.2.1 spec/uia/patterns/selection_spec.rb
uia-0.2 spec/uia/patterns/selection_spec.rb
uia-0.1.3.1 spec/uia/patterns/selection_spec.rb
uia-0.1.3 spec/uia/patterns/selection_spec.rb
uia-0.1.2.3 spec/uia/patterns/selection_spec.rb
uia-0.1.2.2 spec/uia/patterns/selection_spec.rb