Skip to content

Commit

Permalink
Merge pull request #643 from alphagov/rename-tablecaption-attribute
Browse files Browse the repository at this point in the history
Rename captionSize table argument to captionClasses
  • Loading branch information
Jani Kraner authored Apr 11, 2018
2 parents ecb589c + e3a4068 commit a2b8fc6
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions src/table/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ Find out when to use the Table component in your service in the [GOV.UK Design S

<table class="govuk-c-table">

<caption class="govuk-c-table__caption govuk-heading-l">Caption 1 : Months and rates</caption>
<caption class="govuk-c-table__caption govuk-heading-m">Caption 1 : Months and rates</caption>

<thead class="govuk-c-table__head">
<tr class="govuk-c-table__row">
Expand Down Expand Up @@ -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": [
{
Expand Down Expand Up @@ -412,13 +412,13 @@ If you are using Nunjucks,then macros take the following arguments

<tr class="govuk-c-table__row">

<th class="govuk-c-table__header" scope="row">captionSize</th>
<th class="govuk-c-table__header" scope="row">captionClasses</th>

<td class="govuk-c-table__cell ">string</td>

<td class="govuk-c-table__cell ">No</td>

<td class="govuk-c-table__cell ">Optional caption text size. Class should correspond to the available heading classes.</td>
<td class="govuk-c-table__cell ">Optional classes for caption text size. Class should correspond to the available typography heading classes.</td>

</tr>

Expand Down
4 changes: 2 additions & 2 deletions src/table/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
],
[
{
text: 'captionSize'
text: 'captionClasses'
},
{
text: 'string'
Expand All @@ -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.'
}
],
[
Expand Down
2 changes: 1 addition & 1 deletion src/table/table.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/table/template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{%- if params.classes %} {{ params.classes }}{% endif %}"{% for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
{% if params.caption %}
<caption class="govuk-c-table__caption
{%- if params.captionSize %} {{ params.captionSize }}{% endif %}">{{ params.caption }}</caption>
{%- if params.captionClasses %} {{ params.captionClasses }}{% endif %}">{{ params.caption }}</caption>
{% endif %}
{% if params.head %}
<thead class="govuk-c-table__head">
Expand Down
2 changes: 1 addition & 1 deletion src/table/template.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <th> element with correct `govuk-c-table__header` class and `scope=row` attribute', () => {
Expand Down

0 comments on commit a2b8fc6

Please sign in to comment.