From 87b0b1d4c91959c284bd53a2009a182dc9ef9b6e Mon Sep 17 00:00:00 2001 From: Jon Rohan Date: Fri, 8 Oct 2021 09:20:20 -0700 Subject: [PATCH] Removing the duplicate deprecation backgrounds (#1663) * Removing the duplicate deprecation backgrounds * Create thick-monkeys-film.md --- .changeset/thick-monkeys-film.md | 5 +++++ __tests__/css.test.js | 13 ++++++++++++- __tests__/utils/css.js | 9 +++++++++ docs/content/support/v18-migration.mdx | 2 -- src/deprecations.json | 2 -- 5 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 .changeset/thick-monkeys-film.md diff --git a/.changeset/thick-monkeys-film.md b/.changeset/thick-monkeys-film.md new file mode 100644 index 0000000000..b1af539288 --- /dev/null +++ b/.changeset/thick-monkeys-film.md @@ -0,0 +1,5 @@ +--- +"@primer/css": patch +--- + +Removing the duplicate deprecation backgrounds diff --git a/__tests__/css.test.js b/__tests__/css.test.js index 32c237ac75..15e682483b 100644 --- a/__tests__/css.test.js +++ b/__tests__/css.test.js @@ -2,7 +2,8 @@ import { getCurrentVersion, getPackageStats, getSelectorDiff, - getVariableDiff + getVariableDiff, + currentVersionDeprecations } from './utils/css' import semver from 'semver' @@ -20,3 +21,13 @@ describe('css', () => { expect(supportStats.size).toEqual(0) }) }) + +describe('deprecations', () => { + it('expects deprecations and their replacement to not be equal.', () => { + const deprecations = currentVersionDeprecations() + Object.keys(deprecations["selectors"]).forEach(deprecation => { + const replacement = deprecations["selectors"][deprecation] + expect(deprecation).not.toEqual(replacement) + }) + }) +}) diff --git a/__tests__/utils/css.js b/__tests__/utils/css.js index c3b443149d..c3a1cf79c7 100644 --- a/__tests__/utils/css.js +++ b/__tests__/utils/css.js @@ -38,6 +38,11 @@ export function getPackageStats(packageName) { return stats } +function getDeprecations(versionPath) { + const deprecations = JSON.parse(fs.readFileSync(join(versionPath, './deprecations.json'))) + return deprecations +} + function currentVersionSelectors() { return getSelectors(join(currentPath, './dist')) } @@ -46,6 +51,10 @@ function currentVersionVariables() { return getVariables(join(currentPath, './dist')) } +export function currentVersionDeprecations() { + return getDeprecations(join(currentPath, './dist')) +} + function lastVersionSelectors() { return getSelectors(join(lastPath, './dist')) } diff --git a/docs/content/support/v18-migration.mdx b/docs/content/support/v18-migration.mdx index bcb8a601ef..169851f7e6 100644 --- a/docs/content/support/v18-migration.mdx +++ b/docs/content/support/v18-migration.mdx @@ -64,9 +64,7 @@ See [color utility classes](/utilities/colors) for a list of all the functional | `.color-bg-tertiary` | `.color-bg-subtle` | | `.color-bg-info` | `.color-bg-accent` | | `.color-bg-info-inverse` | `.color-bg-accent-emphasis` | -| `.color-bg-danger` | `.color-bg-danger` | | `.color-bg-danger-inverse` | `.color-bg-danger-emphasis` | -| `.color-bg-success` | `.color-bg-success` | | `.color-bg-success-inverse` | `.color-bg-success-emphasis` | | `.color-bg-warning` | `.color-bg-attention` | | `.color-bg-warning-inverse` | `.color-bg-attention-emphasis` | diff --git a/src/deprecations.json b/src/deprecations.json index 78a7cfed0e..ffe797b895 100644 --- a/src/deprecations.json +++ b/src/deprecations.json @@ -30,9 +30,7 @@ "color-bg-tertiary": "color-bg-subtle", "color-bg-info": "color-bg-accent", "color-bg-info-inverse": "color-bg-accent-emphasis", - "color-bg-danger": "color-bg-danger", "color-bg-danger-inverse": "color-bg-danger-emphasis", - "color-bg-success": "color-bg-success", "color-bg-success-inverse": "color-bg-success-emphasis", "color-bg-warning": "color-bg-attention", "color-bg-warning-inverse": "color-bg-attention-emphasis",