Skip to content

Commit

Permalink
Remove comments and test compiled CSS (#77)
Browse files Browse the repository at this point in the history
* Remove comments

* Remove comments

* Extendable light and dark mixins

* Add CSS tests
  • Loading branch information
ahosgood authored Jan 26, 2024
1 parent 3f8efc6 commit 98e2e1c
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 18 deletions.
1 change: 0 additions & 1 deletion src/nationalarchives/components/card/card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
11 changes: 0 additions & 11 deletions src/nationalarchives/components/hero/hero.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion src/nationalarchives/utilities/_forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
&--xs {
font-size: 1em;
@include typography.main-font;
// @include typography.main-font-weight-bold;
}
}

Expand Down
3 changes: 0 additions & 3 deletions src/nationalarchives/utilities/_lists.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
1 change: 0 additions & 1 deletion src/nationalarchives/variables/_colour.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
21 changes: 20 additions & 1 deletion tasks/test-package.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,4 +247,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");
}
});

0 comments on commit 98e2e1c

Please sign in to comment.