diff options
author | David O'Regan <doregan@gitlab.com> | 2021-03-24 20:15:08 +0300 |
---|---|---|
committer | Suzanne Selhorn <sselhorn@gitlab.com> | 2021-03-24 20:15:08 +0300 |
commit | fde9952a8ebb75227d1879b3999203dca672a26f (patch) | |
tree | e73a871e26ba09b25267e1eb58f66ae944e480f4 /spec | |
parent | 89883be9e9cfad350b3959b281583ae8728e4da2 (diff) |
Feat: Update left navigation to allow more levels
Diffstat (limited to 'spec')
-rw-r--r-- | spec/gitlab/navigation/doc_spec.rb | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/spec/gitlab/navigation/doc_spec.rb b/spec/gitlab/navigation/doc_spec.rb index 08581b45..32198ec2 100644 --- a/spec/gitlab/navigation/doc_spec.rb +++ b/spec/gitlab/navigation/doc_spec.rb @@ -10,7 +10,8 @@ describe Gitlab::Navigation::Doc do external_url: external_url, doc_url: url, ee_only: ee_only, - ee_tier: ee_tier + ee_tier: ee_tier, + docs: docs } end @@ -19,6 +20,7 @@ describe Gitlab::Navigation::Doc do let(:url) { 'README.html' } let(:ee_only) { true } let(:ee_tier) { 'GitLab Premium' } + let(:docs) { [{ doc_title: 'Doc Title' }] } describe '#title' do subject { doc.title } @@ -50,9 +52,31 @@ describe Gitlab::Navigation::Doc do it { is_expected.to eq(ee_tier) } end + describe '#has_children?' do + subject { doc.has_children? } + + it { is_expected.to be_truthy } + + context 'when docs are empty' do + let(:docs) { [] } + + it { is_expected.to be_falsey } + end + end + describe '#children' do subject { doc.children } - it { is_expected.to eq([]) } + it 'returns a list of children' do + children = subject + + expect(children.first.title).to eq('Doc Title') + end + + context 'when docs are empty' do + let(:docs) { [] } + + it { is_expected.to eq([]) } + end end end |