From b1f6ce5cf414e508819b699dfe98c4e7ecd00fce Mon Sep 17 00:00:00 2001 From: Andrew Hosgood Date: Mon, 8 Jan 2024 14:26:56 +0000 Subject: [PATCH 1/4] Remove comments --- src/nationalarchives/components/card/card.scss | 1 - src/nationalarchives/components/hero/hero.scss | 11 ----------- src/nationalarchives/utilities/_forms.scss | 1 - src/nationalarchives/utilities/_lists.scss | 3 --- src/nationalarchives/variables/_colour.scss | 1 - 5 files changed, 17 deletions(-) diff --git a/src/nationalarchives/components/card/card.scss b/src/nationalarchives/components/card/card.scss index 645d2051..9ae3187b 100644 --- a/src/nationalarchives/components/card/card.scss +++ b/src/nationalarchives/components/card/card.scss @@ -27,7 +27,6 @@ &__image-container { height: 0; margin-bottom: 1rem; - // padding-bottom: #{math.div(9, 16) * 100%}; padding-bottom: #{math.div(2, 3) * 100%}; position: relative; diff --git a/src/nationalarchives/components/hero/hero.scss b/src/nationalarchives/components/hero/hero.scss index 3b52f49d..a29c9b26 100644 --- a/src/nationalarchives/components/hero/hero.scss +++ b/src/nationalarchives/components/hero/hero.scss @@ -162,9 +162,6 @@ } &--tint .tna-hero__figure { - // @include colour.colour-border("keyline-dark", 1px, solid, top); - // @include colour.colour-border("keyline-dark", 1px, solid, bottom); - &::before, &::after { position: absolute; @@ -193,14 +190,6 @@ .tna-hero__image { filter: grayscale(1) contrast(1.75) brightness(1.2); } - - .tna-hero__content-inner { - // @include colour.colour-border("keyline-dark", 1px); - - @include media.on-mobile { - // border: none; - } - } } @include media.on-mobile { diff --git a/src/nationalarchives/utilities/_forms.scss b/src/nationalarchives/utilities/_forms.scss index c321b1ab..ea7587be 100644 --- a/src/nationalarchives/utilities/_forms.scss +++ b/src/nationalarchives/utilities/_forms.scss @@ -71,7 +71,6 @@ &--xs { font-size: 1em; @include typography.main-font; - // @include typography.main-font-weight-bold; } } diff --git a/src/nationalarchives/utilities/_lists.scss b/src/nationalarchives/utilities/_lists.scss index efff54c6..20cc9121 100644 --- a/src/nationalarchives/utilities/_lists.scss +++ b/src/nationalarchives/utilities/_lists.scss @@ -94,15 +94,12 @@ &--plain { dt { padding-top: 0; - // padding-bottom: 0; padding-left: 0; } dd { - // margin-bottom: 0.5rem; padding-top: 0; padding-right: 0; - // padding-bottom: 0; } } diff --git a/src/nationalarchives/variables/_colour.scss b/src/nationalarchives/variables/_colour.scss index e9a90817..80be6415 100644 --- a/src/nationalarchives/variables/_colour.scss +++ b/src/nationalarchives/variables/_colour.scss @@ -123,7 +123,6 @@ $colour-palette-dark: map.merge( "contrast-background": #111, "contrast-link-visited": map.get($colour-palette-default, "contrast-link-visited"), - // "accent-background-light": brand-colour("light-grey"), ) ) !default; From 5ace86f3eadd37eaeb34f83fe99010f74572c38a Mon Sep 17 00:00:00 2001 From: Andrew Hosgood Date: Mon, 8 Jan 2024 14:27:02 +0000 Subject: [PATCH 2/4] Remove comments --- .storybook/viewports.js | 1 - 1 file changed, 1 deletion(-) diff --git a/.storybook/viewports.js b/.storybook/viewports.js index e55285c0..7fab47c8 100644 --- a/.storybook/viewports.js +++ b/.storybook/viewports.js @@ -1,5 +1,4 @@ export const customViewports = { - // ...MINIMAL_VIEWPORTS, medium: { name: "Medium device", styles: { From d4158491e768813108e6d99d5f9d0dc063dd90e8 Mon Sep 17 00:00:00 2001 From: Andrew Hosgood Date: Mon, 8 Jan 2024 14:27:17 +0000 Subject: [PATCH 3/4] Extendable light and dark mixins --- src/nationalarchives/tools/_colour.scss | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/nationalarchives/tools/_colour.scss b/src/nationalarchives/tools/_colour.scss index 2407a6e7..c33a3968 100644 --- a/src/nationalarchives/tools/_colour.scss +++ b/src/nationalarchives/tools/_colour.scss @@ -190,7 +190,7 @@ @extend %plain; } -@mixin light { +%light { @include colour-css-vars; @media (prefers-contrast: more) { @@ -198,7 +198,11 @@ } } -@mixin dark { +@mixin light { + @extend %light; +} + +%dark { @include colour-css-vars-dark; @media (prefers-contrast: more) { @@ -206,6 +210,10 @@ } } +@mixin dark { + @extend %dark; +} + %contrast { --background: var(--contrast-background); --font-base: var(--contrast-font-base); From cbee94ea9d8b5d3300d185e8ff18901dfe138205 Mon Sep 17 00:00:00 2001 From: Andrew Hosgood Date: Mon, 8 Jan 2024 14:27:24 +0000 Subject: [PATCH 4/4] Add CSS tests --- tasks/test-package.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/tasks/test-package.js b/tasks/test-package.js index 2f9005fd..f37a46d4 100644 --- a/tasks/test-package.js +++ b/tasks/test-package.js @@ -232,4 +232,23 @@ Object.keys(componentsWithJavaScript).forEach((component) => { console.log("\n"); -// TODO: Test CSS for contents +console.log(`Testing compiled CSS files`); +const cssAllPackage = fs + .readFileSync("package/nationalarchives/all.css") + .toString(); +const checkForClasses = ["tna-template", "tna-template__body"]; +checkForClasses.forEach((cssClass) => { + const escapedClass = cssClass.replace("-", "\\-"); + const regExp = cssAllPackage.match(new RegExp(`.${escapedClass}\{`, "g")); + if (regExp) { + pass( + `${cssClass.replace(/`{$/, "")} selector occurs ${regExp.length} time${ + regExp.length === 1 ? "" : "s" + } in compiled CSS`, + ); + } else { + fail(`${cssClass.replace(/`{$/, "")} selector missing from compiled CSS`); + process.exitCode = 1; + throw new Error("CSS test failed"); + } +});