From 05f5d4fc0326b83693b0589f49c7426fe0b067a7 Mon Sep 17 00:00:00 2001 From: Jani Kraner Date: Wed, 11 Apr 2018 14:25:28 +0100 Subject: [PATCH 1/2] Rename captionSize table argument to captionClasses Also - update readme - update class provide to make the heading size smaller (and inline with Elements) - update tests --- src/table/README.md | 8 ++++---- src/table/index.njk | 4 ++-- src/table/table.yaml | 2 +- src/table/template.njk | 2 +- src/table/template.test.js | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/table/README.md b/src/table/README.md index d489ca503d..31c63a9448 100644 --- a/src/table/README.md +++ b/src/table/README.md @@ -225,7 +225,7 @@ Find out when to use the Table component in your service in the [GOV.UK Design S - + @@ -280,7 +280,7 @@ Find out when to use the Table component in your service in the [GOV.UK Design S {{ govukTable({ "caption": "Caption 1 : Months and rates", - "captionSize": "govuk-heading-l", + "captionClasses": "govuk-heading-m", "firstCellIsHeader": true, "head": [ { @@ -412,13 +412,13 @@ If you are using Nunjucks,then macros take the following arguments - + - + diff --git a/src/table/index.njk b/src/table/index.njk index bac0132301..ca5ae36900 100644 --- a/src/table/index.njk +++ b/src/table/index.njk @@ -67,7 +67,7 @@ ], [ { - text: 'captionSize' + text: 'captionClasses' }, { text: 'string' @@ -76,7 +76,7 @@ text: 'No' }, { - text: 'Optional caption text size. Class should correspond to the available heading classes.' + text: 'Optional classes for caption text size. Class should correspond to the available typography heading classes.' } ], [ diff --git a/src/table/table.yaml b/src/table/table.yaml index 5c03ac8f10..d3e0be5f93 100644 --- a/src/table/table.yaml +++ b/src/table/table.yaml @@ -50,7 +50,7 @@ examples: - name: table-with-caption-and-head data: caption: "Caption 1 : Months and rates" - captionSize: govuk-heading-l + captionClasses: govuk-heading-m firstCellIsHeader: true head: - text: Month you apply diff --git a/src/table/template.njk b/src/table/template.njk index 0ebaa98b5d..777a3e2fd4 100644 --- a/src/table/template.njk +++ b/src/table/template.njk @@ -2,7 +2,7 @@ {%- if params.classes %} {{ params.classes }}{% endif %}"{% for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}> {% if params.caption %} + {%- if params.captionClasses %} {{ params.captionClasses }}{% endif %}">{{ params.caption }} {% endif %} {% if params.head %} diff --git a/src/table/template.test.js b/src/table/template.test.js index a9884417c4..9964f08a43 100644 --- a/src/table/template.test.js +++ b/src/table/template.test.js @@ -54,7 +54,7 @@ describe('Table', () => { const $ = render('table', examples['table-with-caption-and-head']) const $caption = $('.govuk-c-table__caption') - expect($caption.hasClass('govuk-heading-l')).toBeTruthy() + expect($caption.hasClass('govuk-heading-m')).toBeTruthy() }) it('renders first cell in every row as a
Caption 1 : Months and ratesCaption 1 : Months and rates
captionSizecaptionClasses string NoOptional caption text size. Class should correspond to the available heading classes.Optional classes for caption text size. Class should correspond to the available typography heading classes.
{{ params.caption }}
element with correct `govuk-c-table__header` class and `scope=row` attribute', () => { From e3a4068813dbb1562b60cf58d79f48afde1235f1 Mon Sep 17 00:00:00 2001 From: Jani Kraner Date: Wed, 11 Apr 2018 14:27:48 +0100 Subject: [PATCH 2/2] Document in CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 22aa84d1fb..a12d056ca2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ Breaking changes: update it to reference the new variable $govuk-is-ie8 – see the README for details. (PR [#631](https://github.com/alphagov/govuk-frontend/pull/631)) +- Rename captionSize table argument to captionClasses ([PR #643](https://github.com/alphagov/govuk-frontend/pull/643)) Fixes: - Link styles, as well as links within the back-link, breadcrumbs, button,