Skip to content

Commit

Permalink
Search custom fields
Browse files Browse the repository at this point in the history
  • Loading branch information
rosano committed Nov 26, 2023
1 parent 03dd4e3 commit c6ca2ef
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions os-app/sub-browse/ui-logic-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,26 @@ describe('EMLBrowseIsMatch', function test_EMLBrowseIsMatch() {
}, uRandomElement('alf', 'alfa', 'ALF')), true);
});

context('custom field', function () {

it('returns false if no match', function() {
deepEqual(mod.EMLBrowseIsMatch({
EMLMemoCustomData: {
[Math.random().toString()]: Math.random().toString(),
},
}, Math.random().toString()), false);
});

it('matches OLSKStringMatch', function() {
deepEqual(mod.EMLBrowseIsMatch({
EMLMemoCustomData: {
[Math.random().toString()]: uRandomElement('alfa', 'álfa'),
},
}, uRandomElement('alf', 'alfa', 'ALF')), true);
});

});

});

describe('EMLBrowseExactSortFunction', function test_EMLBrowseExactSortFunction() {
Expand Down
2 changes: 1 addition & 1 deletion os-app/sub-browse/ui-logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const mod = {
throw new Error('EMLErrorInputNotValid');
}

return [param1.EMLMemoNotes].filter(function (e) {
return [param1.EMLMemoNotes].concat(Object.values(param1.EMLMemoCustomData || {})).filter(function (e) {
if (!e) {
return false;
}
Expand Down

0 comments on commit c6ca2ef

Please sign in to comment.