Skip to content

Commit

Permalink
fix: typo (#2654)
Browse files Browse the repository at this point in the history
## Proposed change
- Rename option `dictionnary` into `dictionary`
- Rename `ConstrastPipe` and `AccessibilityConstrastScorePipe`,
respectively into `ContrastPipe` and `AccessibilityContrastScorePipe`

## Related issues

*- No issue associated -*
  • Loading branch information
matthieu-crouzet authored Jan 6, 2025
2 parents 595d12f + e17f57b commit cdf109c
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class HexColorPipe implements PipeTransform {
name: 'contrast',
standalone: true
})
export class ConstrastPipe implements PipeTransform {
export class ContrastPipe implements PipeTransform {
public transform(color: string) {
return getBestColorContrast(color);
}
Expand All @@ -43,10 +43,10 @@ export class ConstrastPipe implements PipeTransform {
* Compute accessibility score for color contrast
*/
@Pipe({
name: 'accessibilityConstrastScore',
name: 'accessibilityContrastScore',
standalone: true
})
export class AccessibilityConstrastScorePipe implements PipeTransform {
export class AccessibilityContrastScorePipe implements PipeTransform {
public transform(color1: string, color2: string, textSize: 'small' | 'large') {
return getAccessibilityContrastScore(color1, color2, textSize);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ import {
getPaletteColors,
} from './color.helpers';
import {
AccessibilityConstrastScorePipe,
ConstrastPipe,
AccessibilityContrastScorePipe,
ContrastPipe,
HexColorPipe,
} from './color.pipe';
import {
Expand Down Expand Up @@ -112,8 +112,8 @@ export interface VariableGroup {
ReactiveFormsModule,
FormsModule,
HexColorPipe,
ConstrastPipe,
AccessibilityConstrastScorePipe,
ContrastPipe,
AccessibilityContrastScorePipe,
NgbTypeaheadModule,
VariableLabelPipe,
DfTooltipModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ <h3 ngbAccordionHeader>
</label>
<span class="my-auto">{{ resolvedColor }}</span>
<span class="ms-auto my-auto">
<span ngbTooltip="Accessibility score for small text" [style.fontSize]="'12px'" class="me-2">{{ resolvedColor | accessibilityConstrastScore : (resolvedColor | contrast) : 'small' }}</span>
<span ngbTooltip="Accessibility score for large text" [style.fontSize]="'24px'">{{ resolvedColor | accessibilityConstrastScore : (resolvedColor | contrast) : 'large' }}</span>
<span ngbTooltip="Accessibility score for small text" [style.fontSize]="'12px'" class="me-2">{{ resolvedColor | accessibilityContrastScore : (resolvedColor | contrast) : 'small' }}</span>
<span ngbTooltip="Accessibility score for large text" [style.fontSize]="'24px'">{{ resolvedColor | accessibilityContrastScore : (resolvedColor | contrast) : 'large' }}</span>
</span>
</li>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ describe('Add Localization', () => {
key: 'dummyLoc1',
description: 'Dummy 1 description',
value: 'Dummy 1',
dictionnary: false
dictionary: false
}), initialTree, { interactive: false }))).rejects.toThrow();
});

Expand All @@ -201,7 +201,7 @@ describe('Add Localization', () => {
key: 'dummyLoc1',
description: 'Dummy 1 description',
value: 'Dummy 1',
dictionnary: false
dictionary: false
}, initialTree);

expect(spy).toHaveBeenCalledWith('convert-component', expect.anything(), expect.anything());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ export function ngAddLocalizationKeyFn(options: NgAddLocalizationKeySchematicsSc

const updateLocalizationFileRule: Rule = () => {
(localizationJson as any)[properties.keyValue] = {
...(properties.dictionnary
...(properties.dictionary
? {
dictionnary: true
dictionary: true
}
: {
defaultValue: properties.defaultValue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@
"description": "Default value of the localization",
"default": ""
},
"dictionnary": {
"dictionary": {
"type": "boolean",
"description": "Is a dictionnary key",
"default": false
"description": "Is a dictionary key (the alias dictionnary will be removed in v13)",
"default": false,
"alias": "dictionnary"
},
"updateTemplate": {
"type": "boolean",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export interface NgAddLocalizationKeySchematicsSchema extends SchematicOptionObj
/** Default value of the localization */
value: string;

/** Is a dictionnary key */
dictionnary: boolean;
/** Is a dictionary key */
dictionary: boolean;

/** Update the template by replacing matching value by the localization key */
updateTemplate?: boolean | undefined;
Expand Down
2 changes: 1 addition & 1 deletion packages/@o3r/schematics/src/utility/ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ export const addInterfaceToClassTransformerFactory = (
/**
* Add comment on class properties
* @param classElements
* @param comments Dictionnary of comment indexed by properties' name
* @param comments Dictionary of comment indexed by properties' name
*/
export const addCommentsOnClassProperties = (
classElements: ts.ClassElement[],
Expand Down

0 comments on commit cdf109c

Please sign in to comment.