Skip to content

Commit

Permalink
feat(taglist-order): change default value to alpha-asc;num-desc
Browse files Browse the repository at this point in the history
  • Loading branch information
Joxit committed May 16, 2023
1 parent 8bbfc5c commit 78606e0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand All @@ -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=""
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/taglist-order.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
9 changes: 7 additions & 2 deletions test/taglist-order.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`', () => {
Expand All @@ -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);
});
Expand Down

0 comments on commit 78606e0

Please sign in to comment.