diff --git a/src/components/form/EarlResult.svelte b/src/components/form/EarlResult.svelte index 21661958..f9f5e9c2 100644 --- a/src/components/form/EarlResult.svelte +++ b/src/components/form/EarlResult.svelte @@ -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; diff --git a/src/components/pages/Evaluation/DefineScopePage.svelte b/src/components/pages/Evaluation/DefineScopePage.svelte index fe3b2053..ae5175c8 100644 --- a/src/components/pages/Evaluation/DefineScopePage.svelte +++ b/src/components/pages/Evaluation/DefineScopePage.svelte @@ -150,6 +150,7 @@ let assertionsToRemove = []; $: { // Get or create an Assertion + //$assertions = []; const available = []; $CriteriaSelected.forEach((criteria) => { const check = criteria.num; @@ -157,18 +158,31 @@ 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; }); diff --git a/src/components/ui/Report/ReportSummary.svelte b/src/components/ui/Report/ReportSummary.svelte index 9f1fd8df..edb2245c 100644 --- a/src/components/ui/Report/ReportSummary.svelte +++ b/src/components/ui/Report/ReportSummary.svelte @@ -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"){ @@ -88,6 +88,7 @@ }; final.push(value); } + return final; }, []); diff --git a/src/stores/earl/testStore/index.js b/src/stores/earl/testStore/index.js index 4cdbf371..53b1bf58 100644 --- a/src/stores/earl/testStore/index.js +++ b/src/stores/earl/testStore/index.js @@ -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); @@ -30,10 +37,9 @@ for (const property in wcagCriteriaDictionary) { }); temp.forEach((t) => { - initialTestStore.push(t); + initialTestStore.push(t); }); } -console.log(initialTestStore); /** * $tests