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 minimalModule from '../../../fixtures/module.minimal';
|
||||||
|
import {getMinimalMe} from '../../../support/helpers';
|
||||||
|
|
||||||
const getOperations = ({readOnly}) => ({
|
const getOperations = ({readOnly, classReadOnly = false}) => ({
|
||||||
MeQuery: {
|
MeQuery: getMinimalMe({readOnly, classReadOnly}),
|
||||||
me: {
|
|
||||||
onboardingVisited: true,
|
|
||||||
readOnly,
|
|
||||||
isTeacher: true
|
|
||||||
},
|
|
||||||
},
|
|
||||||
ModuleDetailsQuery: {
|
ModuleDetailsQuery: {
|
||||||
module: {
|
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', () => {
|
describe('Module Navigation - read only', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.setup();
|
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', () => {
|
it('is shown', () => {
|
||||||
cy.mockGraphqlOps({
|
moduleNavigationTest({readOnly: false, displayMenu: true});
|
||||||
operations: getOperations({readOnly: false}),
|
});
|
||||||
});
|
|
||||||
|
|
||||||
cy.visit('module/module-slug');
|
it('is not shown when no valid license', () => {
|
||||||
|
moduleNavigationTest({readOnly: true, displayMenu: false});
|
||||||
|
});
|
||||||
|
|
||||||
cy.getByDataCy('module-navigation').should('exist');
|
it('is not shown when inactive school class', () => {
|
||||||
cy.getByDataCy('module-teacher-menu').should('exist');
|
moduleNavigationTest({readOnly: false, classReadOnly: true, displayMenu: false});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@
|
||||||
<div
|
<div
|
||||||
class="module-navigation__toggle-menu"
|
class="module-navigation__toggle-menu"
|
||||||
data-cy="module-teacher-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"/>
|
<snapshot-menu class="module-navigation__actions"/>
|
||||||
<router-link
|
<router-link
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue