Aktualisiere Version auf 1.1.0, füge Unterstützung für verwaltete Metadatenkategorien hinzu und verbessere die Filterung in der Accordion-Komponente
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import { getAccordionCategoryValues } from '../src/webparts/accordion/AccordionCategoryValues';
|
||||
|
||||
let passed: number = 0;
|
||||
function assertValues(actual: string[], expected: string[], message: string): void {
|
||||
if (actual.join('|') !== expected.join('|')) {
|
||||
throw new Error(message + ': ' + actual.join('|'));
|
||||
}
|
||||
passed++;
|
||||
}
|
||||
|
||||
const firstGuid: string = '11111111-1111-1111-1111-111111111111';
|
||||
const secondGuid: string = '22222222-2222-2222-2222-222222222222';
|
||||
|
||||
assertValues(getAccordionCategoryValues({ Label: 'Human Resources', TermGuid: firstGuid }),
|
||||
['Human Resources'], 'Single taxonomy value was not parsed.');
|
||||
assertValues(getAccordionCategoryValues({ results: [
|
||||
{ Label: 'Policies', TermGuid: firstGuid },
|
||||
{ Label: 'Benefits', TermGuid: secondGuid }
|
||||
] }), ['Policies', 'Benefits'], 'Multi-value taxonomy collection was not parsed.');
|
||||
assertValues(getAccordionCategoryValues('-1;#Policies|' + firstGuid + ';#-1;#Benefits|' + secondGuid),
|
||||
['Policies', 'Benefits'], 'Serialized SharePoint taxonomy value was not parsed.');
|
||||
assertValues(getAccordionCategoryValues('Policies|' + firstGuid + ';Benefits|' + secondGuid),
|
||||
['Policies', 'Benefits'], 'Compact serialized taxonomy value was not parsed.');
|
||||
assertValues(getAccordionCategoryValues({ results: ['General', 'General', 'News'] }),
|
||||
['General', 'News'], 'Choice values were not retained and de-duplicated.');
|
||||
|
||||
console.log('Accordion category value tests passed:', passed);
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "../temp/tests",
|
||||
"rootDir": "..",
|
||||
"lib": ["es5", "dom"],
|
||||
"types": [],
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"files": [
|
||||
"../src/webparts/accordion/AccordionCategoryValues.ts",
|
||||
"AccordionCategoryValues.test.ts"
|
||||
]
|
||||
}
|
||||
@@ -18,8 +18,8 @@ var component = read('src/webparts/accordion/components/Accordion.tsx');
|
||||
var sanitizer = read('src/webparts/accordion/AccordionHtmlSanitizer.ts');
|
||||
var styles = read('src/webparts/accordion/components/Accordion.module.scss');
|
||||
|
||||
assert(packageJson.version === '1.0.0', 'Package version must be 1.0.0.');
|
||||
assert(solution.version === '1.0.0.0', 'Solution version must be 1.0.0.0.');
|
||||
assert(packageJson.version === '1.1.0', 'Package version must be 1.1.0.');
|
||||
assert(solution.version === '1.1.0.0', 'Solution version must be 1.1.0.0.');
|
||||
assert(solution.includeClientSideAssets === true, 'Client-side assets must be included.');
|
||||
assert(solution.skipFeatureDeployment === true, 'Solution must support central deployment.');
|
||||
assert(packageJson.name === 'accordion-web-part' && solution.name === 'accordion-web-part' &&
|
||||
@@ -34,6 +34,15 @@ assert(webPart.indexOf("PropertyPaneDropdown('categoryField'") >= 0, 'Category f
|
||||
assert(webPart.indexOf("PropertyPaneDropdown('selectedCategory'") >= 0, 'Category value filter is missing.');
|
||||
assert(read('src/webparts/accordion/AccordionDataService.ts').indexOf('getCategoryValues') >= 0,
|
||||
'Dynamic category values are missing.');
|
||||
var dataService = read('src/webparts/accordion/AccordionDataService.ts');
|
||||
var categoryValues = read('src/webparts/accordion/AccordionCategoryValues.ts');
|
||||
assert(dataService.indexOf("'TaxonomyFieldType'") >= 0 &&
|
||||
dataService.indexOf("'TaxonomyFieldTypeMulti'") >= 0 &&
|
||||
dataService.indexOf('getAccordionCategoryValues') >= 0 &&
|
||||
categoryValues.indexOf('entry.Label') >= 0 && categoryValues.indexOf("candidate.indexOf(';#')") >= 0,
|
||||
'Managed Metadata category support is missing.');
|
||||
assert(component.indexOf('items[i].categories') >= 0 && component.indexOf('nameIndex') >= 0,
|
||||
'Multi-value category grouping is missing.');
|
||||
assert(component.indexOf("aria-expanded={open}") >= 0 && component.indexOf("role='region'") >= 0,
|
||||
'Accessible accordion semantics are missing.');
|
||||
assert(component.indexOf('sanitizeAccordionHtml(item.content)') >= 0, 'Rich text is not sanitized before rendering.');
|
||||
|
||||
Reference in New Issue
Block a user