mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
[ACS-4630] Fix no different rule is selected when rule is deleted (#2824)
* [ACS-4630] Fix no different rule is selected when rule is deleted * Add unit test * Some tests were failing due to objects with same references being used across different tests
This commit is contained in:
parent
11dac5894b
commit
bfe14f8143
@ -121,4 +121,19 @@ describe('FolderRuleSetsService', () => {
|
||||
|
||||
expect(selectRuleSpy).toHaveBeenCalledWith(ruleMock('owned-rule-1'));
|
||||
});
|
||||
|
||||
it('should select a different rule when removing a rule', () => {
|
||||
const selectRuleSpy = spyOn(folderRulesService, 'selectRule');
|
||||
folderRuleSetsService['mainRuleSet'] = JSON.parse(JSON.stringify(ownedRuleSetMock));
|
||||
folderRuleSetsService['inheritedRuleSets'] = JSON.parse(JSON.stringify([inheritedRuleSetMock]));
|
||||
|
||||
folderRuleSetsService.removeRuleFromMainRuleSet('owned-rule-1-id');
|
||||
|
||||
expect(selectRuleSpy).toHaveBeenCalledWith(ruleMock('owned-rule-2'));
|
||||
|
||||
selectRuleSpy.calls.reset();
|
||||
folderRuleSetsService.removeRuleFromMainRuleSet('owned-rule-2-id');
|
||||
|
||||
expect(selectRuleSpy).toHaveBeenCalledWith(ruleMock('inherited-rule-1'));
|
||||
});
|
||||
});
|
||||
|
@ -210,6 +210,7 @@ export class FolderRuleSetsService {
|
||||
this.mainRuleSet = null;
|
||||
this.mainRuleSetSource.next(this.mainRuleSet);
|
||||
}
|
||||
this.folderRulesService.selectRule(this.mainRuleSet?.rules[0] ?? this.inheritedRuleSets[0]?.rules[0] ?? null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user