debian-mirror-gitlab/spec/lib/sidebars/menu_item_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

32 lines
952 B
Ruby
Raw Permalink Normal View History

2021-06-08 01:23:25 +05:30
# frozen_string_literal: true
2022-10-11 01:57:18 +05:30
require 'fast_spec_helper'
2021-06-08 01:23:25 +05:30
RSpec.describe Sidebars::MenuItem do
let(:title) { 'foo' }
let(:html_options) { {} }
let(:menu_item) { described_class.new(title: title, active_routes: {}, link: '', container_html_options: html_options) }
it 'includes by default aria-label attribute set to the title' do
expect(menu_item.container_html_options).to eq({ aria: { label: title } })
end
context 'when aria-label is overridde during initialization' do
let(:html_options) { { aria: { label: 'bar' } } }
it 'sets the aria-label to the new attribute' do
expect(menu_item.container_html_options).to eq html_options
end
end
2023-07-09 08:55:56 +05:30
describe "#serialize_for_super_sidebar" do
let(:html_options) { { class: 'custom-class' } }
subject { menu_item.serialize_for_super_sidebar }
it 'includes custom CSS classes' do
expect(subject[:link_classes]).to be('custom-class')
end
end
2021-06-08 01:23:25 +05:30
end