mirror of
https://github.com/alexta69/metube.git
synced 2026-09-21 21:45:04 +00:00
feat: DEFAULT_FOLDER pre-selects a download folder (closes #875)
Most downloads from a given install land in the same custom directory, which today means picking it by hand every time. DEFAULT_FOLDER seeds the folder field once the configuration arrives; the field stays editable, so per-download folders still work, and a folder already typed this session is not overwritten. The value is trimmed of surrounding slashes, and dropped with a warning when CUSTOM_DIRS is off, since the UI hides the field in that mode and the download path check rejects a folder anyway. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -148,6 +148,25 @@ describe('App', () => {
|
||||
expect(app).toBeTruthy();
|
||||
});
|
||||
|
||||
it('pre-fills the download folder from DEFAULT_FOLDER', () => {
|
||||
const fixture = TestBed.createComponent(App);
|
||||
fixture.detectChanges();
|
||||
|
||||
downloads.configurationChanged.next({ DEFAULT_FOLDER: 'youtube' });
|
||||
|
||||
expect(fixture.componentInstance.folder).toBe('youtube');
|
||||
});
|
||||
|
||||
it('does not overwrite a folder the user already typed', () => {
|
||||
const fixture = TestBed.createComponent(App);
|
||||
fixture.detectChanges();
|
||||
fixture.componentInstance.folder = 'music';
|
||||
|
||||
downloads.configurationChanged.next({ DEFAULT_FOLDER: 'youtube' });
|
||||
|
||||
expect(fixture.componentInstance.folder).toBe('music');
|
||||
});
|
||||
|
||||
it('asIsOrder returns a stable comparator value (insertion order preserved)', () => {
|
||||
const fixture = TestBed.createComponent(App);
|
||||
const app = fixture.componentInstance;
|
||||
|
||||
Reference in New Issue
Block a user