Grow the Add stories field to fit its URLs

This commit is contained in:
tim
2026-09-27 23:38:28 +02:00
parent ce19035689
commit a7a89b145c
3 changed files with 16 additions and 1 deletions
+7 -1
View File
@@ -88,7 +88,12 @@ test('failed settings saves retain edits and re-enable the action', async () =>
test('adding stories keeps input on rejection and clears it after a mixed result', async () => {
await mountStories({ ...config, library_available: false });
const urls = nodes(main).find((el) => el.tagName === 'textarea');
urls.value = ' https://site.test/1\n\nhttps://site.test/2 ';
Object.assign(urls, { scrollHeight: 90, clientHeight: 60, offsetHeight: 62 });
input(urls, ' https://site.test/1\n\nhttps://site.test/2 ');
assert.equal(urls.style.height, '92px');
Object.assign(urls, { scrollHeight: 50, clientHeight: 90, offsetHeight: 92 });
input(urls, urls.value);
assert.equal(urls.style.height, '92px');
api.on('POST', 'stories', { error: 'Unavailable' }, 503);
await click(main, 'Add');
assert.match(urls.value, /site.test/);
@@ -96,6 +101,7 @@ test('adding stories keeps input on rejection and clears it after a mixed result
await click(main, 'Add');
assert.deepEqual(api.sent('POST', 'stories').at(-1).body, { urls: ' https://site.test/1\n\nhttps://site.test/2 ' });
assert.equal(urls.value, '');
assert.equal(urls.style.height, '');
assert.match(ui.toasts.textContent, /Unsupported URL/);
await click(main, 'Add');
assert.equal(api.sent('POST', 'stories').length, 2);