|
72 | 72 | end |
73 | 73 |
|
74 | 74 | ActiveAdmin.register Internal::TagName, as: 'Tag Name' do |
75 | | - filter :color, as: :searchable_select, ajax: { resource: 'RGB::Color' } |
| 75 | + filter :color, as: :searchable_select, ajax: { resource: RGB::Color } |
76 | 76 | end |
77 | 77 |
|
78 | | - ActiveAdmin::SearchableSelect.inline_ajax_options = true |
79 | 78 | ActiveAdmin.setup {} |
80 | 79 | end |
81 | 80 | end |
82 | 81 |
|
83 | 82 | describe 'index page with searchable select filter' do |
84 | | - let!(:orange) { RGB::Color.create(code: '#eac112', description: 'Orange') } |
85 | | - let(:filters_options) { %w(Any #19bf25 #eac112) } |
86 | | - |
87 | | - let!(:other_records) do |
| 83 | + it 'loads filter input options' do |
| 84 | + RGB::Color.create(code: '#eac112', description: 'Orange') |
88 | 85 | RGB::Color.create(code: '#19bf25', description: 'Green') |
89 | | - Internal::TagName.create(name: 'Important Guest', color: orange) |
90 | | - end |
91 | 86 |
|
92 | | - before { visit '/admin/tag_names' } |
| 87 | + visit '/admin/tag_names' |
93 | 88 |
|
94 | | - it 'should have all created colors in filter' do |
95 | | - expect(page).to have_select :Color, options: filters_options |
96 | | - end |
| 89 | + expand_select_box |
| 90 | + wait_for_ajax |
97 | 91 |
|
98 | | - it 'should have selected option' do |
99 | | - select orange.code, from: :Color |
100 | | - expect(page).to have_select :Color, selected: orange.code |
| 92 | + expect(select_box_items).to eq(%w(#eac112 #19bf25)) |
101 | 93 | end |
102 | 94 | end |
103 | 95 | end |
|
0 commit comments