+import { IdlService, IdlObject } from './../../../core/idl.service';
import { QueryList } from "@angular/core";
import { waitForAsync } from "@angular/core/testing";
import { AuthService } from "@eg/core/auth.service";
import { FormatService } from "@eg/core/format.service";
-import { IdlService } from "@eg/core/idl.service";
import { OrgService } from "@eg/core/org.service";
import { StoreService } from "@eg/core/store.service";
import { ComboboxComponent } from "@eg/share/combobox/combobox.component";
import { ToastService } from "@eg/share/toast/toast.service";
import { FileExportService } from "@eg/share/util/file-export.service";
import { CopyAttrsComponent } from "./copy-attrs.component";
+import { VolCopyContext } from "./volcopy";
import { VolCopyService } from "./volcopy.service";
describe('CopyAttrsComponent', () => {
expect(component.applyCopyValue).not.toHaveBeenCalled();
}));
});
- })
+ });
+ describe('#applyCopyValue', () => {
+ it('does not override a magic status', () => {
+ volCopyServiceMock.copyStatIsMagic.and.returnValue(true);
+ const item = jasmine.createSpyObj<IdlObject>(['ischanged'], {'status': () => {1}});
+ const contextMock = jasmine.createSpyObj<VolCopyContext>(['copyList']);
+ contextMock.copyList.and.returnValue([item]);
+ component.context = contextMock;
+ spyOn(component, 'emitSaveChange');
+
+ component.applyCopyValue('status', 0);
+ expect(item.ischanged).not.toHaveBeenCalled();
+ });
+ });
});
this.context.copyList().forEach(copy => {
if (!copy[field] || copy[field]() === value) { return; }
+ // Don't overwrite magic statuses
+ if (field === 'status' && this.volcopy.copyStatIsMagic(copy[field]()) ) { return; }
// Change selection indicates which items should be modified
// based on the display value for the selected field at