Skip to content

Commit

Permalink
Improve spec cases related to search for an option
Browse files Browse the repository at this point in the history
  • Loading branch information
Hirurg103 committed Sep 12, 2018
1 parent feb9ed8 commit c4af314
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
8 changes: 5 additions & 3 deletions spec/select2_v2_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@
expect(page).to have_css '.select2-search-choice', text: 'Buy Milk'
end

it 'should select with search for an option' do
select2 'Buy Milk', css: '#multiple', search: true
end

context 'when searching for an option' do
before { select2 'Buy Milk', css: '#multiple', search: true }

it 'should select an option from search results' do
expect(page).to have_css '.select2-search-choice', text: 'Buy Milk'
end

end

context 'creating a dynamic option' do
Expand Down
12 changes: 7 additions & 5 deletions spec/select2_v3_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,21 @@
expect(page).to have_css '.select2-search-choice', text: 'Buy Milk'
end

it 'should select with search for an option' do
it 'should select an option from select with previously selected values' do
select2 'Buy Milk', css: '#multiple', search: true
select2 'See Malaysia', css: '#multiple', search: true

expect(page).to have_css '.select2-search-choice', text: 'Buy Milk'
end

it 'should select an option from select with previously selected values' do
select2 'Buy Milk', css: '#multiple', search: true
select2 'See Malaysia', css: '#multiple', search: true
end

context 'when searching for an option' do
before { select2 'Buy Milk', css: '#multiple', search: true }

it 'should select an option from search results' do
expect(page).to have_css '.select2-search-choice', text: 'Buy Milk'
end

end

context 'creating a dynamic option' do
Expand Down
8 changes: 5 additions & 3 deletions spec/select2_v4_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,12 @@

end

it 'should select with search for an option' do
select2 'Buy Milk', css: '#multiple', search: true
context 'when searching for an option' do
before { select2 'Buy Milk', css: '#multiple', search: true }

expect(page).to have_css '.select2-selection__choice', text: 'Buy Milk'
it 'should select an option from search results' do
expect(page).to have_css '.select2-selection__choice', text: 'Buy Milk'
end
end

context 'creating a dynamic option' do
Expand Down

0 comments on commit c4af314

Please sign in to comment.