Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinigami92 committed Mar 7, 2023
1 parent 295eb65 commit a63eebd
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 67 deletions.
10 changes: 0 additions & 10 deletions src/definitions/color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,4 @@ export type ColorDefinitions = LocaleEntry<{
* Color space names.
*/
space: string[];

/**
* Functions supported by CSS to produce color.
*/
css_function: string[];

/**
* Color space names supported by CSS.
*/
css_space: string[];
}>;
11 changes: 0 additions & 11 deletions src/locales/global/color/css_function.ts

This file was deleted.

8 changes: 0 additions & 8 deletions src/locales/global/color/css_space.ts

This file was deleted.

14 changes: 0 additions & 14 deletions src/locales/global/color/index.ts

This file was deleted.

2 changes: 0 additions & 2 deletions src/locales/global/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
* Run 'pnpm run generate:locales' to update.
*/
import type { LocaleDefinition } from '../..';
import color from './color';
import internet from './internet';

const global: LocaleDefinition = {
title: 'Global',
color,
internet,
};

Expand Down
54 changes: 32 additions & 22 deletions src/modules/color/index.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,35 @@
import type { Faker } from '../../faker';

export type CSSFunction =
| 'color'
| 'rgb'
| 'rgba'
| 'hsl'
| 'hsla'
| 'hwb'
| 'cmyk'
| 'lab'
| 'lch';
export type CSSSpace =
| 'sRGB'
| 'display-p3'
| 'rec2020'
| 'a98-rgb'
| 'prophoto-rgb';
// TODO christopher 2023-01-27: Convert these CSS_SPACES and CSS_FUNCTIONS to Enums like SexType (https://github.com/faker-js/faker/pull/1748/files#r1072807325)

/**
* Color space names supported by CSS.
*/
export const CSS_SPACES = [
'sRGB',
'display-p3',
'rec2020',
'a98-rgb',
'prophoto-rgb',
] as const;

/**
* Functions supported by CSS to produce color.
*/
export const CSS_FUNCTIONS = [
'rgb',
'rgba',
'hsl',
'hsla',
'hwb',
'cmyk',
'lab',
'lch',
'color',
] as const;

export type CSSFunction = (typeof CSS_FUNCTIONS)[number];
export type CSSSpace = (typeof CSS_SPACES)[number];
export type StringColorFormat = 'css' | 'binary';
export type NumberColorFormat = 'decimal';
export type ColorFormat = StringColorFormat | NumberColorFormat;
Expand Down Expand Up @@ -192,9 +206,7 @@ export class ColorModule {
* @since 7.0.0
*/
cssSupportedFunction(): string {
return this.faker.helpers.arrayElement(
this.faker.definitions.color.css_function
);
return this.faker.helpers.arrayElement(CSS_FUNCTIONS);
}

/**
Expand All @@ -206,9 +218,7 @@ export class ColorModule {
* @since 7.0.0
*/
cssSupportedSpace(): string {
return this.faker.helpers.arrayElement(
this.faker.definitions.color.css_space
);
return this.faker.helpers.arrayElement(CSS_SPACES);
}

/**
Expand Down

0 comments on commit a63eebd

Please sign in to comment.