Skip to content

Commit

Permalink
Remove tests for $govuk-font-family-tabular setting
Browse files Browse the repository at this point in the history
Additionally update tests that used $govuk-font-family-tabular as example data to use Helvetica instead.
  • Loading branch information
querkmachine authored and colinrotherham committed May 4, 2023
1 parent 5ab273d commit c119b7a
Showing 1 changed file with 2 additions and 77 deletions.
79 changes: 2 additions & 77 deletions src/govuk/helpers/typography.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('@mixin govuk-typography-common', () => {
@include govuk-typography-common;
}
:root {
@include govuk-typography-common($font-family: $govuk-font-family-tabular);
@include govuk-typography-common($font-family: Helvetica);
}
`

Expand Down Expand Up @@ -93,39 +93,6 @@ describe('@mixin govuk-typography-common', () => {
await expect(results).resolves.toMatchObject({
css: expect.not.stringContaining('font-family: "GDS Transport"')
})

await expect(results).resolves.toMatchObject({
css: expect.not.stringContaining('font-family: "ntatabularnumbers"')
})
})

it('should not output a @font-face declaration when the user wants compatibility with GOV.UK Template', async () => {
const sass = `
$govuk-compatibility-govuktemplate: true;
@import "settings/all";
@import "helpers/all";
:root {
@include govuk-typography-common;
}
:root {
@include govuk-typography-common($font-family: $govuk-font-family-tabular);
}
`

const results = compileSassString(sass)

await expect(results).resolves.toMatchObject({
css: expect.not.stringContaining('@font-face')
})

await expect(results).resolves.toMatchObject({
css: expect.stringContaining('font-family: "nta"')
})

await expect(results).resolves.toMatchObject({
css: expect.stringContaining('font-family: "ntatabularnumbers"')
})
})

it('should not output a @font-face declaration when the user has turned off this feature', async () => {
Expand All @@ -138,7 +105,7 @@ describe('@mixin govuk-typography-common', () => {
@include govuk-typography-common;
}
:root {
@include govuk-typography-common($font-family: $govuk-font-family-tabular);
@include govuk-typography-common($font-family: Helvetica);
}
`

Expand Down Expand Up @@ -593,27 +560,6 @@ describe('@mixin govuk-typography-responsive', () => {
})
})

it('uses the tabular font instead if defined and $tabular: true', async () => {
const sass = `
$govuk-font-family-tabular: "ntatabularnumbers";
${sassBootstrap}
.foo {
@include govuk-font($size: 14, $tabular: true)
}
`

const results = compileSassString(sass)

await expect(results).resolves.toMatchObject({
css: expect.stringContaining('font-family: "ntatabularnumbers"')
})

await expect(results).resolves.toMatchObject({
css: expect.not.stringContaining('font-feature-settings')
})
})

it('sets font-size based on $size', async () => {
const sass = `
${sassBootstrap}
Expand Down Expand Up @@ -713,24 +659,3 @@ describe('@mixin govuk-typography-responsive', () => {
})
})
})

describe('$govuk-font-family-tabular value is specified', () => {
it('outputs a deprecation warning when set', async () => {
const sass = `
$govuk-font-family-tabular: monospace;
${sassBootstrap}
`

await compileSassString(sass, sassConfig)

// Get the argument of the last @warn call, which we expect to be the
// deprecation notice
expect(mockWarnFunction.mock.calls.at(-1))
.toEqual(expect.arrayContaining([
'$govuk-font-family-tabular is deprecated. From version 5.0, ' +
'GOV.UK Frontend will not support using a separate font-face for ' +
'tabular numbers. To silence this warning, update ' +
'$govuk-suppressed-warnings with key: "tabular-font-face"'
]))
})
})

0 comments on commit c119b7a

Please sign in to comment.