mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ACS-7338] Fix search input formatting for asterisk (#9459)
* fix: double asterisk formatting for search input * fix: double asterisk formatting for search input * fix: double asterisk formatting for search input
This commit is contained in:
@@ -84,6 +84,15 @@ describe('SearchInputComponent', () => {
|
||||
expect(formatted).toBe('(cm:name:"test*")');
|
||||
});
|
||||
|
||||
it('should not append asterisk if one is already provided', async () => {
|
||||
let formatted = '';
|
||||
component.changed.subscribe((val) => (formatted = val));
|
||||
|
||||
await setInputValue('*');
|
||||
|
||||
expect(formatted).toBe('(cm:name:"*")');
|
||||
});
|
||||
|
||||
it('should format with AND by default', async () => {
|
||||
let formatted = '';
|
||||
component.changed.subscribe((val) => (formatted = val));
|
||||
|
@@ -100,6 +100,11 @@ export class SearchInputComponent {
|
||||
term = term.substring(1);
|
||||
}
|
||||
|
||||
if (term === '*') {
|
||||
prefix = '';
|
||||
suffix = '';
|
||||
}
|
||||
|
||||
return '(' + fields.map((field) => `${prefix}${field}:"${term}${suffix}"`).join(' OR ') + ')';
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user