diff options
| author | HJ <30-hj@users.noreply.git.pleroma.social> | 2020-02-18 21:20:43 +0000 |
|---|---|---|
| committer | HJ <30-hj@users.noreply.git.pleroma.social> | 2020-02-18 21:20:43 +0000 |
| commit | 3ddf7ebe2c94f88be12644d7a7a675f6f8331707 (patch) | |
| tree | 878e90d5381ce14f9c3d88ab77e998ef6238760d /test/unit/specs/services/theme_data/sanity_checks.spec.js | |
| parent | 26e455bb4cadb90b4351f2a2e8f53eaa15d9e569 (diff) | |
| parent | 32902e01f80a2ff27e9f4fc5a922c47b63f397fd (diff) | |
Merge branch 'themes-accent' into 'develop'
Themes v3 Part 1 "2.1" codenamed "One step for themes, a giant burder for code reviewers"
Closes #750 and #774
See merge request pleroma/pleroma-fe!1037
Diffstat (limited to 'test/unit/specs/services/theme_data/sanity_checks.spec.js')
| -rw-r--r-- | test/unit/specs/services/theme_data/sanity_checks.spec.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/unit/specs/services/theme_data/sanity_checks.spec.js b/test/unit/specs/services/theme_data/sanity_checks.spec.js new file mode 100644 index 00000000..f0072e7d --- /dev/null +++ b/test/unit/specs/services/theme_data/sanity_checks.spec.js @@ -0,0 +1,28 @@ +import { getColors } from 'src/services/theme_data/theme_data.service.js' + +const checkColors = (output) => { + expect(output).to.have.property('colors') + Object.entries(output.colors).forEach(([key, v]) => { + expect(v, key).to.be.an('object') + expect(v, key).to.include.all.keys('r', 'g', 'b') + 'rgba'.split('').forEach(k => { + if ((k === 'a' && v.hasOwnProperty('a')) || k !== 'a') { + expect(v[k], key + '.' + k).to.be.a('number') + expect(v[k], key + '.' + k).to.be.least(0) + expect(v[k], key + '.' + k).to.be.most(k === 'a' ? 1 : 255) + } + }) + }) +} + +describe('Theme Data utility functions', () => { + const context = require.context('static/themes/', false, /\.json$/) + context.keys().forEach((key) => { + it(`Should render all colors for ${key} properly`, () => { + const { theme, source } = context(key) + const data = source || theme + const colors = getColors(data.colors, data.opacity, 1) + checkColors(colors) + }) + }) +}) |
