feat(ui): simplify plugin activation and align task status badges
This commit is contained in:
1 parent
9c82a40cbf
commit
96fedc816f
11 files changed
+242
-31
No files matched your search
@@ -30,7 +30,7 @@ describe('TaskPluginsComponent', () => {
|
||||
expect(emitted).toHaveBeenCalledWith({});
|
||||
});
|
||||
|
||||
it('offers authorized cross-device connections and uses the default profile', async () => {
|
||||
it('uses the single authorized setting without exposing a connection selector', async () => {
|
||||
const fixture = TestBed.createComponent(TaskPluginsComponent);
|
||||
const component = fixture.componentInstance;
|
||||
component.toggle();
|
||||
@@ -45,7 +45,26 @@ describe('TaskPluginsComponent', () => {
|
||||
checkbox.click(); fixture.detectChanges(); await fixture.whenStable();
|
||||
expect(emitted).toHaveBeenCalledWith({ plugins: [{ id: 'desktop', profile: 'lab' }] });
|
||||
expect(fixture.nativeElement.querySelectorAll('.choice').length).toBe(1);
|
||||
expect(fixture.nativeElement.querySelector('select').textContent).not.toContain('旧配置');
|
||||
expect(fixture.nativeElement.querySelector('select')).toBeNull();
|
||||
expect(fixture.nativeElement.textContent).not.toContain('连接配置');
|
||||
});
|
||||
|
||||
it('allows choosing among multiple authorized settings and excludes unauthorized ones', async () => {
|
||||
const fixture = TestBed.createComponent(TaskPluginsComponent); const component = fixture.componentInstance;
|
||||
component.toggle();
|
||||
http.expectOne('/api/plugins').flush({ plugins: [{ enabled: true,
|
||||
manifest: { id: 'desktop', name: '电脑控制', targets: ['mixed'] }, profiles: [
|
||||
{ name: 'old', label: '旧配置', authorized: false },
|
||||
{ name: 'lab', label: '实验室', authorized: true, is_default: true },
|
||||
{ name: 'office', label: '办公室', authorized: true }
|
||||
] }] });
|
||||
component.automatic = false; fixture.detectChanges(); await fixture.whenStable();
|
||||
const emitted = jasmine.createSpy('changed'); component.changed.subscribe(emitted);
|
||||
fixture.nativeElement.querySelector('.choice input').click(); fixture.detectChanges(); await fixture.whenStable();
|
||||
const select: HTMLSelectElement = fixture.nativeElement.querySelector('select');
|
||||
expect(select.value).toBe('lab'); expect(select.textContent).not.toContain('旧配置');
|
||||
select.value = 'office'; select.dispatchEvent(new Event('change')); fixture.detectChanges(); await fixture.whenStable();
|
||||
expect(emitted).toHaveBeenCalledWith({ plugins: [{ id: 'desktop', profile: 'office' }] });
|
||||
});
|
||||
|
||||
it('shows a retryable error and keeps automatic mode on lookup failure', () => {
|
||||
|
||||
Reference in new issue
Block a user