Add read only on a per school class basis to assignments
This commit is contained in:
parent
b50ba068a0
commit
26cda08d94
|
|
@ -2,11 +2,15 @@ import mocks from '../../../fixtures/mocks';
|
|||
|
||||
const myText = 'Mein Feedback';
|
||||
|
||||
const getOperations = ({readOnly}) => ({
|
||||
const getOperations = ({readOnly, classReadOnly = false}) => ({
|
||||
MeQuery: {
|
||||
me: {
|
||||
onboardingVisited: true,
|
||||
readOnly,
|
||||
selectedClass: {
|
||||
id: 'selectedClassId',
|
||||
readOnly: classReadOnly
|
||||
}
|
||||
},
|
||||
},
|
||||
StudentSubmissions: {
|
||||
|
|
@ -57,6 +61,7 @@ describe('Assignment feedback read-only - Teacher', () => {
|
|||
cy.isSubmissionReadOnly(myText);
|
||||
cy.getByDataCy('final-submission-reopen').should('not.exist');
|
||||
});
|
||||
|
||||
it('can edit', () => {
|
||||
cy.mockGraphqlOps({
|
||||
operations: getOperations({readOnly: false}),
|
||||
|
|
@ -66,4 +71,15 @@ describe('Assignment feedback read-only - Teacher', () => {
|
|||
|
||||
cy.getByDataCy('final-submission-reopen').should('exist');
|
||||
});
|
||||
|
||||
it('can not edit for inactive class', () => {
|
||||
cy.mockGraphqlOps({
|
||||
operations: getOperations({readOnly: false, classReadOnly: true}),
|
||||
});
|
||||
|
||||
cy.visit('submission/submission-id');
|
||||
|
||||
cy.isSubmissionReadOnly(myText);
|
||||
cy.getByDataCy('final-submission-reopen').should('not.exist');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import mocks from '../../../fixtures/mocks';
|
||||
import minimalModule from '../../../fixtures/module.minimal';
|
||||
|
||||
const module = {
|
||||
|
|
@ -34,11 +33,15 @@ const module = {
|
|||
|
||||
const myText = 'submission text';
|
||||
|
||||
const getOperations = ({final, readOnly}) => ({
|
||||
const getOperations = ({final, readOnly, classReadOnly = false}) => ({
|
||||
MeQuery: {
|
||||
me: {
|
||||
onboardingVisited: true,
|
||||
readOnly
|
||||
readOnly,
|
||||
selectedClass: {
|
||||
id: 'selectedClassId',
|
||||
readOnly: classReadOnly
|
||||
}
|
||||
},
|
||||
},
|
||||
ModuleDetailsQuery: {
|
||||
|
|
@ -58,14 +61,7 @@ const getOperations = ({final, readOnly}) => ({
|
|||
|
||||
describe('Assignments read-only - Student', () => {
|
||||
beforeEach(() => {
|
||||
cy.fakeLogin('rahel.cueni', 'test');
|
||||
cy.server();
|
||||
cy.task('getSchema').then(schema => {
|
||||
cy.mockGraphql({
|
||||
schema,
|
||||
mocks
|
||||
});
|
||||
});
|
||||
cy.setup();
|
||||
});
|
||||
|
||||
it('can edit and turn in', () => {
|
||||
|
|
@ -112,4 +108,14 @@ describe('Assignments read-only - Student', () => {
|
|||
cy.getByDataCy('final-submission').should('exist');
|
||||
cy.getByDataCy('final-submission-reopen').should('not.exist');
|
||||
});
|
||||
|
||||
it('can not edit or turn in in inactive class', () => {
|
||||
cy.mockGraphqlOps({
|
||||
operations: getOperations({final: false, readOnly: false, classReadOnly: true})
|
||||
});
|
||||
cy.visit('module/module-with-assignment');
|
||||
|
||||
cy.isSubmissionReadOnly(myText);
|
||||
cy.getByDataCy('final-submission-reopen').should('not.exist');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
:spellcheck-loading="spellcheckLoading"
|
||||
:saved="!unsaved"
|
||||
:spellcheck="true"
|
||||
:read-only="me.readOnly"
|
||||
:read-only="me.readOnly || me.selectedClass.readOnly"
|
||||
placeholder="Ergebnis erfassen"
|
||||
action="Ergebnis mit Lehrperson teilen"
|
||||
shared-msg="Das Ergebnis wurde mit der Lehrperson geteilt."
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import "@/styles/_helpers.scss";
|
||||
@import "~styles/helpers";
|
||||
|
||||
.submission-form {
|
||||
display: flex;
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@
|
|||
};
|
||||
},
|
||||
readOnly() {
|
||||
return this.me.readOnly;
|
||||
return this.me.readOnly || this.me.selectedClass.readOnly;
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue