Add a date format for download names
The new setting gives the strftime format of {pubdate}, {timestamp} and {last_modified}.
The default is Calibre's "%b, %Y".
This commit is contained in:
+10
-3
@@ -110,18 +110,25 @@ test('the jobs list settings load and save all four fields', async () => {
|
||||
});
|
||||
|
||||
test('the download template loads, lists its fields, and saves the stored form', async () => {
|
||||
api.on('GET', 'settings', { recent_chapters: 0, personal_ini: '', download_template: '{title}' });
|
||||
api.on('GET', 'settings', {
|
||||
recent_chapters: 0, personal_ini: '', download_template: '{title}', download_date_format: '%b, %Y',
|
||||
});
|
||||
settingsPage(main, {}, config);
|
||||
await settle();
|
||||
const card = section(main, 'Book Downloads');
|
||||
assert.equal(field(main, 'download-template').value, '{title}');
|
||||
assert.equal(field(main, 'download-date-format').value, '%b, %Y');
|
||||
assert.ok(find(card, 'code', '{id}'));
|
||||
assert.match(card.textContent, /\{title\}The title\{id\}The story ID/);
|
||||
field(main, 'download-template').value = ' {title} - {authors} ';
|
||||
api.on('PUT', 'settings', { download_template: '{title} - {authors}' });
|
||||
field(main, 'download-date-format').value = '';
|
||||
api.on('PUT', 'settings', { download_template: '{title} - {authors}', download_date_format: '%b, %Y' });
|
||||
await click(card, 'Save');
|
||||
assert.deepEqual(api.sent('PUT', 'settings')[0].body, { download_template: ' {title} - {authors} ' });
|
||||
assert.deepEqual(api.sent('PUT', 'settings')[0].body, {
|
||||
download_template: ' {title} - {authors} ', download_date_format: '',
|
||||
});
|
||||
assert.equal(field(main, 'download-template').value, '{title} - {authors}');
|
||||
assert.equal(field(main, 'download-date-format').value, '%b, %Y');
|
||||
api.on('PUT', 'settings', { error: 'Bindery does not support template functions' }, 400);
|
||||
field(main, 'download-template').value = '{title:uppercase()}';
|
||||
await click(card, 'Save');
|
||||
|
||||
Reference in New Issue
Block a user