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);
|
||||
Reference in New Issue
Block a user