Remove module teacher navigation when class inactive
This commit is contained in:
parent
49e7d2e3ba
commit
53b5102114
|
|
@ -1,43 +1,42 @@
|
|||
import minimalModule from '../../../fixtures/module.minimal';
|
||||
import {getMinimalMe} from '../../../support/helpers';
|
||||
|
||||
const getOperations = ({readOnly}) => ({
|
||||
MeQuery: {
|
||||
me: {
|
||||
onboardingVisited: true,
|
||||
readOnly,
|
||||
isTeacher: true
|
||||
},
|
||||
},
|
||||
const getOperations = ({readOnly, classReadOnly = false}) => ({
|
||||
MeQuery: getMinimalMe({readOnly, classReadOnly}),
|
||||
ModuleDetailsQuery: {
|
||||
module: {
|
||||
...minimalModule
|
||||
}
|
||||
...minimalModule,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const moduleNavigationTest = ({readOnly, classReadOnly = false, displayMenu}) => {
|
||||
cy.mockGraphqlOps({
|
||||
operations: getOperations({readOnly, classReadOnly}),
|
||||
});
|
||||
|
||||
const shouldMenuExist = displayMenu ? 'exist' : 'not.exist';
|
||||
|
||||
cy.visit('module/module-slug');
|
||||
|
||||
cy.getByDataCy('module-navigation').should('exist');
|
||||
cy.getByDataCy('module-teacher-menu').should(shouldMenuExist);
|
||||
};
|
||||
|
||||
describe('Module Navigation - read only', () => {
|
||||
beforeEach(() => {
|
||||
cy.setup();
|
||||
});
|
||||
|
||||
it('is not shown', () => {
|
||||
cy.mockGraphqlOps({
|
||||
operations: getOperations({readOnly: true}),
|
||||
});
|
||||
|
||||
cy.visit('module/module-slug');
|
||||
|
||||
cy.getByDataCy('module-navigation').should('exist');
|
||||
cy.getByDataCy('module-teacher-menu').should('not.exist');
|
||||
});
|
||||
it('is shown', () => {
|
||||
cy.mockGraphqlOps({
|
||||
operations: getOperations({readOnly: false}),
|
||||
});
|
||||
moduleNavigationTest({readOnly: false, displayMenu: true});
|
||||
});
|
||||
|
||||
cy.visit('module/module-slug');
|
||||
it('is not shown when no valid license', () => {
|
||||
moduleNavigationTest({readOnly: true, displayMenu: false});
|
||||
});
|
||||
|
||||
cy.getByDataCy('module-navigation').should('exist');
|
||||
cy.getByDataCy('module-teacher-menu').should('exist');
|
||||
it('is not shown when inactive school class', () => {
|
||||
moduleNavigationTest({readOnly: false, classReadOnly: true, displayMenu: false});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
<div
|
||||
class="module-navigation__toggle-menu"
|
||||
data-cy="module-teacher-menu"
|
||||
v-if="canManageContent && !me.readOnly"
|
||||
v-if="canManageContent && !me.readOnly && !me.selectedClass.readOnly"
|
||||
>
|
||||
<snapshot-menu class="module-navigation__actions"/>
|
||||
<router-link
|
||||
|
|
|
|||
Loading…
Reference in New Issue