ama_layout 3.2.2 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ama_layout.gemspec +2 -1
- data/app/assets/images/ama-logo-blue.svg +44 -0
- data/app/assets/images/ama-logo.png +0 -0
- data/app/assets/javascripts/ama_layout/desktop/foundation-custom.js +21 -0
- data/app/assets/javascripts/ama_layout/desktop/foundation-equalizer-reflow.coffee +5 -0
- data/app/assets/javascripts/ama_layout/desktop/foundation-ready.coffee +2 -0
- data/app/assets/javascripts/ama_layout/desktop/index.js +2 -8
- data/app/assets/stylesheets/ama_layout/_settings.scss +66 -66
- data/app/assets/stylesheets/ama_layout/application.scss +0 -1
- data/app/assets/stylesheets/ama_layout/foundation_and_overrides.scss +1 -24
- data/app/assets/stylesheets/ama_layout/layout/base-styles.scss +2 -72
- data/app/assets/stylesheets/ama_layout/layout/helper-classes.scss +98 -43
- data/app/assets/stylesheets/ama_layout/layout/index.scss +2 -0
- data/app/assets/stylesheets/ama_layout/layout/mixins-grid.scss +847 -0
- data/app/assets/stylesheets/ama_layout/layout/print.scss +23 -0
- data/app/assets/stylesheets/ama_layout/layout/variables.scss +20 -4
- data/app/assets/stylesheets/ama_layout/layout_components/accordions.scss +32 -14
- data/app/assets/stylesheets/ama_layout/layout_components/banner.scss +17 -0
- data/app/assets/stylesheets/ama_layout/layout_components/blue-boxes.scss +81 -4
- data/app/assets/stylesheets/ama_layout/layout_components/breadcrumbs.scss +10 -0
- data/app/assets/stylesheets/ama_layout/layout_components/button-grouping.scss +111 -0
- data/app/assets/stylesheets/ama_layout/layout_components/buttons.scss +14 -0
- data/app/assets/stylesheets/ama_layout/layout_components/callouts.scss +106 -0
- data/app/assets/stylesheets/ama_layout/layout_components/cart.scss +98 -43
- data/app/assets/stylesheets/ama_layout/layout_components/comparison-radios.scss +113 -0
- data/app/assets/stylesheets/ama_layout/layout_components/content-toggle.scss +15 -0
- data/app/assets/stylesheets/ama_layout/layout_components/error-page.scss +3 -3
- data/app/assets/stylesheets/ama_layout/layout_components/footer.scss +65 -0
- data/app/assets/stylesheets/ama_layout/layout_components/forms.scss +141 -43
- data/app/assets/stylesheets/ama_layout/layout_components/graph.scss +8 -7
- data/app/assets/stylesheets/ama_layout/layout_components/index.scss +13 -1
- data/app/assets/stylesheets/ama_layout/layout_components/link-list.scss +53 -0
- data/app/assets/stylesheets/ama_layout/layout_components/links.scss +8 -0
- data/app/assets/stylesheets/ama_layout/layout_components/notification.scss +27 -1
- data/app/assets/stylesheets/ama_layout/layout_components/progress-bar.scss +137 -0
- data/app/assets/stylesheets/ama_layout/layout_components/reveal-modal.scss +15 -0
- data/app/assets/stylesheets/ama_layout/layout_components/sections.scss +202 -0
- data/app/assets/stylesheets/ama_layout/layout_components/sidebar.scss +45 -119
- data/app/assets/stylesheets/ama_layout/layout_components/siteheader.scss +70 -73
- data/app/assets/stylesheets/ama_layout/layout_components/tab-accordions.scss +1 -19
- data/app/assets/stylesheets/ama_layout/layout_components/tables.scss +96 -0
- data/app/assets/stylesheets/ama_layout/media_queries/mobile-and-tablet.scss +2 -2
- data/app/assets/stylesheets/ama_layout/media_queries/mobile.scss +2 -49
- data/app/assets/stylesheets/ama_layout/media_queries/tablet.scss +2 -10
- data/app/helpers/ama_layout_breadcrumb_helper.rb +5 -0
- data/app/views/ama_layout/_alert.html.erb +4 -2
- data/app/views/ama_layout/_breadcrumbs.html.erb +3 -0
- data/app/views/ama_layout/_footer.html.erb +68 -1
- data/app/views/ama_layout/_main_nav_item.html.erb +2 -3
- data/app/views/ama_layout/_notice.html.erb +2 -2
- data/app/views/ama_layout/_sidebar.html.erb +6 -9
- data/app/views/ama_layout/_siteheader.html.erb +40 -28
- data/app/views/ama_layout/_sub_nav.html.erb +1 -1
- data/app/views/ama_layout/_sub_nav_item.html.erb +2 -2
- data/app/views/ama_layout/_top_nav.html.erb +4 -4
- data/lib/ama_layout.rb +2 -0
- data/lib/ama_layout/breadcrumb_builder.rb +23 -0
- data/lib/ama_layout/decorators/navigation_decorator.rb +10 -2
- data/lib/ama_layout/decorators/navigation_item_decorator.rb +8 -2
- data/lib/ama_layout/moneris/textbox.txt +11 -15
- data/lib/ama_layout/navigation.rb +7 -2
- data/lib/ama_layout/navigation.yml +8 -13
- data/lib/ama_layout/version.rb +1 -1
- data/spec/ama_layout/breadcrumb_builder_spec.rb +32 -0
- data/spec/ama_layout/decorators/moneris_decorator_spec.rb +11 -15
- data/spec/ama_layout/decorators/navigation_decorator_spec.rb +37 -0
- data/spec/ama_layout/decorators/navigation_item_decorator_spec.rb +18 -3
- data/spec/ama_layout/navigation_spec.rb +19 -88
- data/spec/helpers/ama_layout_breadcrumb_helper_spec.rb +9 -0
- data/styles.scss +0 -0
- metadata +46 -16
- data/app/assets/javascripts/ama_layout/desktop/drop_down.coffee +0 -46
- data/app/assets/javascripts/ama_layout/desktop/foundation-namespace.coffee +0 -2
- data/app/assets/javascripts/ama_layout/desktop/header_menu.coffee +0 -7
- data/app/assets/javascripts/ama_layout/desktop/ready.coffee +0 -3
- data/app/assets/javascripts/ama_layout/desktop/sidebar.coffee +0 -4
- data/app/assets/javascripts/ama_layout/desktop/sticky-footer.coffee +0 -33
- data/app/assets/javascripts/ama_layout/desktop/toggle_menu.coffee +0 -8
- data/app/assets/stylesheets/ama_layout/layout_components/show-hide-content-box.scss +0 -11
- data/app/assets/stylesheets/ama_layout/old-ie.scss +0 -74
- data/app/assets/stylesheets/ama_layout/webfonts/ss-symbolicons.js +0 -84
@@ -3,7 +3,7 @@ module AmaLayout
|
|
3
3
|
include ActiveModel::Model
|
4
4
|
include Draper::Decoratable
|
5
5
|
|
6
|
-
attr_accessor :user, :current_url, :nav_file_path
|
6
|
+
attr_accessor :user, :current_url, :nav_file_path, :display_name
|
7
7
|
|
8
8
|
def initialize(args = {})
|
9
9
|
args = defaults.merge args
|
@@ -29,11 +29,16 @@ module AmaLayout
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
private
|
33
32
|
def navigation_items
|
34
33
|
YAML.load ERB.new(File.read nav_file_path).result
|
35
34
|
end
|
36
35
|
|
36
|
+
def email
|
37
|
+
user.email
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
37
42
|
def defaults
|
38
43
|
{
|
39
44
|
nav_file_path: File.join(Gem.loaded_specs["ama_layout"].full_gem_path, "lib", "ama_layout", "navigation.yml")
|
@@ -1,10 +1,9 @@
|
|
1
1
|
member:
|
2
2
|
- text: "My Account Overview"
|
3
|
-
alt: "Back to my dashboard"
|
4
3
|
link: "<%= Rails.configuration.gatekeeper_site %>/"
|
5
4
|
icon: "fa-tachometer"
|
6
5
|
- text: "My Membership"
|
7
|
-
link: "
|
6
|
+
link: "<%= Rails.configuration.membership_site %>/membership/overview"
|
8
7
|
icon: "fa-credit-card"
|
9
8
|
sub_nav:
|
10
9
|
- text: "Membership Overview"
|
@@ -16,7 +15,7 @@ member:
|
|
16
15
|
- text: "Print/Request New Card"
|
17
16
|
link: "<%= Rails.configuration.youraccount_site %>/membership"
|
18
17
|
- text: "My Driver Education"
|
19
|
-
link: "
|
18
|
+
link: "<%= Rails.configuration.driveredonline_site %>/"
|
20
19
|
icon: "fa-car"
|
21
20
|
sub_nav:
|
22
21
|
- text: "Driver Education Overview"
|
@@ -24,7 +23,7 @@ member:
|
|
24
23
|
- text: "New Driver Online Program"
|
25
24
|
link: "<%= Rails.configuration.driveredonline_site %>/dashboard"
|
26
25
|
- text: "My AMA Rewards"
|
27
|
-
link: "
|
26
|
+
link: "<%= Rails.configuration.youraccount_site %>/rewards"
|
28
27
|
icon: "fa-usd"
|
29
28
|
sub_nav:
|
30
29
|
- text: "Rewards Overview"
|
@@ -34,7 +33,7 @@ member:
|
|
34
33
|
- text: "Transaction History"
|
35
34
|
link: "<%= Rails.configuration.youraccount_site %>/reward_dollars"
|
36
35
|
- text: "My Registries"
|
37
|
-
link: "
|
36
|
+
link: "<%= Rails.configuration.registries_site %>/"
|
38
37
|
icon: "fa-folder-open"
|
39
38
|
sub_nav:
|
40
39
|
- text: "Registries Overview"
|
@@ -42,7 +41,7 @@ member:
|
|
42
41
|
- text: "Vehicle Registration Auto-Renew"
|
43
42
|
link: "<%= Rails.configuration.registries_site %>/order/registrations/new"
|
44
43
|
- text: "My Account Settings"
|
45
|
-
link: "
|
44
|
+
link: "<%= Rails.configuration.gatekeeper_site %>/user/edit"
|
46
45
|
icon: "fa-cogs"
|
47
46
|
sub_nav:
|
48
47
|
- text: "Change Email/Password"
|
@@ -55,15 +54,13 @@ member:
|
|
55
54
|
link: "<%= Rails.configuration.youraccount_site %>/membership_update/new"
|
56
55
|
non-member:
|
57
56
|
- text: "Account Dashboard"
|
58
|
-
alt: "Back to my dashboard"
|
59
57
|
link: "<%= Rails.configuration.gatekeeper_site %>/"
|
60
58
|
icon: "fa-tachometer"
|
61
59
|
- text: "Join AMA"
|
62
|
-
alt: "Join AMA"
|
63
60
|
link: "<%= Rails.configuration.membership_site %>"
|
64
61
|
icon: "fa-credit-card"
|
65
62
|
- text: "Driver Education"
|
66
|
-
link: "
|
63
|
+
link: "<%= Rails.configuration.driveredonline_site %>/"
|
67
64
|
icon: "fa-car"
|
68
65
|
sub_nav:
|
69
66
|
- text: "Driver Education Overview"
|
@@ -75,14 +72,13 @@ non-member:
|
|
75
72
|
icon: "fa-cogs"
|
76
73
|
member-in-renewal:
|
77
74
|
- text: "Account Dashboard"
|
78
|
-
alt: "Back to my dashboard"
|
79
75
|
link: "<%= Rails.configuration.gatekeeper_site %>/"
|
80
76
|
icon: "fa-tachometer"
|
81
77
|
- text: "Renew"
|
82
78
|
link: "<%= Rails.configuration.youraccount_site %>/renew"
|
83
79
|
icon: "fa-credit-card"
|
84
80
|
- text: "Driver Education"
|
85
|
-
link: "
|
81
|
+
link: "<%= Rails.configuration.driveredonline_site %>/"
|
86
82
|
icon: "fa-car"
|
87
83
|
sub_nav:
|
88
84
|
- text: "Driver Education Overview"
|
@@ -91,14 +87,13 @@ member-in-renewal:
|
|
91
87
|
link: "<%= Rails.configuration.driveredonline_site %>/dashboard"
|
92
88
|
member-in-renewal-late:
|
93
89
|
- text: "Account Dashboard"
|
94
|
-
alt: "Back to my dashboard"
|
95
90
|
link: "<%= Rails.configuration.gatekeeper_site %>/"
|
96
91
|
icon: "fa-tachometer"
|
97
92
|
- text: "Renew"
|
98
93
|
link: "<%= Rails.configuration.youraccount_site %>/renew"
|
99
94
|
icon: "fa-credit-card"
|
100
95
|
- text: "Driver Education"
|
101
|
-
link: "
|
96
|
+
link: "<%= Rails.configuration.driveredonline_site %>/"
|
102
97
|
icon: "fa-car"
|
103
98
|
sub_nav:
|
104
99
|
- text: "Driver Education Overview"
|
data/lib/ama_layout/version.rb
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
describe AmaLayout::BreadcrumbBuilder do
|
2
|
+
let(:view_context) { ActionView::Base.new }
|
3
|
+
let(:foo_crumb) { BreadcrumbsOnRails::Breadcrumbs::Element.new('Foo', '/foo') }
|
4
|
+
let(:bar_crumb) { BreadcrumbsOnRails::Breadcrumbs::Element.new('Bar', '/foo/bar') }
|
5
|
+
let(:crumbs) { [foo_crumb, bar_crumb] }
|
6
|
+
|
7
|
+
describe '#render' do
|
8
|
+
let(:builder) { AmaLayout::BreadcrumbBuilder.new(view_context, crumbs) }
|
9
|
+
|
10
|
+
context 'no separator specified' do
|
11
|
+
it 'returns the breadcrumb HTML without any separator' do
|
12
|
+
expect(builder.render).to eq('<li><a href="/foo">Foo</a></li><li><a href="/foo/bar">Bar</a></li>')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'with a separator of " > "' do
|
17
|
+
let(:builder) { AmaLayout::BreadcrumbBuilder.new(view_context, crumbs, separator: ' > ') }
|
18
|
+
|
19
|
+
it 'returns the breadcrumb HTML with the proper separator' do
|
20
|
+
expect(builder.render).to eq('<li><a href="/foo">Foo</a></li> > <li><a href="/foo/bar">Bar</a></li>')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'with a disabled element' do
|
25
|
+
let(:bar_crumb) { BreadcrumbsOnRails::Breadcrumbs::Element.new('Bar', '/foo/bar', disabled: true) }
|
26
|
+
|
27
|
+
it 'adds the appropriate disabled attributes to the element' do
|
28
|
+
expect(builder.render).to match /breadcrumbs__link--disabled/
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -5,7 +5,7 @@ describe AmaLayout::MonerisDecorator, type: :decorator do
|
|
5
5
|
describe "#textbox" do
|
6
6
|
it "return textbox style file" do
|
7
7
|
expect(moneris_presenter.textbox).to include "-webkit-appearance: none;"
|
8
|
-
expect(moneris_presenter.textbox).to include "-webkit-box-shadow:
|
8
|
+
expect(moneris_presenter.textbox).to include "-webkit-box-shadow: none;"
|
9
9
|
expect(moneris_presenter.textbox).to include "-webkit-rtl-ordering: logical;"
|
10
10
|
expect(moneris_presenter.textbox).to include "-webkit-transition-delay: 0s, 0s;"
|
11
11
|
expect(moneris_presenter.textbox).to include "-webkit-transition-duration: 0.45s, 0.45s;"
|
@@ -14,28 +14,24 @@ describe AmaLayout::MonerisDecorator, type: :decorator do
|
|
14
14
|
expect(moneris_presenter.textbox).to include "-webkit-user-select: text;"
|
15
15
|
expect(moneris_presenter.textbox).to include "-webkit-writing-mode: horizontal-tb;"
|
16
16
|
expect(moneris_presenter.textbox).to include "background-color: rgb(255, 255, 255);"
|
17
|
-
expect(moneris_presenter.textbox).to include "border-bottom-color: rgb(
|
18
|
-
expect(moneris_presenter.textbox).to include "border-bottom-left-radius: 3px;"
|
19
|
-
expect(moneris_presenter.textbox).to include "border-bottom-right-radius: 3px;"
|
17
|
+
expect(moneris_presenter.textbox).to include "border-bottom-color: rgb(229, 229, 229);"
|
20
18
|
expect(moneris_presenter.textbox).to include "border-bottom-style: solid;"
|
21
|
-
expect(moneris_presenter.textbox).to include "border-bottom-width:
|
19
|
+
expect(moneris_presenter.textbox).to include "border-bottom-width: 2px;"
|
22
20
|
expect(moneris_presenter.textbox).to include "border-image-outset: 0px;"
|
23
21
|
expect(moneris_presenter.textbox).to include "border-image-repeat: stretch;"
|
24
22
|
expect(moneris_presenter.textbox).to include "border-image-slice: 100%;"
|
25
23
|
expect(moneris_presenter.textbox).to include "border-image-source: none;"
|
26
24
|
expect(moneris_presenter.textbox).to include "border-image-width: 1;"
|
27
|
-
expect(moneris_presenter.textbox).to include "border-left-color: rgb(
|
25
|
+
expect(moneris_presenter.textbox).to include "border-left-color: rgb(229, 229, 229);"
|
28
26
|
expect(moneris_presenter.textbox).to include "border-left-style: solid;"
|
29
|
-
expect(moneris_presenter.textbox).to include "border-left-width:
|
30
|
-
expect(moneris_presenter.textbox).to include "border-right-color: rgb(
|
27
|
+
expect(moneris_presenter.textbox).to include "border-left-width: 2px;"
|
28
|
+
expect(moneris_presenter.textbox).to include "border-right-color: rgb(229, 229, 229);"
|
31
29
|
expect(moneris_presenter.textbox).to include "border-right-style: solid;"
|
32
|
-
expect(moneris_presenter.textbox).to include "border-right-width:
|
33
|
-
expect(moneris_presenter.textbox).to include "border-top-color: rgb(
|
34
|
-
expect(moneris_presenter.textbox).to include "border-top-left-radius: 3px;"
|
35
|
-
expect(moneris_presenter.textbox).to include "border-top-right-radius: 3px;"
|
30
|
+
expect(moneris_presenter.textbox).to include "border-right-width: 2px;"
|
31
|
+
expect(moneris_presenter.textbox).to include "border-top-color: rgb(229, 229, 229);"
|
36
32
|
expect(moneris_presenter.textbox).to include "border-top-style: solid;"
|
37
|
-
expect(moneris_presenter.textbox).to include "border-top-width:
|
38
|
-
expect(moneris_presenter.textbox).to include "box-shadow:
|
33
|
+
expect(moneris_presenter.textbox).to include "border-top-width: 2px;"
|
34
|
+
expect(moneris_presenter.textbox).to include "box-shadow: none;"
|
39
35
|
expect(moneris_presenter.textbox).to include "box-sizing: border-box;"
|
40
36
|
expect(moneris_presenter.textbox).to include "color: rgba(0, 0, 0, 0.74902);"
|
41
37
|
expect(moneris_presenter.textbox).to include "cursor: auto;"
|
@@ -43,7 +39,7 @@ describe AmaLayout::MonerisDecorator, type: :decorator do
|
|
43
39
|
expect(moneris_presenter.textbox).to include "font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;font-size: 14px;"
|
44
40
|
expect(moneris_presenter.textbox).to include "font-style: normal;font-variant: normal;"
|
45
41
|
expect(moneris_presenter.textbox).to include "font-weight: normal;"
|
46
|
-
expect(moneris_presenter.textbox).to include "height:
|
42
|
+
expect(moneris_presenter.textbox).to include "height: 44px;"
|
47
43
|
expect(moneris_presenter.textbox).to include "letter-spacing: normal;"
|
48
44
|
expect(moneris_presenter.textbox).to include "line-height: normal;"
|
49
45
|
expect(moneris_presenter.textbox).to include "margin-bottom: 0px;"
|
@@ -17,6 +17,43 @@ describe AmaLayout::NavigationDecorator do
|
|
17
17
|
allow(Rails.configuration).to receive(:registries_site).and_return(registries_site)
|
18
18
|
end
|
19
19
|
|
20
|
+
describe "#display_name_text" do
|
21
|
+
let(:user) { OpenStruct.new(email: 'john.doe@test.com') }
|
22
|
+
|
23
|
+
context "name is provided" do
|
24
|
+
let(:name) { "John D" }
|
25
|
+
let(:nav) { AmaLayout::Navigation.new(user: user, display_name: name).decorate }
|
26
|
+
|
27
|
+
it "has a welcome message" do
|
28
|
+
expect(nav.display_name_text).to eq "Welcome, John D"
|
29
|
+
end
|
30
|
+
|
31
|
+
context "long name given" do
|
32
|
+
let(:name) { "A Really Really Really Really Long Name" }
|
33
|
+
|
34
|
+
it "trucates to a total of 30 characters" do
|
35
|
+
expect(nav.display_name_text).to eq "Welcome, #{name.titleize}".truncate(30)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
context "name is not provided" do
|
41
|
+
let(:nav) { AmaLayout::Navigation.new(user: user).decorate }
|
42
|
+
|
43
|
+
it "returns the user's email address" do
|
44
|
+
expect(nav.display_name_text).to eq user.email
|
45
|
+
end
|
46
|
+
|
47
|
+
context "a really long email" do
|
48
|
+
let(:user) { OpenStruct.new(email: 'areallyreallyreallylongemail@test.com') }
|
49
|
+
|
50
|
+
it "trucates to a total of 30 characters" do
|
51
|
+
expect(nav.display_name_text).to eq user.email.truncate(30)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
20
57
|
describe "#items" do
|
21
58
|
before(:each) do
|
22
59
|
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation: "member"))
|
@@ -1,7 +1,7 @@
|
|
1
1
|
describe AmaLayout::NavigationItemDecorator do
|
2
2
|
let(:navigation_item) { FactoryGirl.build(:navigation_item) }
|
3
3
|
let(:navigation_item_presenter) { navigation_item.decorate }
|
4
|
-
let(:items) { [{ text: "Othersite Overview", link: "othersite.com"}] }
|
4
|
+
let(:items) { [{ text: "Othersite Overview", link: "http://othersite.com"}] }
|
5
5
|
|
6
6
|
describe "#sub_nav" do
|
7
7
|
before(:each) do
|
@@ -68,11 +68,26 @@ describe AmaLayout::NavigationItemDecorator do
|
|
68
68
|
end
|
69
69
|
|
70
70
|
describe "#active_class" do
|
71
|
+
context "#current_url is an invalid URI" do
|
72
|
+
it "fails silently" do
|
73
|
+
navigation_item.current_url = "othersite.com"
|
74
|
+
navigation_item.sub_nav = items
|
75
|
+
expect(navigation_item_presenter.active_class).to eq nil
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
71
79
|
context "with active_link" do
|
72
80
|
it "return the class" do
|
73
|
-
navigation_item.current_url = "othersite.com"
|
81
|
+
navigation_item.current_url = "http://othersite.com"
|
82
|
+
|
83
|
+
navigation_item.sub_nav = items
|
84
|
+
expect(navigation_item_presenter.active_class).to eq "side-nav__child-link--active-page"
|
85
|
+
end
|
86
|
+
|
87
|
+
it "ignores query string parameters" do
|
88
|
+
navigation_item.current_url = "http://othersite.com?foo=bar"
|
74
89
|
navigation_item.sub_nav = items
|
75
|
-
expect(navigation_item_presenter.active_class).to eq "
|
90
|
+
expect(navigation_item_presenter.active_class).to eq "side-nav__child-link--active-page"
|
76
91
|
end
|
77
92
|
end
|
78
93
|
|
@@ -36,38 +36,31 @@ describe AmaLayout::Navigation do
|
|
36
36
|
end
|
37
37
|
|
38
38
|
describe "#items" do
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
end
|
43
|
-
|
44
|
-
it "returns member navigation items" do
|
45
|
-
expect(subject.items[0].text).to eq "My Account Overview"
|
46
|
-
expect(subject.items[0].alt).to eq "Back to my dashboard"
|
47
|
-
expect(subject.items[0].link).to eq "#{gatekeeper_site}/"
|
48
|
-
expect(subject.items[0].icon).to eq "fa-tachometer"
|
39
|
+
before(:each) do
|
40
|
+
subject.user = OpenStruct.new navigation: "member"
|
41
|
+
end
|
49
42
|
|
50
|
-
|
51
|
-
|
52
|
-
|
43
|
+
it "does not remove nil #navigation_items" do
|
44
|
+
expect(subject.items.collect {|i| i.alt }).to include nil
|
45
|
+
end
|
53
46
|
|
54
|
-
|
55
|
-
|
56
|
-
|
47
|
+
it "displays links " do
|
48
|
+
expect(subject.items.collect {|i| i.link }).to eq subject.navigation_items[subject.user.navigation].collect {|i| i["link"] }
|
49
|
+
end
|
57
50
|
|
58
|
-
|
59
|
-
|
60
|
-
|
51
|
+
it "contains text" do
|
52
|
+
expect(subject.items.collect {|i| i.text }).to eq subject.navigation_items[subject.user.navigation].collect {|i| i["text"] }
|
53
|
+
end
|
61
54
|
|
62
|
-
|
63
|
-
|
64
|
-
|
55
|
+
it "contains icons" do
|
56
|
+
expect(subject.items.collect {|i| i.icon }).to eq subject.navigation_items[subject.user.navigation].collect {|i| i["icon"] }
|
57
|
+
end
|
65
58
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
end
|
59
|
+
it "contains alt text" do
|
60
|
+
expect(subject.items.collect {|i| i.alt }).to eq subject.navigation_items[subject.user.navigation].collect {|i| i["alt"] }
|
61
|
+
end
|
70
62
|
|
63
|
+
context "member" do
|
71
64
|
context "subnavs" do
|
72
65
|
context "driver education" do
|
73
66
|
let(:driver_education_subnav) { subject.items[2].sub_nav }
|
@@ -95,30 +88,6 @@ describe AmaLayout::Navigation do
|
|
95
88
|
end
|
96
89
|
|
97
90
|
context "non-member" do
|
98
|
-
before(:each) do
|
99
|
-
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation: "non-member"))
|
100
|
-
end
|
101
|
-
|
102
|
-
it "returns non-member navigation items" do
|
103
|
-
expect(subject.items[0].text).to eq "Account Dashboard"
|
104
|
-
expect(subject.items[0].alt).to eq "Back to my dashboard"
|
105
|
-
expect(subject.items[0].link).to eq "#{gatekeeper_site}/"
|
106
|
-
expect(subject.items[0].icon).to eq "fa-tachometer"
|
107
|
-
|
108
|
-
expect(subject.items[1].text).to eq "Join AMA"
|
109
|
-
expect(subject.items[1].alt).to eq "Join AMA"
|
110
|
-
expect(subject.items[1].link).to eq membership_site
|
111
|
-
expect(subject.items[1].icon).to eq "fa-credit-card"
|
112
|
-
|
113
|
-
expect(subject.items[2].text).to eq "Driver Education"
|
114
|
-
expect(subject.items[2].link).to eq "#"
|
115
|
-
expect(subject.items[2].icon).to eq "fa-car"
|
116
|
-
|
117
|
-
expect(subject.items[3].text).to eq "Change Email/Password"
|
118
|
-
expect(subject.items[3].link).to eq "#{gatekeeper_site}/user/edit"
|
119
|
-
expect(subject.items[3].icon).to eq "fa-cogs"
|
120
|
-
end
|
121
|
-
|
122
91
|
context "subnavs" do
|
123
92
|
context "driver education" do
|
124
93
|
let(:driver_education_subnav) { subject.items[2].sub_nav }
|
@@ -135,25 +104,6 @@ describe AmaLayout::Navigation do
|
|
135
104
|
end
|
136
105
|
|
137
106
|
context "member-in-renewal" do
|
138
|
-
before(:each) do
|
139
|
-
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation: "member-in-renewal"))
|
140
|
-
end
|
141
|
-
|
142
|
-
it "returns member-in-renewal navigation items" do
|
143
|
-
expect(subject.items[0].text).to eq "Account Dashboard"
|
144
|
-
expect(subject.items[0].alt).to eq "Back to my dashboard"
|
145
|
-
expect(subject.items[0].link).to eq "#{gatekeeper_site}/"
|
146
|
-
expect(subject.items[0].icon).to eq "fa-tachometer"
|
147
|
-
|
148
|
-
expect(subject.items[1].text).to eq "Renew"
|
149
|
-
expect(subject.items[1].link).to eq "#{youraccount_site}/renew"
|
150
|
-
expect(subject.items[1].icon).to eq "fa-credit-card"
|
151
|
-
|
152
|
-
expect(subject.items[2].text).to eq "Driver Education"
|
153
|
-
expect(subject.items[2].link).to eq "#"
|
154
|
-
expect(subject.items[2].icon).to eq "fa-car"
|
155
|
-
end
|
156
|
-
|
157
107
|
context "subnavs" do
|
158
108
|
context "driver education" do
|
159
109
|
let(:driver_education_subnav) { subject.items[2].sub_nav }
|
@@ -170,25 +120,6 @@ describe AmaLayout::Navigation do
|
|
170
120
|
end
|
171
121
|
|
172
122
|
context "member-in-renewal-late" do
|
173
|
-
before(:each) do
|
174
|
-
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation: "member-in-renewal-late"))
|
175
|
-
end
|
176
|
-
|
177
|
-
it "returns member-in-renewal-late navigation items" do
|
178
|
-
expect(subject.items[0].text).to eq "Account Dashboard"
|
179
|
-
expect(subject.items[0].alt).to eq "Back to my dashboard"
|
180
|
-
expect(subject.items[0].link).to eq "#{gatekeeper_site}/"
|
181
|
-
expect(subject.items[0].icon).to eq "fa-tachometer"
|
182
|
-
|
183
|
-
expect(subject.items[1].text).to eq "Renew"
|
184
|
-
expect(subject.items[1].link).to eq "#{youraccount_site}/renew"
|
185
|
-
expect(subject.items[1].icon).to eq "fa-credit-card"
|
186
|
-
|
187
|
-
expect(subject.items[2].text).to eq "Driver Education"
|
188
|
-
expect(subject.items[2].link).to eq "#"
|
189
|
-
expect(subject.items[2].icon).to eq "fa-car"
|
190
|
-
end
|
191
|
-
|
192
123
|
context "subnavs" do
|
193
124
|
context "driver education" do
|
194
125
|
let(:driver_education_subnav) { subject.items[2].sub_nav }
|
@@ -0,0 +1,9 @@
|
|
1
|
+
describe AmaLayoutBreadcrumbHelper do
|
2
|
+
describe "#show_breadcrumbs" do
|
3
|
+
it "renders breadcrumbs" do
|
4
|
+
helper.extend BreadcrumbsOnRails::ActionController::HelperMethods
|
5
|
+
helper.add_breadcrumb "Ama Online Account", "#"
|
6
|
+
expect(helper.show_breadcrumbs).to include "<a href=\"#\">Ama Online Account</a>"
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
data/styles.scss
ADDED
File without changes
|