Skip to content

Commit

Permalink
Removing the duplicate deprecation backgrounds (#1663)
Browse files Browse the repository at this point in the history
* Removing the duplicate deprecation backgrounds

* Create thick-monkeys-film.md
  • Loading branch information
jonrohan authored Oct 8, 2021
1 parent 0cc2512 commit 87b0b1d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/thick-monkeys-film.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/css": patch
---

Removing the duplicate deprecation backgrounds
13 changes: 12 additions & 1 deletion __tests__/css.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import {
getCurrentVersion,
getPackageStats,
getSelectorDiff,
getVariableDiff
getVariableDiff,
currentVersionDeprecations
} from './utils/css'
import semver from 'semver'

Expand All @@ -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)
})
})
})
9 changes: 9 additions & 0 deletions __tests__/utils/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
}
Expand All @@ -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'))
}
Expand Down
2 changes: 0 additions & 2 deletions docs/content/support/v18-migration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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` |
Expand Down
2 changes: 0 additions & 2 deletions src/deprecations.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 87b0b1d

Please sign in to comment.