Skip to content

Commit

Permalink
Merge pull request #362 from alphagov/heading-level-h2
Browse files Browse the repository at this point in the history
Use h2 as the default for `heading` component
  • Loading branch information
tijmenb authored Jun 7, 2018
2 parents 1bbb11a + e3f9eb1 commit 0494db1
Showing 3 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -3,6 +3,8 @@ description: A text heading
body: |
A versatile heading tag component, including options for different heading levels and font sizes.
This is a `h2` by default.
Real world examples:
- [Publication](/government/publications/recognising-the-terrorist-threat)
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ class HeadingHelper
attr_reader :heading_tag, :id, :classes

def initialize(options)
@heading_tag = "h1"
@heading_tag = "h2"
@heading_tag = "h#{options[:heading_level]}" if [1, 2, 3, 4, 5, 6].include? options[:heading_level]
@id = options[:id]

2 changes: 1 addition & 1 deletion spec/components/heading_spec.rb
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ def component_name

it "renders a heading correctly" do
render_component(text: 'Download documents')
assert_select "h1.gem-c-heading", text: 'Download documents'
assert_select "h2.gem-c-heading", text: 'Download documents'
end

it "renders a different heading level" do

0 comments on commit 0494db1

Please sign in to comment.