mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-10-08 14:51:32 +00:00
[ADF-2914] support for number range patterns (#3282)
* support for number range patterns * fix memory leak for tag actions
This commit is contained in:
committed by
Eugenio Romano
parent
f63614e964
commit
3a3acd23ff
@@ -85,4 +85,43 @@ describe('SearchNumberRangeComponent', () => {
|
||||
expect(context.update).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should fetch format from the settings', () => {
|
||||
component.settings = {
|
||||
field: 'cm:content.size',
|
||||
format: '<{FROM} TO {TO}>'
|
||||
};
|
||||
component.ngOnInit();
|
||||
|
||||
expect(component.field).toEqual('cm:content.size');
|
||||
expect(component.format).toEqual('<{FROM} TO {TO}>');
|
||||
});
|
||||
|
||||
it('should use default format if not provided', () => {
|
||||
component.settings = {
|
||||
field: 'cm:content.size'
|
||||
};
|
||||
component.ngOnInit();
|
||||
|
||||
expect(component.field).toEqual('cm:content.size');
|
||||
expect(component.format).toEqual('[{FROM} TO {TO}]');
|
||||
});
|
||||
|
||||
it('should format value based on the current pattern', () => {
|
||||
const context: any = {
|
||||
queryFragments: {},
|
||||
update() {}
|
||||
};
|
||||
|
||||
component.id = 'range1';
|
||||
component.settings = {
|
||||
field: 'cm:content.size',
|
||||
format: '<{FROM} TO {TO}>'
|
||||
};
|
||||
component.context = context;
|
||||
component.ngOnInit();
|
||||
|
||||
component.apply({ from: '0', to: '100' }, true);
|
||||
expect(context.queryFragments['range1']).toEqual('cm:content.size:<0 TO 100>');
|
||||
});
|
||||
|
||||
});
|
||||
|
Reference in New Issue
Block a user