feat(taglist-order): change default value to `alpha-asc;num-desc`

This commit is contained in:
Joxit 2023-05-16 06:28:35 +02:00
parent 8bbfc5c390
commit 78606e07f1
No known key found for this signature in database
GPG Key ID: F526592B8E012263
3 changed files with 10 additions and 5 deletions

View File

@ -47,7 +47,7 @@
show-catalog-nb-tags="${SHOW_CATALOG_NB_TAGS}"
history-custom-labels="${HISTORY_CUSTOM_LABELS}"
use-control-cache-header="${USE_CONTROL_CACHE_HEADER}"
taglist-order="${TAGLIST_ORDER}
taglist-order="${TAGLIST_ORDER}"
theme="${THEME}"
theme-primary-text="${THEME_PRIMARY_TEXT}"
theme-neutral-text="${THEME_NEUTRAL_TEXT}"
@ -74,7 +74,7 @@
show-catalog-nb-tags="true"
history-custom-labels="first_custom_labels,second_custom_labels"
use-control-cache-header="false"
taglist-order="alpha-asc;num-desc"
taglist-order=""
theme="auto"
theme-primary-text=""
theme-neutral-text=""

View File

@ -16,7 +16,7 @@ export const taglistOrderVariants = (taglistOrder) => {
return `${taglistOrder};${taglistOrder.startsWith('num') ? 'alpha' : 'num'}-asc`;
default:
if (!taglistOrder) {
return 'num-asc;alpha-asc';
return 'alpha-asc;num-desc';
} else if (TAGLIST_ORDER_REGEX.test(taglistOrder)) {
return taglistOrder;
}

View File

@ -15,9 +15,14 @@ describe('utils tests', () => {
expected.forEach((e) => assert.deepEqual(taglistOrderVariants(e), e));
});
it('should return correct default order', () => {
const expected = 'alpha-asc;num-desc';
[undefined, ''].forEach((e) => assert.deepEqual(taglistOrderVariants(e), expected));
});
it('should return correct variant of `num-asc;alpha-asc`', () => {
const expected = 'num-asc;alpha-asc';
[undefined, '', 'asc', 'num-asc'].forEach((e) => assert.deepEqual(taglistOrderVariants(e), expected));
['asc', 'num-asc'].forEach((e) => assert.deepEqual(taglistOrderVariants(e), expected));
});
it('should return correct variant of `alpha-desc;num-desc`', () => {
@ -39,7 +44,7 @@ describe('utils tests', () => {
describe('taglistOrderParser', () => {
it('should have default configuration when empty or undefined', () => {
const expected = { numAsc: true, alphaAsc: true, numFirst: true };
const expected = { numAsc: false, alphaAsc: true, numFirst: false };
assert.deepEqual(taglistOrderParser(), expected);
assert.deepEqual(taglistOrderParser(''), expected);
});