Commit 6df5fb10 authored by Jose Vargas's avatar Jose Vargas

Fix group runner sort dropdown

Changelog: fixed
parent 585db4b5
- sorted_by = sort_options_hash[@sort] - sorted_by = sort_options_hash[@sort] || sort_title_created_date
.dropdown.inline.gl-ml-3 .dropdown.inline.gl-ml-3
%button.dropdown-menu-toggle{ type: 'button', data: { toggle: 'dropdown', display: 'static' } } %button.dropdown-menu-toggle{ type: 'button', data: { toggle: 'dropdown', display: 'static' } }
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'groups/runners/sort_dropdown.html.haml' do
describe 'render' do
let_it_be(:sort_options_hash) { { by_title: 'Title' } }
let_it_be(:sort_title_created_date) { 'Created date' }
before do
allow(view).to receive(:sort).and_return('by_title')
end
describe 'when a sort option is not selected' do
it 'renders a default sort option' do
render 'groups/runners/sort_dropdown', sort_options_hash: sort_options_hash, sort_title_created_date: sort_title_created_date
expect(rendered).to have_content 'Created date'
end
end
describe 'when a sort option is selected' do
it 'renders the selected sort option' do
@sort = :by_title
render 'groups/runners/sort_dropdown', sort_options_hash: sort_options_hash, sort_title_created_date: sort_title_created_date
expect(rendered).to have_content 'Title'
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment