Skip to content

Commit

Permalink
Merge pull request #145 from mhansma96/main
Browse files Browse the repository at this point in the history
#142 Potential fix for criteria mapping issue
  • Loading branch information
iadawn authored Jan 9, 2024
2 parents 6f1c224 + 631d801 commit cba701c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/components/form/EarlResult.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
// Get or create an Assertion
$: _assertion =
$assertions.find(($assertion) => {
const matchedTest = $assertion.test === test;
const matchedTest = $assertion.test.num === test.num;
const matchedSubject = $assertion.subject === subject;
return matchedTest && matchedSubject;
Expand Down
18 changes: 16 additions & 2 deletions src/components/pages/Evaluation/DefineScopePage.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -150,25 +150,39 @@
let assertionsToRemove = [];
$: {
// Get or create an Assertion
//$assertions = [];
const available = [];
$CriteriaSelected.forEach((criteria) => {
const check = criteria.num;
available.push(check);
subject = $subjects.find((subject) => {
return subject.type.indexOf(TestSubjectTypes.WEBSITE) >= 0;
});
test = $tests.find(($test) => {
return $test.num === check;
return $test.num === check && $test.id === "WCAG"+$scopeStore['WCAG_VERSION'].split('.').join("")+":"+criteria.id;
});
if(test != undefined){
$assertions.find(($assertion) => {
const matchedTest = $assertion.test === test;
const matchedTest = $assertion.test.num === test.num;
const matchedSubject = $assertion.subject === subject;
return matchedTest && matchedSubject;
}) || assertions.create({ subject, test });
}
});
$assertions.forEach(($assertion) => {
var updater = $tests.find(($test) => {
return $test.num === $assertion.test.num && $test.id.startsWith("WCAG"+$scopeStore['WCAG_VERSION'].split('.').join(""));
});
if(updater != undefined){
$assertion.test = updater;
}
});
assertionsToRemove = $assertions.filter((assertion) => {
return available.indexOf(assertion.test.num) == -1;
});
Expand Down
3 changes: 2 additions & 1 deletion src/components/ui/Report/ReportSummary.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
$: TRANSLATED = {
CRITERIA: $translateToObject('WCAG.SUCCESS_CRITERION')
};
$: resultsByCategory = $outcomeValues.reduce(function(final, outcomeValue){
let totalEvaluated = 0;
if($assertions.length == 0 && outcomeValue.id == "earl:untested"){
Expand Down Expand Up @@ -88,6 +88,7 @@
};
final.push(value);
}
return final;
}, []);
Expand Down
16 changes: 11 additions & 5 deletions src/stores/earl/testStore/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,18 @@ import { TestRequirement } from './models.js';
* @type {Array}
*/
const LATEST_WCAG_VERSION = WCAG_VERSIONS.slice(-1)[0];
console.log(LATEST_WCAG_VERSION);
console.log(wcagCriteriaDictionary);

var TempArr = [];
var sortedCrit = [];
for (var Key in wcagCriteriaDictionary){
TempArr.push(Key);
}
for (var i = TempArr.length-1; i >= 0; i--){
sortedCrit[TempArr[i]] = wcagCriteriaDictionary[TempArr[i]];
}

let initialTestStore = [];
for (const property in wcagCriteriaDictionary) {
console.log(property);
let temp = wcagCriteriaDictionary[property].map(
(criterion) => {
const newTest = new TestRequirement(criterion);
Expand All @@ -30,10 +37,9 @@ for (const property in wcagCriteriaDictionary) {
});

temp.forEach((t) => {
initialTestStore.push(t);
initialTestStore.push(t);
});
}
console.log(initialTestStore);

/**
* $tests
Expand Down

0 comments on commit cba701c

Please sign in to comment.