Rorem ipsum dolor sit
+Yorem ipsum dolor sit amet, consectetur + adipiscing elit. Nunc vulputate libero et velit + interdum, ac aliquet odio mattis class.
+ - type: action_link + inverse: true + text: "Learn more about our goals" + href: "todo" +- type: featured + image: + alt: example alt text + sources: + desktop: "landing_page/placeholder/desktop.png" + desktop_2x: "landing_page/placeholder/desktop_2x.png" + mobile: "landing_page/placeholder/mobile.png" + mobile_2x: "landing_page/placeholder/mobile_2x.png" + tablet: "landing_page/placeholder/tablet.png" + tablet_2x: "landing_page/placeholder/tablet_2x.png" + featured_content: + blocks: + - type: govspeak + inverse: true + content: | +Lorem ipsum dolor sit
+Lorem ipsum dolor sit amet. In voluptas dolorum vel veniam nisi et voluptate dolores id voluptatem distinctio. Et quia accusantium At ducimus quis aut voluptates iusto aut esse suscipit.
+- type: govspeak + content: | +Porem ipsum dolor
+https://youtu.be/C770bSvGr_E?feature=shared
+- type: govspeak + content: | +Dorem ipsum dolor sit
+- type: grid_container + blocks: + - type: card + image: + alt: "Placeholder alt text" + source: "landing_page/placeholder/chart.png" + card_content: + blocks: + - type: govspeak + inverse: true + content:Korem ipsum dolor sit
+ - type: card + image: + alt: "Placeholder alt text" + source: "landing_page/placeholder/chart.png" + card_content: + blocks: + - type: govspeak + inverse: true + content:Korem ipsum dolor sit
+ - type: card + image: + alt: "Placeholder alt text" + source: "landing_page/placeholder/chart.png" + card_content: + blocks: + - type: govspeak + inverse: true + content:Korem ipsum dolor sit
+- type: share_links + links: + - href: "/twitter-share-link" + text: "Twitter" + icon: "twitter" + - href: "/instagram-share-link" + text: "Instagram" + icon: "instagram" + - href: "/flickr-share-link" + text: "Flickr" + icon: "flickr" + - href: "/facebook-share-link" + text: "Facebook" + icon: "facebook" + - href: "/youtube-share-link" + text: "YouTube" + icon: "youtube" diff --git a/lib/data/landing_page_content_items/landing_page.yaml b/lib/data/landing_page_content_items/landing_page.yaml index ad62ccdb38..b53effbfa5 100644 --- a/lib/data/landing_page_content_items/landing_page.yaml +++ b/lib/data/landing_page_content_items/landing_page.yaml @@ -1,4 +1,17 @@ blocks: +- type: main_navigation + links: + - text: Ipsums for Lorem + href: /ipsum + - text: Our Lorem + href: /landing-page/sub-page-1 + children: + - text: Child 1 + href: /a + - text: Child 2 + href: /b + title: Service name + title_link: /landing-page - type: hero image: alt: "Placeholder alt text" @@ -12,11 +25,13 @@ blocks: hero_content: blocks: - type: govspeak + inverse: true content: |This is a heading
Lorem ipsum...
- type: action_link - text: "See the missions" + inverse: true + text: "See the tasks" href: "todo" - type: featured image: @@ -31,6 +46,7 @@ blocks: featured_content: blocks: - type: govspeak + inverse: true content: |Title of the content
Lorem ipsum dolor sit amet. In voluptas dolorum vel veniam nisi et voluptate dolores id voluptatem distinctio. Et quia accusantium At ducimus quis aut voluptates iusto aut esse suscipit.
@@ -69,6 +85,22 @@ blocks: content:Right content!
- type: govspeak content:Statistics
+- type: hero + theme: middle_left + image: + alt: "Placeholder alt text" + sources: + desktop: "landing_page/placeholder/desktop.png" + desktop_2x: "landing_page/placeholder/desktop_2x.png" + mobile: "landing_page/placeholder/mobile.png" + mobile_2x: "landing_page/placeholder/mobile_2x.png" + tablet: "landing_page/placeholder/tablet.png" + tablet_2x: "landing_page/placeholder/tablet_2x.png" + hero_content: + blocks: + - type: quote + text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc vulputate libero et velit interdum, ac aliquet odio mattis class" + cite: "Lorem ipsum dolor sit, 28 September 2024" - type: columns_layout blocks: - type: big_number @@ -80,4 +112,75 @@ blocks: - type: big_number number: £43 label: Cost of a cup of coffee in Covent Garden - +- type: grid_container + blocks: + - type: card + image: + alt: "Placeholder alt text" + source: "landing_page/placeholder/chart.png" + card_content: + blocks: + - type: govspeak + inverse: true + content:Title 1 govspeak title goes here
+ - type: card + image: + alt: "Placeholder alt text" + source: "landing_page/placeholder/chart.png" + card_content: + blocks: + - type: govspeak + inverse: true + content:Title 2 govspeak title goes here
+ - type: card + image: + alt: "Placeholder alt text" + source: "landing_page/placeholder/chart.png" + card_content: + blocks: + - type: govspeak + inverse: true + content:Title 3 govspeak title
+- type: two_column_layout + theme: one_third_two_thirds + blocks: + - type: side_navigation + title: Alternate title + alternative_line_style: true + - type: blocks_container + blocks: + - type: card + image: + alt: "Placeholder alt text" + source: "landing_page/placeholder/chart.png" + card_content: + blocks: + - type: govspeak + inverse: true + content:Title 1 govspeak title goes here
+ - type: card + image: + alt: "Placeholder alt text" + source: "landing_page/placeholder/chart.png" + card_content: + blocks: + - type: govspeak + inverse: true + content:Title 2 govspeak title goes here
+- type: share_links + links: + - href: "/twitter-share-link" + text: "Twitter" + icon: "twitter" + - href: "/instagram-share-link" + text: "Instagram" + icon: "instagram" + - href: "/flickr-share-link" + text: "Flickr" + icon: "flickr" + - href: "/facebook-share-link" + text: "Facebook" + icon: "facebook" + - href: "/youtube-share-link" + text: "YouTube" + icon: "youtube" diff --git a/lib/data/landing_page_content_items/links/side_navigation.yaml b/lib/data/landing_page_content_items/links/side_navigation.yaml new file mode 100644 index 0000000000..2dc3915f72 --- /dev/null +++ b/lib/data/landing_page_content_items/links/side_navigation.yaml @@ -0,0 +1,4 @@ +- text: Landing Page + href: "/landing-page" +- text: Sub Page 1 + href: "/landing-page/sub-page-1" diff --git a/lib/data/landing_page_content_items/sub_page_1.yaml b/lib/data/landing_page_content_items/sub_page_1.yaml index 221e5ca96b..90bf76e23a 100644 --- a/lib/data/landing_page_content_items/sub_page_1.yaml +++ b/lib/data/landing_page_content_items/sub_page_1.yaml @@ -1,4 +1,17 @@ blocks: +- type: main_navigation + links: + - text: Ipsums for Lorem + href: /ipsum + - text: Our Lorem + href: /landing-page/sub-page-1 + children: + - text: Child 1 + href: /a + - text: Child 2 + href: /b + title: Service name + title_link: /landing-page - type: govspeak content: |Sub Page 1
diff --git a/lib/data/landing_page_content_items/task.yaml b/lib/data/landing_page_content_items/task.yaml new file mode 100644 index 0000000000..8bdc99a5cb --- /dev/null +++ b/lib/data/landing_page_content_items/task.yaml @@ -0,0 +1,123 @@ +blocks: +- type: main_navigation + links: + - text: Ipsums for Lorem + href: /ipsum + - text: Our Lorem + href: /landing-page/sub-page-1 + children: + - text: Child 1 + href: /a + - text: Child 2 + href: /b + title: Service name + title_link: /landing-page +- type: hero + image: + alt: "Placeholder alt text" + sources: + desktop: "landing_page/placeholder/desktop.png" + desktop_2x: "landing_page/placeholder/desktop_2x.png" + mobile: "landing_page/placeholder/mobile.png" + mobile_2x: "landing_page/placeholder/mobile_2x.png" + tablet: "landing_page/placeholder/tablet.png" + tablet_2x: "landing_page/placeholder/tablet_2x.png" + hero_content: + blocks: + - type: govspeak + inverse: true + content: | +Rorem ipsum dolor sit
+Yorem ipsum dolor sit amet, consectetur + adipiscing elit. Nunc vulputate libero et velit + interdum, ac aliquet odio mattis class.
+ - type: action_link + inverse: true + text: "Learn more about our goals" + href: "todo" +- type: two_column_layout + theme: one_third_two_thirds + blocks: + - type: side_navigation + - type: blocks_container + blocks: + - type: govspeak + content: | +Korem ipsum dolor sit amet, consectetur adipiscing elit. Etiam eu turpis + molestie, dictum esta, mattis tellus. Sed dignissim, metus nec fringilla + accumsan, risus sem sollicitudin lacus, ut interdum tellus elit sed risus. + Maecenas eget.
+ - type: statistics + title: "Chart to visually represent data" + x_axis_label: "X Axis" + y_axis_label: "Y Axis" + csv_file: "data_one.csv" + data_source_link_text: "Data source" + data_source_link: https://www.ons.gov.uk/economy/grossdomesticproductgdp/timeseries/ihyq/qna + - type: govspeak + content: | +Korem ipsum dolor sit amet, consectetur adipiscing elit. Etiam eu turpis + molestie, dictum esta, mattis tellus. Sed dignissim, metus nec fringilla + accumsan, risus sem sollicitudin lacus, ut interdum tellus elit sed risus. + Maecenas eget.
+Korem ipsum dolor sit amet, consectetur adipiscing elit. Etiam eu turpis + molestie, dictum esta, mattis tellus. Sed dignissim, metus nec fringilla + accumsan, risus sem sollicitudin lacus, ut interdum tellus elit sed risus. + Maecenas eget.
+Korem ipsum dolor sit amet, consectetur adipiscing elit. Etiam eu turpis + molestie, dictum esta, mattis tellus. Sed dignissim, metus nec fringilla + accumsan, risus sem sollicitudin lacus, ut interdum tellus elit sed risus. + Maecenas eget.
+- type: hero + mid_page: true + image: + alt: "Placeholder alt text" + sources: + desktop: "landing_page/placeholder/desktop.png" + desktop_2x: "landing_page/placeholder/desktop_2x.png" + mobile: "landing_page/placeholder/mobile.png" + mobile_2x: "landing_page/placeholder/mobile_2x.png" + tablet: "landing_page/placeholder/tablet.png" + tablet_2x: "landing_page/placeholder/tablet_2x.png" + hero_content: + blocks: + - type: quote + text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc vulputate libero et velit interdum, ac aliquet odio mattis class" + cite: "Lorem ipsum dolor sit, 28 September 2024" +- type: two_column_layout + theme: one_third_two_thirds + blocks: + - type: govspeak + content:+ - type: blocks_container + blocks: + - type: govspeak + content: | +
Korem ipsum dolor sit amet, consectetur adipiscing elit. Etiam eu turpis + molestie, dictum esta, mattis tellus. Sed dignissim, metus nec fringilla + accumsan, risus sem sollicitudin lacus, ut interdum tellus elit sed risus. + Maecenas eget.
+Porem ipsum dolor
+https://youtu.be/C770bSvGr_E?feature=shared
+Korem ipsum dolor sit amet, consectetur adipiscing elit. Etiam eu turpis + molestie, dictum esta, mattis tellus. Sed dignissim, metus nec fringilla + accumsan, risus sem sollicitudin lacus, ut interdum tellus elit sed risus. + Maecenas eget.
+#### Curated links go here ### +- type: share_links + links: + - href: "/twitter-share-link" + text: "Twitter" + icon: "twitter" + - href: "/instagram-share-link" + text: "Instagram" + icon: "instagram" + - href: "/flickr-share-link" + text: "Flickr" + icon: "flickr" + - href: "/facebook-share-link" + text: "Facebook" + icon: "facebook" + - href: "/youtube-share-link" + text: "YouTube" + icon: "youtube" diff --git a/lib/data/landing_page_content_items/tasks.yaml b/lib/data/landing_page_content_items/tasks.yaml new file mode 100644 index 0000000000..d4cfb29756 --- /dev/null +++ b/lib/data/landing_page_content_items/tasks.yaml @@ -0,0 +1,105 @@ +blocks: +- type: main_navigation + links: + - text: Ipsums for Lorem + href: /ipsum + - text: Our Lorem + href: /landing-page/sub-page-1 + children: + - text: Child 1 + href: /a + - text: Child 2 + href: /b + title: Service name + title_link: /landing-page +- type: hero + image: + alt: "Placeholder alt text" + sources: + desktop: "landing_page/placeholder/desktop.png" + desktop_2x: "landing_page/placeholder/desktop_2x.png" + mobile: "landing_page/placeholder/mobile.png" + mobile_2x: "landing_page/placeholder/mobile_2x.png" + tablet: "landing_page/placeholder/tablet.png" + tablet_2x: "landing_page/placeholder/tablet_2x.png" + hero_content: + blocks: + - type: govspeak + inverse: true + content: | +Rorem ipsum dolor sit
+Yorem ipsum dolor sit amet, consectetur + adipiscing elit. Nunc vulputate libero et velit + interdum, ac aliquet odio mattis class.
+ - type: action_link + inverse: true + text: "Learn more about our goals" + href: "todo" +- type: two_column_layout + theme: one_third_two_thirds + blocks: + - type: side_navigation + - type: blocks_container + blocks: + - type: card + image: + alt: "Placeholder alt text" + source: "landing_page/placeholder/chart.png" + card_content: + blocks: + - type: govspeak + inverse: true + content:Rorem ipsum dolor sit amet, consectetur adipiscing elit.
+ - type: card + image: + alt: "Placeholder alt text" + source: "landing_page/placeholder/chart.png" + card_content: + blocks: + - type: govspeak + inverse: true + content:Rorem ipsum dolor sit amet, consectetur adipiscing elit.
+ - type: card + image: + alt: "Placeholder alt text" + source: "landing_page/placeholder/chart.png" + card_content: + blocks: + - type: govspeak + inverse: true + content:Rorem ipsum dolor sit amet, consectetur adipiscing elit.
+ - type: card + image: + alt: "Placeholder alt text" + source: "landing_page/placeholder/chart.png" + card_content: + blocks: + - type: govspeak + inverse: true + content:Rorem ipsum dolor sit amet, consectetur adipiscing elit.
+ - type: card + image: + alt: "Placeholder alt text" + source: "landing_page/placeholder/chart.png" + card_content: + blocks: + - type: govspeak + inverse: true + content:Rorem ipsum dolor sit amet, consectetur adipiscing elit.
+- type: share_links + links: + - href: "/twitter-share-link" + text: "Twitter" + icon: "twitter" + - href: "/instagram-share-link" + text: "Instagram" + icon: "instagram" + - href: "/flickr-share-link" + text: "Flickr" + icon: "flickr" + - href: "/facebook-share-link" + text: "Facebook" + icon: "facebook" + - href: "/youtube-share-link" + text: "YouTube" + icon: "youtube" diff --git a/package.json b/package.json index 90423558b1..14a8bb5865 100644 --- a/package.json +++ b/package.json @@ -42,10 +42,10 @@ }, "devDependencies": { "jasmine-browser-runner": "^2.5.0", - "jasmine-core": "^5.3.0", + "jasmine-core": "^5.4.0", "nyc": "^17.1.0", "standardx": "^7.0.0", - "stylelint": "^16.9.0", + "stylelint": "^16.10.0", "stylelint-config-gds": "^2.0.0" }, "packageManager": "yarn@3.5.0" diff --git a/spec/fixtures/landing_page.yaml b/spec/fixtures/landing_page.yaml index fb248829e5..b34accb74b 100644 --- a/spec/fixtures/landing_page.yaml +++ b/spec/fixtures/landing_page.yaml @@ -1,23 +1,55 @@ blocks: +- type: main_navigation + links: + - text: Ipsums for Lorem + href: /ipsum + - text: Our Lorem + href: /landing-page/sub-page-1 + children: + - text: Child 1 + href: /a + - text: Child 2 + href: /b + title: Service name + title_link: /landing-page - type: hero image: - alt: "todo alt text" + alt: "Placeholder alt text" sources: - desktop_2x: "landing_page/placeholder/desktop_2x.png" desktop: "landing_page/placeholder/desktop.png" - tablet_2x: "landing_page/placeholder/tablet_2x.png" - tablet: "landing_page/placeholder/tablet.png" - mobile_2x: "landing_page/placeholder/mobile_2x.png" + desktop_2x: "landing_page/placeholder/desktop_2x.png" mobile: "landing_page/placeholder/mobile.png" + mobile_2x: "landing_page/placeholder/mobile_2x.png" + tablet: "landing_page/placeholder/tablet.png" + tablet_2x: "landing_page/placeholder/tablet_2x.png" hero_content: blocks: - type: govspeak + inverse: true content: |This is a heading
Lorem ipsum...
- type: action_link + inverse: true text: "See the missions" href: "todo" +- type: featured + image: + alt: example alt text + sources: + desktop: "landing_page/placeholder/desktop.png" + desktop_2x: "landing_page/placeholder/desktop_2x.png" + mobile: "landing_page/placeholder/mobile.png" + mobile_2x: "landing_page/placeholder/mobile_2x.png" + tablet: "landing_page/placeholder/tablet.png" + tablet_2x: "landing_page/placeholder/tablet_2x.png" + featured_content: + blocks: + - type: govspeak + inverse: true + content: | +Title of the content
+Lorem ipsum dolor sit amet. In voluptas dolorum vel veniam nisi et voluptate dolores id voluptatem distinctio. Et quia accusantium At ducimus quis aut voluptates iusto aut esse suscipit.
- type: govspeak content: |Here's a heading
@@ -43,7 +75,7 @@ blocks: theme: two_thirds_one_third blocks: - type: govspeak - content:Left content!
+ content: https://www.youtube.com/watch?v=dQw4w9WgXcQ - type: govspeak content:Right content!
- type: govspeak @@ -59,4 +91,58 @@ blocks: - type: big_number number: £43 label: Cost of a cup of coffee in Covent Garden - +- type: grid_container + blocks: + - type: card + image: + alt: "Placeholder alt text" + source: "landing_page/placeholder/chart.png" + card_content: + blocks: + - type: govspeak + inverse: true + content:Title 1 govspeak title goes here
+ - type: card + image: + alt: "Placeholder alt text" + source: "landing_page/placeholder/chart.png" + card_content: + blocks: + - type: govspeak + inverse: true + content:Title 2 govspeak title goes here
+ - type: card + image: + alt: "Placeholder alt text" + source: "landing_page/placeholder/chart.png" + card_content: + blocks: + - type: govspeak + inverse: true + content:Title 3 govspeak title
+- type: two_column_layout + theme: one_third_two_thirds + blocks: + - type: side_navigation + title: Alternate title + alternative_line_style: true + - type: blocks_container + blocks: + - type: card + image: + alt: "Placeholder alt text" + source: "landing_page/placeholder/chart.png" + card_content: + blocks: + - type: govspeak + inverse: true + content:Title 1 govspeak title goes here
+ - type: card + image: + alt: "Placeholder alt text" + source: "landing_page/placeholder/chart.png" + card_content: + blocks: + - type: govspeak + inverse: true + content:Title 2 govspeak title goes here
diff --git a/spec/fixtures/landing_page/links/side_navigation.yaml b/spec/fixtures/landing_page/links/side_navigation.yaml new file mode 100644 index 0000000000..6195bec55d --- /dev/null +++ b/spec/fixtures/landing_page/links/side_navigation.yaml @@ -0,0 +1,4 @@ +- text: Landing Page + href: "/landing-page" +- text: Sub Page 1 + href: "/sub-page-1" diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 35fcf6ccfd..7ff77f398f 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -48,4 +48,30 @@ def dummy_publication expect(current_path_without_query_string).to eq("/foo/bar") end end + + describe "#remove_breadcrumbs" do + describe "when is_landing_page? is true" do + let(:content_item) { ContentItem.new({ "schema" => "landing_page" }) } + + it "removes breadcrumbs" do + expect(remove_breadcrumbs(content_item)).to eq(true) + end + end + + describe "when is_landing_page? is false" do + let(:content_item) { ContentItem.new({ "schema" => "a_different_page" }) } + + it "does not remove breadcrumbs" do + expect(remove_breadcrumbs(content_item)).to eq(false) + end + end + + describe "when is_landing_page? is undefined" do + let(:content_item) { ContentItem.new({}) } + + it "does not remove breadcrumbs" do + expect(remove_breadcrumbs(content_item)).to eq(false) + end + end + end end diff --git a/spec/helpers/block_helper_spec.rb b/spec/helpers/block_helper_spec.rb index 4345b62c95..1efa2dec54 100644 --- a/spec/helpers/block_helper_spec.rb +++ b/spec/helpers/block_helper_spec.rb @@ -60,4 +60,11 @@ end end end + + describe "#render_block" do + it "returns an empty string when a partial template doesn't exist" do + block = double(type: "not_a_block") + expect(render_block(block)).to be_empty + end + end end diff --git a/spec/helpers/contents_list_helper_spec.rb b/spec/helpers/contents_list_helper_spec.rb new file mode 100644 index 0000000000..88c1339bc9 --- /dev/null +++ b/spec/helpers/contents_list_helper_spec.rb @@ -0,0 +1,131 @@ +RSpec.describe ContentsListHelper do + include ContentsListHelper + + describe "#contents_list" do + let(:current_path) { "/active-page" } + + it "returns a list of links" do + links = [{ + "href" => "/landing-page", + "text" => "Landing page", + }] + + expected = [{ + href: "/landing-page", + text: "Landing page", + }] + + expect(contents_list(current_path, links)).to eq(expected) + end + + it "sets a link to active if it matches the current path" do + links = [{ + "href" => "/active-page", + "text" => "Active page", + }] + + expected = [{ + href: "/active-page", + text: "Active page", + active: true, + }] + + expect(contents_list(current_path, links)).to eq(expected) + end + + context "when there are nested links" do + it "returns a list of nested links" do + links = [ + { + "href" => "/landing-page", + "text" => "Landing page", + }, + { + "href" => "/our-lorem", + "text" => "Our Lorem", + "items" => [ + { + "href" => "/a", + "text" => "Child 1", + }, + { + "href" => "/b", + "text" => "Child 2", + }, + ], + }, + ] + + expected = [ + { + href: "/landing-page", + text: "Landing page", + }, + { + href: "/our-lorem", + text: "Our Lorem", + items: [ + { + href: "/a", + text: "Child 1", + }, + { + href: "/b", + text: "Child 2", + }, + ], + }, + ] + + expect(contents_list(current_path, links)).to eq(expected) + end + + it "sets nested link to active if it matches the current path" do + links = [ + { + "href" => "/landing-page", + "text" => "Landing page", + }, + { + "href" => "/our-lorem", + "text" => "Our Lorem", + "items" => [ + { + "href" => "/a", + "text" => "Child 1", + }, + { + "href" => "/active-page", + "text" => "Active page", + }, + ], + }, + ] + + expected = [ + { + href: "/landing-page", + text: "Landing page", + }, + { + href: "/our-lorem", + text: "Our Lorem", + items: [ + { + href: "/a", + text: "Child 1", + }, + { + href: "/active-page", + text: "Active page", + active: true, + }, + ], + }, + ] + + expect(contents_list(current_path, links)).to eq(expected) + end + end + end +end diff --git a/spec/javascripts/unit/modules/app-b-main-navigation.spec.js b/spec/javascripts/unit/modules/app-b-main-navigation.spec.js new file mode 100644 index 0000000000..a49ee443aa --- /dev/null +++ b/spec/javascripts/unit/modules/app-b-main-navigation.spec.js @@ -0,0 +1,75 @@ +describe('Main Navigation Block module', function () { + 'use strict' + + var el, module + + beforeEach(function () { + var DOM = + ` ++ You are currently on [Place Current Menu Selection Here] +
+ + +Title
" }, + { "type" => "govspeak", "content" => "Some content!
" }, + ], + } } + end + + describe "#image" do + it "returns the properties of the image" do + result = described_class.new(blocks_hash).image + expect(result.alt).to eq "some alt text" + expect(result.source).to eq "landing_page/placeholder/chart.png" + end + end + + describe "#card_content" do + it "returns an array of instantiated blocks" do + result = described_class.new(blocks_hash).card_content + expect(result.size).to eq 2 + expect(result.first.data).to eq("type" => "govspeak", "content" => "Title
") + expect(result.second.data).to eq("type" => "govspeak", "content" => "Some content!
") + end + end +end diff --git a/spec/models/block/side_navigation_spec.rb b/spec/models/block/side_navigation_spec.rb new file mode 100644 index 0000000000..9a0ef10c91 --- /dev/null +++ b/spec/models/block/side_navigation_spec.rb @@ -0,0 +1,18 @@ +RSpec.describe Block::SideNavigation do + let(:block_hash) do + { "type" => "side_navigation" } + end + + before do + stub_const("Block::SideNavigation::LINKS_FILE_PATH", "spec/fixtures/landing_page/links/side_navigation.yaml") + end + + describe "#links" do + it "returns all of the side navigation links" do + links = described_class.new(block_hash).links + expect(links.count).to eq(2) + expect(links.first["text"]).to eq("Landing Page") + expect(links.first["href"]).to eq("/landing-page") + end + end +end diff --git a/spec/models/content_item_spec.rb b/spec/models/content_item_spec.rb new file mode 100644 index 0000000000..c4d185ff1a --- /dev/null +++ b/spec/models/content_item_spec.rb @@ -0,0 +1,27 @@ +RSpec.describe ContentItem do + describe "#is_a_xxxx?" do + let(:subject) { described_class.new({ "schema" => "landing_page" }) } + + it "returns true when called with the schema of the object" do + expect(subject.is_a_landing_page?).to be true + end + + it "returns false when called with a mismatching schema" do + expect(subject.is_a_place?).to be false + end + + it "also handles is_an_xxxx?" do + expect(subject.is_an_organisation?).to be false + end + + it "still passes other missing methods to parent" do + expect { subject.was_a_landing_page? }.to raise_error(NoMethodError) + end + + it "responds to the various methods" do + expect(subject.respond_to?(:is_a_landing_page?)).to be true + expect(subject.respond_to?(:is_an_organisation?)).to be true + expect(subject.respond_to?(:was_a_landing_page?)).to be false + end + end +end diff --git a/spec/system/landing_page_spec.rb b/spec/system/landing_page_spec.rb index 81154073b7..833e57b92f 100644 --- a/spec/system/landing_page_spec.rb +++ b/spec/system/landing_page_spec.rb @@ -41,5 +41,32 @@ assert_selector ".govuk-block__hero picture" assert_selector ".govuk-block__hero .app-b-hero__textbox" end + + it "renders a card" do + visit base_path + + assert_selector ".landing-page .app-b-card" + assert_selector ".app-b-card .app-b-card__textbox" + assert_selector ".app-b-card .app-b-card__figure" + assert_selector ".app-b-card__figure .app-b-card__image" + end + + it "renders a grid container" do + visit base_path + + assert_selector ".landing-page .grid-container" + end + + it "renders a blocks container" do + visit base_path + + assert_selector ".landing-page .blocks-container" + end + + it "renders main navigation" do + visit base_path + + assert_selector ".app-b-main-nav .app-b-main-nav__heading-p" + end end end diff --git a/spec/system/licence_transaction_spec.rb b/spec/system/licence_transaction_spec.rb index 5dc1c8ecfe..50587125c8 100644 --- a/spec/system/licence_transaction_spec.rb +++ b/spec/system/licence_transaction_spec.rb @@ -122,7 +122,7 @@ ) visit "/find-licences/licence-to-kill" fill_in("postcode", with: "SW1A 1AA") - click_on("Find") + click_on("Find your local council") end it "redirects to the appropriate authority slug" do @@ -283,7 +283,7 @@ ) visit "/find-licences/licence-to-kill" fill_in("postcode", with: "HP20 2QF") - click_on("Find") + click_on("Find your local council") end it "redirects to the appropriate authority slug" do @@ -349,7 +349,7 @@ ) visit "/find-licences/licence-to-kill" fill_in("postcode", with: "DT11 0SF") - click_on("Find") + click_on("Find your local council") end it "redirects to the appropriate authority slug" do @@ -421,7 +421,7 @@ ) visit "/find-licences/licence-to-kill" fill_in("postcode", with: "SW1A 1AA") - click_on("Find") + click_on("Find your local council") end it "shows details for the first licensing authority only" do @@ -442,7 +442,7 @@ stub_locations_api_does_not_have_a_bad_postcode("Not valid") visit "/find-licences/licence-to-kill" fill_in("postcode", with: "Not valid") - click_on("Find") + click_on("Find your local council") end it "prefixes 'Error' in the title element" do @@ -477,7 +477,7 @@ stub_locations_api_has_no_location("AB1 2AB") visit "/find-licences/licence-to-kill" fill_in("postcode", with: "AB1 2AB") - click_on("Find") + click_on("Find your local council") end it "prefixes 'Error' in the title element" do @@ -503,7 +503,7 @@ stub_local_links_manager_does_not_have_a_custodian_code(123) visit "/find-licences/licence-to-kill" fill_in("postcode", with: "XM4 5HQ") - click_on("Find") + click_on("Find your local council") end it "prefixes 'Error' in the title element" do @@ -568,7 +568,7 @@ stub_local_links_manager_has_a_local_authority("staffordshire", local_custodian_code: 1234, snac: "41") visit "/find-licences/licence-to-kill" fill_in("postcode", with: "ST10 4DB") - click_on("Find") + click_on("Find your local council") end it "includes the first licencing authority name only in the title element" do @@ -586,7 +586,7 @@ stub_licence_does_not_exist("1071-5-1/41UH") visit "/find-licences/licence-to-kill" fill_in("postcode", with: "ST10 4DB") - click_on("Find") + click_on("Find your local council") end it "includes contact your council text in the title element" do @@ -615,7 +615,7 @@ stub_local_links_manager_has_a_local_authority("Ceechester", local_custodian_code: 3) visit "/find-licences/licence-to-kill" fill_in("postcode", with: "CH25 9BJ") - click_on("Find") + click_on("Find your local council") end it "includes the select address text in the title element" do @@ -660,7 +660,7 @@ stub_local_links_manager_has_a_local_authority("Geechester", local_custodian_code: 7) visit "/find-licences/licence-to-kill" fill_in("postcode", with: "CH25 9BJ") - click_on("Find") + click_on("Find your local council") end it "includes the select address text in the title element" do diff --git a/yarn.lock b/yarn.lock index 74cc432e96..bfb1b27d38 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1000,20 +1000,20 @@ __metadata: languageName: node linkType: hard -"css-functions-list@npm:^3.2.2": - version: 3.2.2 - resolution: "css-functions-list@npm:3.2.2" - checksum: b8a564118b93b87b63236a57132a3ef581416896a70c1d0df73360a9ec43dc582f7c2a586b578feb8476179518e557c6657570a8b6185b16300c7232a84d43e3 +"css-functions-list@npm:^3.2.3": + version: 3.2.3 + resolution: "css-functions-list@npm:3.2.3" + checksum: 25f12fb0ef1384b1cf45a6e7e0afd596a19bee90b90316d9e50f7820888f4a8f265be7a6a96b10a5c81e403bd7a5ff8010fa936144f84959d9d91c9350cda0d4 languageName: node linkType: hard -"css-tree@npm:^2.3.1": - version: 2.3.1 - resolution: "css-tree@npm:2.3.1" +"css-tree@npm:^3.0.0": + version: 3.0.0 + resolution: "css-tree@npm:3.0.0" dependencies: - mdn-data: 2.0.30 + mdn-data: 2.10.0 source-map-js: ^1.0.1 - checksum: 493cc24b5c22b05ee5314b8a0d72d8a5869491c1458017ae5ed75aeb6c3596637dbe1b11dac2548974624adec9f7a1f3a6cf40593dc1f9185eb0e8279543fbc0 + checksum: 9bb5c31c24d00e1acc4beaed6c817efa4fa4f7d53437dae77022c31a11a482b545651913a80c258132f69f1ec43220d8503381fea5cb112eea57611f8601da85 languageName: node linkType: hard @@ -1047,7 +1047,7 @@ __metadata: languageName: node linkType: hard -"debug@npm:^4.1.0, debug@npm:^4.3.1, debug@npm:^4.3.6": +"debug@npm:^4.1.0, debug@npm:^4.3.1": version: 4.3.6 resolution: "debug@npm:4.3.6" dependencies: @@ -1059,6 +1059,18 @@ __metadata: languageName: node linkType: hard +"debug@npm:^4.3.7": + version: 4.3.7 + resolution: "debug@npm:4.3.7" + dependencies: + ms: ^2.1.3 + peerDependenciesMeta: + supports-color: + optional: true + checksum: 822d74e209cd910ef0802d261b150314bbcf36c582ccdbb3e70f0894823c17e49a50d3e66d96b633524263975ca16b6a833f3e3b7e030c157169a5fabac63160 + languageName: node + linkType: hard + "decamelize@npm:^1.2.0": version: 1.2.0 resolution: "decamelize@npm:1.2.0" @@ -1718,12 +1730,12 @@ __metadata: languageName: node linkType: hard -"file-entry-cache@npm:^9.0.0": - version: 9.0.0 - resolution: "file-entry-cache@npm:9.0.0" +"file-entry-cache@npm:^9.1.0": + version: 9.1.0 + resolution: "file-entry-cache@npm:9.1.0" dependencies: flat-cache: ^5.0.0 - checksum: 850ab258497cfad2aff166319068101202d6969415227a425b9de9acdb152dc33506c7208906289a6dcb2a7f9390601f4b80ccf6353510c58710b75d5a02df6e + checksum: 9f2345505677fa83767c55aa3667c52b62c409bd6f2b5408999d635f1d8cc6ecab868f0a5fdfb2fadf64a0d2e92374c02ddd0c9eaea9651cfbcead56fd640099 languageName: node linkType: hard @@ -1890,10 +1902,10 @@ __metadata: resolution: "frontend@workspace:." dependencies: jasmine-browser-runner: ^2.5.0 - jasmine-core: ^5.3.0 + jasmine-core: ^5.4.0 nyc: ^17.1.0 standardx: ^7.0.0 - stylelint: ^16.9.0 + stylelint: ^16.10.0 stylelint-config-gds: ^2.0.0 languageName: unknown linkType: soft @@ -2232,10 +2244,10 @@ __metadata: languageName: node linkType: hard -"ignore@npm:^5.3.2": - version: 5.3.2 - resolution: "ignore@npm:5.3.2" - checksum: 2acfd32a573260ea522ea0bfeff880af426d68f6831f973129e2ba7363f422923cf53aab62f8369cbf4667c7b25b6f8a3761b34ecdb284ea18e87a5262a865be +"ignore@npm:^6.0.2": + version: 6.0.2 + resolution: "ignore@npm:6.0.2" + checksum: b5dfb811428a067d79c128144814d3d20f01ef21e19c2b2e5bc270895995ce352da9b0e1c46a33de7daaf214bf0cf59d3353c78cdf9e365aaea677db729c721e languageName: node linkType: hard @@ -2571,10 +2583,10 @@ __metadata: languageName: node linkType: hard -"jasmine-core@npm:^5.3.0": - version: 5.3.0 - resolution: "jasmine-core@npm:5.3.0" - checksum: 5dbb8c026b683d01872b793902b684ff9f8f097c94062666e13f466fa5a7b4a409670973868e5b9f5bbd47bf2e69bfbe037cc4c31f7cea0b78d45eb2a0b997fd +"jasmine-core@npm:^5.4.0": + version: 5.4.0 + resolution: "jasmine-core@npm:5.4.0" + checksum: 513bcae7b3659e46ea43f9187dd8a6b2a99db79af630e82e7918870b945ec1ba8aa4c53280be88ef2a516abe15181d53f19ede8b490196d4d81313359034840a languageName: node linkType: hard @@ -2893,10 +2905,10 @@ __metadata: languageName: node linkType: hard -"mdn-data@npm:2.0.30": - version: 2.0.30 - resolution: "mdn-data@npm:2.0.30" - checksum: d6ac5ac7439a1607df44b22738ecf83f48e66a0874e4482d6424a61c52da5cde5750f1d1229b6f5fa1b80a492be89465390da685b11f97d62b8adcc6e88189aa +"mdn-data@npm:2.10.0": + version: 2.10.0 + resolution: "mdn-data@npm:2.10.0" + checksum: cd0f32c2db0ecdac02867793efac7386e03a13f1f9c089356f34f5f99076eab394ad901543a84bf3c351ed3e96efd92d12c432a057b8a17da35a89c78c0a358d languageName: node linkType: hard @@ -3036,7 +3048,7 @@ __metadata: languageName: node linkType: hard -"ms@npm:2.1.3": +"ms@npm:2.1.3, ms@npm:^2.1.3": version: 2.1.3 resolution: "ms@npm:2.1.3" checksum: aa92de608021b242401676e35cfa5aa42dd70cbdc082b916da7fb925c542173e36bce97ea3e804923fe92c0ad991434e4a38327e15a1b5b5f945d66df615ae6d @@ -3455,6 +3467,13 @@ __metadata: languageName: node linkType: hard +"picocolors@npm:^1.1.0": + version: 1.1.0 + resolution: "picocolors@npm:1.1.0" + checksum: a64d653d3a188119ff45781dfcdaeedd7625583f45280aea33fcb032c7a0d3959f2368f9b192ad5e8aade75b74dbd954ffe3106c158509a45e4c18ab379a2acd + languageName: node + linkType: hard + "picomatch@npm:^2.3.1": version: 2.3.1 resolution: "picomatch@npm:2.3.1" @@ -3525,12 +3544,12 @@ __metadata: languageName: node linkType: hard -"postcss-safe-parser@npm:^7.0.0": - version: 7.0.0 - resolution: "postcss-safe-parser@npm:7.0.0" +"postcss-safe-parser@npm:^7.0.1": + version: 7.0.1 + resolution: "postcss-safe-parser@npm:7.0.1" peerDependencies: postcss: ^8.4.31 - checksum: dba4d782393e6f07339c24bdb8b41166e483d5e7b8f34174c35c64065aef36aadef94b53e0501d7a630d42f51bbd824671e8fb1c2b417333b08b71c9b0066c76 + checksum: 285f30877f3ef5d43586432394ef4fcab904cd5bcfff5c26f586eb630fbee490abf2ac6d81e64fa212fb64d03630d12c2f3c5196f5637bec5ba3d043562ddf30 languageName: node linkType: hard @@ -3570,14 +3589,14 @@ __metadata: languageName: node linkType: hard -"postcss@npm:^8.4.41": - version: 8.4.41 - resolution: "postcss@npm:8.4.41" +"postcss@npm:^8.4.47": + version: 8.4.47 + resolution: "postcss@npm:8.4.47" dependencies: nanoid: ^3.3.7 - picocolors: ^1.0.1 - source-map-js: ^1.2.0 - checksum: f865894929eb0f7fc2263811cc853c13b1c75103028b3f4f26df777e27b201f1abe21cb4aa4c2e901c80a04f6fb325ee22979688fe55a70e2ea82b0a517d3b6f + picocolors: ^1.1.0 + source-map-js: ^1.2.1 + checksum: f78440a9d8f97431dd2ab1ab8e1de64f12f3eff38a3d8d4a33919b96c381046a314658d2de213a5fa5eb296b656de76a3ec269fdea27f16d5ab465b916a0f52c languageName: node linkType: hard @@ -4063,10 +4082,10 @@ __metadata: languageName: node linkType: hard -"source-map-js@npm:^1.2.0": - version: 1.2.0 - resolution: "source-map-js@npm:1.2.0" - checksum: 791a43306d9223792e84293b00458bf102a8946e7188f3db0e4e22d8d530b5f80a4ce468eb5ec0bf585443ad55ebbd630bf379c98db0b1f317fd902500217f97 +"source-map-js@npm:^1.2.1": + version: 1.2.1 + resolution: "source-map-js@npm:1.2.1" + checksum: 4eb0cd997cdf228bc253bcaff9340afeb706176e64868ecd20efbe6efea931465f43955612346d6b7318789e5265bdc419bc7669c1cebe3db0eb255f57efa76b languageName: node linkType: hard @@ -4285,15 +4304,6 @@ __metadata: languageName: node linkType: hard -"strip-ansi@npm:^7.1.0": - version: 7.1.0 - resolution: "strip-ansi@npm:7.1.0" - dependencies: - ansi-regex: ^6.0.1 - checksum: 859c73fcf27869c22a4e4d8c6acfe690064659e84bef9458aa6d13719d09ca88dcfd40cbf31fd0be63518ea1a643fe070b4827d353e09533a5b0b9fd4553d64d - languageName: node - linkType: hard - "strip-bom@npm:^3.0.0": version: 3.0.0 resolution: "strip-bom@npm:3.0.0" @@ -4395,9 +4405,9 @@ __metadata: languageName: node linkType: hard -"stylelint@npm:^16.9.0": - version: 16.9.0 - resolution: "stylelint@npm:16.9.0" +"stylelint@npm:^16.10.0": + version: 16.10.0 + resolution: "stylelint@npm:16.10.0" dependencies: "@csstools/css-parser-algorithms": ^3.0.1 "@csstools/css-tokenizer": ^3.0.1 @@ -4407,17 +4417,17 @@ __metadata: balanced-match: ^2.0.0 colord: ^2.9.3 cosmiconfig: ^9.0.0 - css-functions-list: ^3.2.2 - css-tree: ^2.3.1 - debug: ^4.3.6 + css-functions-list: ^3.2.3 + css-tree: ^3.0.0 + debug: ^4.3.7 fast-glob: ^3.3.2 fastest-levenshtein: ^1.0.16 - file-entry-cache: ^9.0.0 + file-entry-cache: ^9.1.0 global-modules: ^2.0.0 globby: ^11.1.0 globjoin: ^0.1.4 html-tags: ^3.3.1 - ignore: ^5.3.2 + ignore: ^6.0.2 imurmurhash: ^0.1.4 is-plain-object: ^5.0.0 known-css-properties: ^0.34.0 @@ -4426,21 +4436,20 @@ __metadata: micromatch: ^4.0.8 normalize-path: ^3.0.0 picocolors: ^1.0.1 - postcss: ^8.4.41 + postcss: ^8.4.47 postcss-resolve-nested-selector: ^0.1.6 - postcss-safe-parser: ^7.0.0 + postcss-safe-parser: ^7.0.1 postcss-selector-parser: ^6.1.2 postcss-value-parser: ^4.2.0 resolve-from: ^5.0.0 string-width: ^4.2.3 - strip-ansi: ^7.1.0 supports-hyperlinks: ^3.1.0 svg-tags: ^1.0.0 table: ^6.8.2 write-file-atomic: ^5.0.1 bin: stylelint: bin/stylelint.mjs - checksum: c595eb76d75c9b44e710154c9df41476c96c606f2b232a52f527ffe935f0fd982302f233132107da14fd4c7de78b3d81fce7f9263f50704b8a8c176fc2b2a26e + checksum: a40702b60f541db05cc331f556cc27c08dfb5e29845327524f782c4d79f5d6bd1c93e28ddb1afbe6e40c5ce0ee8f118f6ec2580dae3985344e783c27126872e7 languageName: node linkType: hard