Skip to content

Commit

Permalink
Merge pull request #284 from GSA/a11y-field-update
Browse files Browse the repository at this point in the history
Update field names for a11y data
  • Loading branch information
akuny authored Oct 25, 2023
2 parents 107e0ed + 9c53696 commit 9002228
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 24 deletions.
12 changes: 6 additions & 6 deletions entities/core-result.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,19 +373,19 @@ export class CoreResult {
accessibilityScanStatus?: string;

@Column({ nullable: true })
@Expose({ name: 'missing_img_alt_issues' })
@Expose({ name: 'a11y_missing_img_alt_issues' })
@Exclude()
missingImgAltIssues?: number;
a11yMissingImgAltIssues?: number;

@Column({ nullable: true })
@Expose({ name: 'html_attribute_issues' })
@Expose({ name: 'a11y_html_attribute_issues' })
@Exclude()
htmlAttributeIssues?: number;
a11yHtmlAttributeIssues?: number;

@Column({ nullable: true })
@Expose({ name: 'color_contrast_issues' })
@Expose({ name: 'a11y_color_contrast_issues' })
@Exclude()
colorContrastIssues?: number;
a11yColorContrastIssues?: number;

@Column({ nullable: true })
@Expose({ name: 'has_viewport_meta_el' })
Expand Down
6 changes: 3 additions & 3 deletions entities/scan-data.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ export type SearchScan = {
};

export type AccessibilityScan = {
missingImgAltIssues: number;
htmlAttributeIssues: number;
colorContrastIssues: number;
a11yMissingImgAltIssues: number;
a11yHtmlAttributeIssues: number;
a11yColorContrastIssues: number;
};

export type MobileScan = {
Expand Down
6 changes: 3 additions & 3 deletions libs/core-scanner/src/pages/accessibility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ async function buildAccessibilityResult(
throw new Error('html_codesniffer could not run');
} else {
return {
missingImgAltIssues: getIssueTotalByCategory(
a11yMissingImgAltIssues: getIssueTotalByCategory(
htmlcsResults,
'WCAG2AA.Principle1.Guideline1_1',
),
htmlAttributeIssues: getIssueTotalByCategory(
a11yHtmlAttributeIssues: getIssueTotalByCategory(
htmlcsResults,
'WCAG2AA.Principle4.Guideline4_1',
),
colorContrastIssues: getIssueTotalByCategory(
a11yColorContrastIssues: getIssueTotalByCategory(
htmlcsResults,
'WCAG2AA.Principle1.Guideline1_4',
),
Expand Down
6 changes: 3 additions & 3 deletions libs/database/src/core-results/core-result.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,9 @@ describe('CoreResultService', () => {
status: scanStatus,
result: {
accessibilityScan: {
missingImgAltIssues: 0,
htmlAttributeIssues: 0,
colorContrastIssues: 0,
a11yMissingImgAltIssues: 0,
a11yHtmlAttributeIssues: 0,
a11yColorContrastIssues: 0,
},
},
},
Expand Down
18 changes: 9 additions & 9 deletions libs/database/src/core-results/core-result.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,23 +310,23 @@ export class CoreResultService {
coreResult.accessibilityScanStatus = pages.accessibility.status;

if (pages.accessibility.status === ScanStatus.Completed) {
coreResult.missingImgAltIssues =
pages.accessibility.result.accessibilityScan.missingImgAltIssues;
coreResult.a11yMissingImgAltIssues =
pages.accessibility.result.accessibilityScan.a11yMissingImgAltIssues;

coreResult.htmlAttributeIssues =
pages.accessibility.result.accessibilityScan.htmlAttributeIssues;
coreResult.a11yHtmlAttributeIssues =
pages.accessibility.result.accessibilityScan.a11yHtmlAttributeIssues;

coreResult.colorContrastIssues =
pages.accessibility.result.accessibilityScan.colorContrastIssues;
coreResult.a11yColorContrastIssues =
pages.accessibility.result.accessibilityScan.a11yColorContrastIssues;
} else {
logger.error({
msg: pages.accessibility.error,
page: 'accessibility',
});

coreResult.missingImgAltIssues = null;
coreResult.htmlAttributeIssues = null;
coreResult.colorContrastIssues = null;
coreResult.a11yMissingImgAltIssues = null;
coreResult.a11yHtmlAttributeIssues = null;
coreResult.a11yColorContrastIssues = null;
}
}
}

0 comments on commit 9002228

Please sign in to comment.