Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/js/widgets/preferences/templates/application.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<div class="card card-body">
<p>
Specifies the number of authors to show under each result before the list is truncated.
Selecting "ALL" may result in slower load times for papers with many authors.
<br> (
<strong>default: {{numAuthorsDefault}}</strong>)
</p>
Expand Down
6 changes: 5 additions & 1 deletion src/js/widgets/preferences/views/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ define([
], function (_, Marionette, ApplicationTemplate, config) {
var DEFAULTS = {
numAuthors: {
initialOptions: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
initialOptions: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 'ALL'],
initialValue: 4,
},
externalLinks: {
Expand Down Expand Up @@ -209,6 +209,10 @@ define([

_convertToNumber: function (val) {
try {
var normalized = String(val).toUpperCase();
if (normalized === 'ALL' || normalized === 'NONE') {
return normalized;
}
return _.isNaN(Number(val)) ? val : Number(val);
} catch (e) {
return val;
Expand Down
12 changes: 12 additions & 0 deletions test/mocha/js/widgets/results_render_widget.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,18 @@ define([
expect(result).to.include('[fields orcid_other=5]');
});

it("Should NOT apply field limiters when minAuthorsPerResult is 'ALL'", function () {
const widget = _getWidget();
// Simulate 'ALL' setting which gets converted to POSITIVE_INFINITY
widget.minAuthorsPerResult = Number.POSITIVE_INFINITY;
const result = widget.customizeQuery(new ApiQuery({q: "star"})).get('fl')[0].split(',');
// Verify no [fields xxx] limiters are present
const hasFieldLimiters = result.some(function(field) {
return field.indexOf('[fields ') === 0;
});
expect(hasFieldLimiters).to.be.false;
});

it.skip("should listen to INVITING_REQUEST event", function (done) {

var stub = function (apiResponse) {
Expand Down