[ACA-3427] Remove About tab when it's not useful (#1491)

* [ACA-3427] Remove About tab when it's  not useful

* Add unit tests for isLibraryManager rule

* Fix e2e tests

* Fix e2e tests and add rule to docs

* Fix e2e tests
This commit is contained in:
davidcanonieto
2020-06-18 22:03:26 +01:00
committed by GitHub
parent e2b6ebab9b
commit 85f71f5ae1
7 changed files with 63 additions and 13 deletions

View File

@@ -475,4 +475,34 @@ describe('app.evaluators', () => {
expect(app.canShowLogout(context)).toBe(true);
});
});
describe('isLibraryManager', () => {
it('should return true when role is SiteManager', () => {
const context: any = {
selection: {
library: {
entry: {
role: 'SiteManager'
}
}
}
};
expect(app.isLibraryManager(context)).toBe(true);
});
it('should return false when role is different than SiteManager', () => {
const context: any = {
selection: {
library: {
entry: {
role: 'SiteCollaborator'
}
}
}
};
expect(app.isLibraryManager(context)).toBe(false);
});
});
});

View File

@@ -546,3 +546,16 @@ export function canShowLanguagePicker(context: AcaRuleContext): boolean {
export function canShowLogout(context: AcaRuleContext): boolean {
return !context.withCredentials;
}
/**
* Checks if user is library manager
* JSON ref: `isLibraryManager`
* @param context Rule execution context
*/
export function isLibraryManager(context: RuleContext): boolean {
return (
hasLibrarySelected(context) &&
context.selection.library.entry &&
context.selection.library.entry.role === 'SiteManager'
);
}