simple_navigation_bootstrap 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.rubocop.yml +14 -1136
- data/.travis.yml +7 -2
- data/CHANGELOG.md +7 -0
- data/Gemfile +2 -7
- data/README.md +14 -11
- data/Rakefile +2 -0
- data/lib/simple_navigation_bootstrap.rb +8 -6
- data/lib/simple_navigation_bootstrap/bootstrap2.rb +2 -0
- data/lib/simple_navigation_bootstrap/bootstrap3.rb +2 -0
- data/lib/simple_navigation_bootstrap/bootstrap_base.rb +3 -1
- data/lib/simple_navigation_bootstrap/engine.rb +2 -0
- data/lib/simple_navigation_bootstrap/errors.rb +2 -0
- data/lib/simple_navigation_bootstrap/rendered_item.rb +2 -0
- data/lib/simple_navigation_bootstrap/version.rb +4 -2
- data/simple_navigation_bootstrap.gemspec +7 -7
- data/spec/lib/simple_navigation_bootstrap/bootstrap2_spec.rb +14 -15
- data/spec/lib/simple_navigation_bootstrap/bootstrap3_spec.rb +46 -53
- data/spec/spec_helper.rb +4 -8
- data/vendor/assets/stylesheets/{bootstrap2_dropdown_submenu.css.scss → bootstrap2_dropdown_submenu.scss} +0 -0
- data/vendor/assets/stylesheets/{bootstrap2_navbar_divider_vertical.css.scss → bootstrap2_navbar_divider_vertical.scss} +0 -0
- data/vendor/assets/stylesheets/{simple_navigation_bootstrap.css.scss → simple_navigation_bootstrap.scss} +0 -0
- data/vendor/assets/stylesheets/{simple_navigation_bootstrap_overrides.css.scss → simple_navigation_bootstrap_overrides.scss} +0 -0
- metadata +10 -24
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
## CHANGELOG
|
2
2
|
|
3
|
+
### 1.1.0 - 2018-08-27
|
4
|
+
|
5
|
+
* Add magic comment # frozen_string_literal: true
|
6
|
+
* Coding style
|
7
|
+
* Fix deprecation warning: Extra .css in SCSS file is unnecessary (thanks gltarsa)
|
8
|
+
|
9
|
+
|
3
10
|
### 1.0.1 - 2016-06-24
|
4
11
|
|
5
12
|
* Use \<i\> tag for icons
|
data/Gemfile
CHANGED
@@ -1,14 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
source 'https://rubygems.org'
|
2
4
|
|
3
5
|
# Specify your gem's dependencies in simple_navigation_bootstrap.gemspec
|
4
6
|
gemspec
|
5
7
|
|
6
|
-
# Get master branch of simple-navigation to fix 'undefined class ::Rails::Railtie' error
|
7
|
-
# See: https://github.com/codeplant/simple-navigation/commit/fb2c41511ade34e1ed6857a89ab2c7f1eead3ecb
|
8
|
-
gem 'simple-navigation', git: 'https://github.com/codeplant/simple-navigation.git'
|
9
|
-
|
10
|
-
# README edition
|
11
|
-
gem 'gh-preview'
|
12
|
-
|
13
8
|
# CodeClimate Test Coverage
|
14
9
|
gem 'codeclimate-test-reporter', group: :test, require: nil
|
data/README.md
CHANGED
@@ -2,12 +2,13 @@
|
|
2
2
|
|
3
3
|
[](https://github.com/jbox-web/simple_navigation_bootstrap/blob/master/LICENSE)
|
4
4
|
[](https://github.com/jbox-web/simple_navigation_bootstrap/releases/latest)
|
5
|
+
[](https://rubygems.org/gems/simple_navigation_bootstrap/versions/1.0.1)
|
6
|
+
[](https://rubygems.org/gems/simple_navigation_bootstrap/versions/1.0.1)
|
5
7
|
[](https://travis-ci.org/jbox-web/simple_navigation_bootstrap)
|
6
8
|
[](https://codeclimate.com/github/jbox-web/simple_navigation_bootstrap)
|
7
9
|
[](https://codeclimate.com/github/jbox-web/simple_navigation_bootstrap/coverage)
|
8
|
-
[](https://gemnasium.com/github.com/jbox-web/simple_navigation_bootstrap)
|
9
10
|
|
10
|
-
This gem adds Bootstrap renderers for Simple Navigation. For now, it is include renderers for:
|
11
|
+
This gem adds Bootstrap renderers for [Simple Navigation](https://github.com/codeplant/simple-navigation). For now, it is include renderers for:
|
11
12
|
|
12
13
|
* [Bootstrap 2 navigation](http://getbootstrap.com/2.3.2/components.html#navbar)
|
13
14
|
* [Bootstrap 3 navigation](http://getbootstrap.com/components/#navbar)
|
@@ -15,9 +16,11 @@ This gem adds Bootstrap renderers for Simple Navigation. For now, it is include
|
|
15
16
|
With these renderers you will be able create **any Bootstrap navigation elements**, such as: **submenu**, **navbar-text**, **divider**, **header**.
|
16
17
|
As well as add **icons** to menu elements, such as: Glyphicons, Font Awesome icons, even custom icons. Also you have **split** option for main menu containing submenu.
|
17
18
|
|
18
|
-
*This gem is fork of [ShPakvel/simple\_navigation\_renderers](https://github.com/ShPakvel/simple_navigation_renderers).*
|
19
|
+
*This gem is a fork of [ShPakvel/simple\_navigation\_renderers](https://github.com/ShPakvel/simple_navigation_renderers).*
|
19
20
|
*After a year of waiting for [PR merge](https://github.com/ShPakvel/simple_navigation_renderers/pull/14) without any news from the author, I decided to fork it.*
|
20
21
|
|
22
|
+
**This gem is compatible with SimpleNavigation 4.x.**
|
23
|
+
|
21
24
|
## Installation
|
22
25
|
|
23
26
|
Add this line to your application's Gemfile:
|
@@ -75,7 +78,7 @@ Lets look at the example:
|
|
75
78
|
|
76
79
|
```ruby
|
77
80
|
SimpleNavigation::Configuration.run do |navigation|
|
78
|
-
navigation.renderer =
|
81
|
+
navigation.renderer = SimpleNavigationBootstrap::Bootstrap3
|
79
82
|
|
80
83
|
navigation.items do |primary|
|
81
84
|
primary.item :news, { icon: 'fa fa-fw fa-bullhorn', text: 'News' }, news_index_path
|
@@ -103,13 +106,13 @@ end
|
|
103
106
|
|
104
107
|
Specific options used in the example:
|
105
108
|
|
106
|
-
Option | Description
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
109
|
+
| Option | Description
|
110
|
+
|---------------|--------------
|
111
|
+
|`:split` | Use it to split first level item link with caret. If you add `split: true` option to item, then caret itself will toggle first level submenu and link will have standard behaviour, instead of toggle submenu. You can use `:split` only with first level items, for the rest it will not do anything.
|
112
|
+
|`:navbar_text` | Use it as `navbar_text: true` to add Bootstrap `navbar-text`.
|
113
|
+
|`:divider` | Use it to add Bootstrap menu divider. if you add `divider: true` option to first level item, then it will create li-tag with `divider-vertical` Bootstrap 2 class. (You can add `divider-vertical` class to Bootstrap 3 - see below). For the second level item and deeper it will create `li` tag with class `divider` (which exists in both, Bootstrap 2 and 3).
|
114
|
+
|`:header` | Use it as `header: true` to add Bootstrap menu header. You can use `:header` only with submenus, for the first level items it will not do anything.
|
115
|
+
|`:name hash` | Use it in place of `:name` if you want. Hash can have three keys: `:text`, `:icon` and `:title`, which is only recognized. You can use it together or separately, but at least one of `:text` and `:icon` parameters should be provided.
|
113
116
|
|
114
117
|
Example for `:name hash`:
|
115
118
|
|
data/Rakefile
CHANGED
@@ -1,13 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'forwardable'
|
2
4
|
require 'simple-navigation'
|
3
|
-
require 'simple_navigation_bootstrap/errors'
|
4
|
-
require 'simple_navigation_bootstrap/rendered_item'
|
5
|
-
require 'simple_navigation_bootstrap/bootstrap_base'
|
6
|
-
require 'simple_navigation_bootstrap/bootstrap2'
|
7
|
-
require 'simple_navigation_bootstrap/bootstrap3'
|
8
|
-
require 'simple_navigation_bootstrap/engine' if defined? Rails::Engine
|
9
5
|
|
10
6
|
module SimpleNavigationBootstrap
|
7
|
+
require 'simple_navigation_bootstrap/errors'
|
8
|
+
require 'simple_navigation_bootstrap/rendered_item'
|
9
|
+
require 'simple_navigation_bootstrap/bootstrap_base'
|
10
|
+
require 'simple_navigation_bootstrap/bootstrap2'
|
11
|
+
require 'simple_navigation_bootstrap/bootstrap3'
|
12
|
+
require 'simple_navigation_bootstrap/engine' if defined? Rails::Engine
|
11
13
|
end
|
12
14
|
|
13
15
|
SimpleNavigation.register_renderer(bootstrap2: SimpleNavigationBootstrap::Bootstrap2)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module SimpleNavigationBootstrap
|
2
4
|
module BootstrapBase
|
3
5
|
|
@@ -32,7 +34,7 @@ module SimpleNavigationBootstrap
|
|
32
34
|
|
33
35
|
|
34
36
|
def container_class(level)
|
35
|
-
remove_navigation_class = options.delete(:remove_navigation_class){ false }
|
37
|
+
remove_navigation_class = options.delete(:remove_navigation_class) { false }
|
36
38
|
if level == 1
|
37
39
|
remove_navigation_class ? '' : ['nav', navigation_class].compact
|
38
40
|
else
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module SimpleNavigationBootstrap
|
2
4
|
# Returns the version of the currently loaded Rails as a <tt>Gem::Version</tt>
|
3
5
|
def self.gem_version
|
@@ -6,8 +8,8 @@ module SimpleNavigationBootstrap
|
|
6
8
|
|
7
9
|
module VERSION
|
8
10
|
MAJOR = 1
|
9
|
-
MINOR =
|
10
|
-
TINY =
|
11
|
+
MINOR = 1
|
12
|
+
TINY = 0
|
11
13
|
PRE = nil
|
12
14
|
|
13
15
|
STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
|
@@ -1,5 +1,6 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.push File.expand_path('lib', __dir__)
|
3
4
|
require 'simple_navigation_bootstrap/version'
|
4
5
|
|
5
6
|
Gem::Specification.new do |s|
|
@@ -9,21 +10,20 @@ Gem::Specification.new do |s|
|
|
9
10
|
s.authors = ['Pavel Shpak', 'Nicolas Rodriguez']
|
10
11
|
s.email = ['shpakvel@gmail.com', 'nrodriguez@jbox-web.com']
|
11
12
|
s.homepage = 'https://github.com/jbox-web/simple_navigation_bootstrap'
|
12
|
-
s.summary =
|
13
|
-
s.description =
|
13
|
+
s.summary = 'A Ruby gem that adds Bootstrap renderers for SimpleNavigation'
|
14
|
+
s.description = 'This gem adds Bootstrap2 and Bootstrap3 renderers for SimpleNavigation'
|
14
15
|
s.license = 'MIT'
|
15
16
|
|
16
17
|
s.add_runtime_dependency 'simple-navigation', '~> 4.0'
|
17
18
|
|
18
19
|
s.add_development_dependency 'actionpack'
|
19
20
|
s.add_development_dependency 'actionview'
|
21
|
+
s.add_development_dependency 'rake'
|
20
22
|
s.add_development_dependency 'rspec'
|
21
23
|
s.add_development_dependency 'simplecov'
|
22
|
-
s.add_development_dependency 'bundler', '~> 1.3'
|
23
|
-
s.add_development_dependency 'rake'
|
24
24
|
|
25
25
|
s.files = `git ls-files`.split("\n")
|
26
26
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
27
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
27
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
28
28
|
s.require_paths = ['lib']
|
29
29
|
end
|
@@ -2,52 +2,51 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe SimpleNavigationBootstrap::Bootstrap2 do
|
4
4
|
|
5
|
-
|
5
|
+
let(:bootstrap_menu) { build_menu(version: 2) }
|
6
6
|
|
7
|
+
describe '#render' do
|
7
8
|
it "wraps main menu in ul-tag with 'nav' class" do
|
8
|
-
check_selector
|
9
|
-
check_selector
|
9
|
+
check_selector bootstrap_menu, 'ul.nav.navbar-nav', 0
|
10
|
+
check_selector bootstrap_menu, 'ul.nav'
|
10
11
|
end
|
11
12
|
|
12
|
-
|
13
13
|
context "when ':header' option provided" do
|
14
14
|
context "for the first level item" do
|
15
15
|
it "does not set up 'dropdown-header' or 'nav-header' class on li-tag" do
|
16
|
-
check_selector
|
16
|
+
check_selector bootstrap_menu, 'ul.nav > li.to_check_header.nav-header', 0
|
17
17
|
end
|
18
18
|
|
19
19
|
it "creates link-tag for the item (standard item)" do
|
20
|
-
check_selector
|
20
|
+
check_selector bootstrap_menu, 'ul.nav > li.to_check_header > a'
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
24
|
context "for the second level item and deeper" do
|
25
25
|
it "sets up 'nav-header' class on li-tag" do
|
26
|
-
check_selector
|
26
|
+
check_selector bootstrap_menu, 'ul.dropdown-menu > li.to_check_header2.nav-header'
|
27
27
|
end
|
28
28
|
|
29
29
|
it "does not create link-tag for the item (standard item), but puts only item 'name'" do
|
30
|
-
check_selector
|
31
|
-
check_title
|
30
|
+
check_selector bootstrap_menu, 'ul.dropdown-menu > li.to_check_header2.nav-header > a', 0
|
31
|
+
check_title bootstrap_menu, 'ul.dropdown-menu > li.to_check_header2.nav-header', 'Misc. Pages'
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
|
37
36
|
context "when ':navbar_text' option provided" do
|
38
37
|
it "creates p-tag with class 'navbar-text' and item 'name' as a content instead of link-tag for the item (standard item)" do
|
39
|
-
check_selector
|
40
|
-
check_title
|
38
|
+
check_selector bootstrap_menu, 'ul > li.to_check_navbar_text > a', 0
|
39
|
+
check_title bootstrap_menu, 'ul > li.to_check_navbar_text > p.navbar-text', 'Signed in as Pavel Shpak'
|
41
40
|
end
|
42
41
|
end
|
43
42
|
|
44
|
-
|
45
43
|
context "when container is empty" do
|
44
|
+
let(:bootstrap_menu) { build_menu(version: 2, menu_name: :empty_menu, menu_opts: { skip_if_empty: true }) }
|
45
|
+
|
46
46
|
it 'return empty list' do
|
47
|
-
check_selector
|
47
|
+
check_selector bootstrap_menu, 'ul > li', 0
|
48
48
|
end
|
49
49
|
end
|
50
|
-
|
51
50
|
end
|
52
51
|
|
53
52
|
end
|
@@ -2,183 +2,176 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe SimpleNavigationBootstrap::Bootstrap3 do
|
4
4
|
|
5
|
-
|
5
|
+
let(:bootstrap_menu) { build_menu(version: 3) }
|
6
6
|
|
7
|
+
describe '#render' do
|
7
8
|
it "wraps main menu in ul-tag with 'nav navbar-nav' classes" do
|
8
|
-
check_selector
|
9
|
+
check_selector bootstrap_menu, 'ul.nav.navbar-nav'
|
9
10
|
end
|
10
11
|
|
11
|
-
|
12
12
|
it "sets up 'active' class on selected items (on li-tags)" do
|
13
|
-
check_selector
|
13
|
+
check_selector bootstrap_menu, 'ul.nav.navbar-nav > li.active > a[href="news_index_path"]'
|
14
14
|
end
|
15
15
|
|
16
|
-
|
17
16
|
it "wraps submenu in ul-tag 'dropdown-menu' class" do
|
18
|
-
check_selector
|
17
|
+
check_selector bootstrap_menu, 'ul > li > ul.dropdown-menu > li > ul.dropdown-menu'
|
19
18
|
end
|
20
19
|
|
21
|
-
|
22
20
|
context "for the first level submenu (the second level menu)" do
|
23
21
|
it "sets up 'dropdown' class on li-tag which contains that submenu" do
|
24
|
-
check_selector
|
22
|
+
check_selector bootstrap_menu, 'ul > li.dropdown'
|
25
23
|
end
|
26
24
|
|
27
25
|
it "sets up 'dropdown-toggle' class on link-tag which is used for toggle that submenu" do
|
28
|
-
check_selector
|
26
|
+
check_selector bootstrap_menu, 'ul > li.dropdown > a.dropdown-toggle'
|
29
27
|
end
|
30
28
|
|
31
29
|
it "sets up 'data-toggle' attribute to 'dropdown' on link-tag which is used for toggle that submenu" do
|
32
|
-
check_selector
|
30
|
+
check_selector bootstrap_menu, 'ul > li.dropdown > a[data-toggle=dropdown]'
|
33
31
|
end
|
34
32
|
|
35
33
|
it "sets up 'data-target' attribute to '#' on link-tag which is used for toggle that submenu" do
|
36
|
-
check_selector
|
34
|
+
check_selector bootstrap_menu, 'ul > li.dropdown > a[data-target="#"]'
|
37
35
|
end
|
38
36
|
|
39
37
|
it "sets up 'href' attribute to '#' on link-tag which is used for toggle that submenu" do
|
40
|
-
check_selector
|
38
|
+
check_selector bootstrap_menu, 'ul > li.dropdown > a[href="#"]'
|
41
39
|
end
|
42
40
|
|
43
41
|
it "puts b-tag with 'caret' class in li-tag which contains that submenu" do
|
44
|
-
check_selector
|
42
|
+
check_selector bootstrap_menu, 'ul > li.dropdown > a[href="#"] > b.caret'
|
45
43
|
end
|
46
44
|
end
|
47
45
|
|
48
|
-
|
49
46
|
context "for nested submenu (the third level menu and deeper)" do
|
50
47
|
it "sets up 'dropdown-submenu' class on li-tag which contains that submenu" do
|
51
|
-
check_selector
|
48
|
+
check_selector bootstrap_menu, 'ul > li > ul.dropdown-menu > li.dropdown-submenu'
|
52
49
|
end
|
53
50
|
end
|
54
51
|
|
55
|
-
|
56
52
|
context "when ':split' option provided" do
|
57
53
|
context "for the first level item which contains submenu" do
|
58
54
|
it "splits item on two li-tags (left and right) and right li-tag will contain the first level submenu (second level menu)" do
|
59
|
-
check_selector
|
55
|
+
check_selector bootstrap_menu, 'ul > li.dropdown-split-left + li.dropdown.dropdown-split-right > ul.dropdown-menu'
|
60
56
|
end
|
61
57
|
|
62
58
|
it "sets up 'pull-right' class on ul-tag which is the submenu" do
|
63
|
-
check_selector
|
59
|
+
check_selector bootstrap_menu, 'ul > li > ul.dropdown-menu.pull-right'
|
64
60
|
end
|
65
61
|
end
|
66
62
|
|
67
63
|
context "for the second level item and deeper which contains submenu" do
|
68
64
|
it "does not splits item on two li-tags" do
|
69
|
-
check_selector
|
70
|
-
check_selector
|
65
|
+
check_selector bootstrap_menu, 'ul.dropdown-menu > li.dropdown-split-left + li.dropdown.dropdown-split-right > ul.dropdown-menu', 0
|
66
|
+
check_selector bootstrap_menu, 'ul.dropdown-menu > li.dropdown-submenu > ul.dropdown-menu'
|
71
67
|
end
|
72
68
|
|
73
69
|
it "does not sets up 'pull-right' class on ul-tag which is the submenu" do
|
74
|
-
check_selector
|
70
|
+
check_selector bootstrap_menu, 'ul.dropdown-menu > li > ul.dropdown-menu.pull-right', 0
|
75
71
|
end
|
76
72
|
end
|
77
73
|
|
78
74
|
context "for item which does not contain submenu" do
|
79
75
|
it "does not splits item on two li-tags" do
|
80
|
-
check_selector
|
81
|
-
check_selector
|
76
|
+
check_selector bootstrap_menu, 'ul > li.to_check_split.dropdown-split-left + li.dropdown.dropdown-split-right', 0
|
77
|
+
check_selector bootstrap_menu, 'ul > li.to_check_split'
|
82
78
|
end
|
83
79
|
end
|
84
80
|
end
|
85
81
|
|
86
|
-
|
87
82
|
context "when ':split' option is not provided" do
|
83
|
+
let(:bootstrap_menu) { build_menu(version: 3, menu_name: :unsplited_menu) }
|
84
|
+
|
88
85
|
context "for the first level item which contains submenu" do
|
89
86
|
it "does not splits item on two li-tags (left and right) and right li-tag will contain the first level submenu (second level menu)" do
|
90
|
-
check_selector
|
87
|
+
check_selector bootstrap_menu, 'ul > li.dropdown-split-left + li.dropdown.dropdown-split-right > ul.dropdown-menu', 0
|
91
88
|
end
|
92
89
|
|
93
90
|
it "does not sets up 'pull-right' class on ul-tag which is the submenu" do
|
94
|
-
check_selector
|
91
|
+
check_selector bootstrap_menu, 'ul > li > ul.dropdown-menu.pull-right', 0
|
95
92
|
end
|
96
93
|
end
|
97
94
|
|
98
95
|
context "for the second level item and deeper which contains submenu" do
|
99
96
|
it "does not splits item on two li-tags" do
|
100
|
-
check_selector
|
101
|
-
check_selector
|
97
|
+
check_selector bootstrap_menu, 'ul.dropdown-menu > li.dropdown-split-left + li.dropdown.dropdown-split-right > ul.dropdown-menu', 0
|
98
|
+
check_selector bootstrap_menu, 'ul.dropdown-menu > li.dropdown-submenu > ul.dropdown-menu'
|
102
99
|
end
|
103
100
|
|
104
101
|
it "does not sets up 'pull-right' class on ul-tag which is the submenu" do
|
105
|
-
check_selector
|
102
|
+
check_selector bootstrap_menu, 'ul.dropdown-menu > li > ul.dropdown-menu.pull-right', 0
|
106
103
|
end
|
107
104
|
end
|
108
105
|
|
109
106
|
context "for item which does not contain submenu" do
|
110
107
|
it "does not splits item on two li-tags" do
|
111
|
-
check_selector
|
112
|
-
check_selector
|
108
|
+
check_selector bootstrap_menu, 'ul > li.to_check_split.dropdown-split-left + li.dropdown.dropdown-split-right', 0
|
109
|
+
check_selector bootstrap_menu, 'ul > li.to_check_split'
|
113
110
|
end
|
114
111
|
end
|
115
112
|
end
|
116
113
|
|
117
|
-
|
118
114
|
context "when ':navbar_text' option provided" do
|
119
115
|
it "creates p-tag with class 'navbar-text' and item 'name' as a content instead of link-tag for the item (standard item)" do
|
120
|
-
check_selector
|
121
|
-
check_title
|
116
|
+
check_selector bootstrap_menu, 'ul > li.to_check_navbar_text > a', 0
|
117
|
+
check_title bootstrap_menu, 'ul > li.to_check_navbar_text > p.navbar-text', 'Signed in as Pavel Shpak'
|
122
118
|
end
|
123
119
|
end
|
124
120
|
|
125
|
-
|
126
121
|
context "when ':divider' option provided" do
|
127
122
|
it "does not create link-tag for the item (standard item)" do
|
128
|
-
check_selector
|
129
|
-
check_selector
|
130
|
-
check_selector
|
123
|
+
check_selector bootstrap_menu, 'ul > li.divider-vertical + li > a[href="divider_before_info_index_path"]', 0
|
124
|
+
check_selector bootstrap_menu, 'ul.dropdown-menu > li.divider + li > a[href="divider_before_misc_info_pages"]', 0
|
125
|
+
check_selector bootstrap_menu, 'ul.dropdown-menu > li.divider + li > a[href="divider_before_contact_info_page"]', 0
|
131
126
|
end
|
132
127
|
|
133
128
|
context "for the first level item" do
|
134
129
|
it "adds li-tag with class 'divider-vertical'" do
|
135
|
-
check_selector
|
130
|
+
check_selector bootstrap_menu, 'ul > li.divider-vertical + li > a[href="info_index_path"]'
|
136
131
|
end
|
137
132
|
end
|
138
133
|
|
139
134
|
context "for the second level item and deeper" do
|
140
135
|
it "adds li-tag with class 'divider'" do
|
141
|
-
check_selector
|
142
|
-
check_selector
|
136
|
+
check_selector bootstrap_menu, 'ul.dropdown-menu > li.divider + li > a[href="misc_info_pages"]'
|
137
|
+
check_selector bootstrap_menu, 'ul.dropdown-menu > li.divider + li > a[href="contact_info_page"]'
|
143
138
|
end
|
144
139
|
end
|
145
140
|
end
|
146
141
|
|
147
|
-
|
148
142
|
context "when ':header' option provided" do
|
149
143
|
context "for the first level item" do
|
150
144
|
it "does not set up 'dropdown-header' or 'nav-header' class on li-tag" do
|
151
|
-
check_selector
|
145
|
+
check_selector bootstrap_menu, 'ul.nav.navbar-nav > li.to_check_header.dropdown-header', 0
|
152
146
|
end
|
153
147
|
|
154
148
|
it "creates link-tag for the item (standard item)" do
|
155
|
-
check_selector
|
149
|
+
check_selector bootstrap_menu, 'ul.nav.navbar-nav > li.to_check_header > a'
|
156
150
|
end
|
157
151
|
end
|
158
152
|
|
159
153
|
context "for the second level item and deeper" do
|
160
154
|
it "sets up 'dropdown-header' class on li-tag" do
|
161
|
-
check_selector
|
155
|
+
check_selector bootstrap_menu, 'ul.dropdown-menu > li.to_check_header2.dropdown-header'
|
162
156
|
end
|
163
157
|
|
164
158
|
it "does not create link-tag for the item (standard item), but puts only item 'name'" do
|
165
|
-
check_selector
|
166
|
-
check_title
|
159
|
+
check_selector bootstrap_menu, 'ul.dropdown-menu > li.to_check_header2.dropdown-header > a', 0
|
160
|
+
check_title bootstrap_menu, 'ul.dropdown-menu > li.to_check_header2.dropdown-header', 'Misc. Pages'
|
167
161
|
end
|
168
162
|
end
|
169
163
|
end
|
170
164
|
|
171
|
-
|
172
165
|
context "when 'hash' provided in place of 'name'" do
|
173
166
|
context "with ':icon' parameter" do
|
174
167
|
it "adds i-tag with classes from the parameter" do
|
175
|
-
check_selector
|
168
|
+
check_selector bootstrap_menu, 'ul > li > a > i.fa.fa-fw.fa-bullhorn'
|
176
169
|
end
|
177
170
|
end
|
178
171
|
|
179
172
|
context "with ':title' parameter" do
|
180
173
|
it "sets up 'title' attribute on icon's i-tag to the parameter value" do
|
181
|
-
check_selector
|
174
|
+
check_selector bootstrap_menu, 'ul > li > a > i.fa.fa-fw.fa-book[title="Info"]'
|
182
175
|
end
|
183
176
|
end
|
184
177
|
|
@@ -197,13 +190,13 @@ describe SimpleNavigationBootstrap::Bootstrap3 do
|
|
197
190
|
end
|
198
191
|
end
|
199
192
|
|
200
|
-
|
201
193
|
context "when container is empty" do
|
194
|
+
let(:bootstrap_menu) { build_menu(version: 3, menu_name: :empty_menu, menu_opts: { skip_if_empty: true }) }
|
195
|
+
|
202
196
|
it 'return empty list' do
|
203
|
-
check_selector
|
197
|
+
check_selector bootstrap_menu, 'ul > li', 0
|
204
198
|
end
|
205
199
|
end
|
206
|
-
|
207
200
|
end
|
208
201
|
|
209
202
|
end
|