diff --git a/client/cypress/integration/frontend/rooms/room-page.spec.js b/client/cypress/integration/frontend/rooms/room-page.spec.js index 33a74da7..f458ee48 100644 --- a/client/cypress/integration/frontend/rooms/room-page.spec.js +++ b/client/cypress/integration/frontend/rooms/room-page.spec.js @@ -15,7 +15,7 @@ describe('The Room Page', () => { }; const RoomEntriesQuery = { - room + room, }; const operations = { @@ -29,9 +29,9 @@ describe('The Room Page', () => { { type: 'text_block', value: { - text: entryText - } - } + text: entryText, + }, + }, ], author: { firstName: 'Rachel', @@ -65,9 +65,24 @@ describe('The Room Page', () => { cy.get('.room-entry__content:first').should('contain', entryText).should('contain', 'Rachel Green'); }); - it.only('changes visibility of a room', () => { + it('room actions should not exist for student', () => { + const operations = { + MeQuery: getMinimalMe({isTeacher: false}), + RoomEntriesQuery, + }; + + cy.mockGraphqlOps({ + operations, + }); + cy.visit(`/room/${slug}`); + + cy.getByDataCy('room-title').should('exist'); + cy.getByDataCy('room-actions').should('not.exist'); + }); + + it('changes visibility of a room', () => { const MeQuery = getMinimalMe({ - isTeacher: true + isTeacher: true, }); const operations = { MeQuery, @@ -77,10 +92,10 @@ describe('The Room Page', () => { success: true, room: { ...room, - restricted: true - } - } - } + restricted: true, + }, + }, + }, }; cy.mockGraphqlOps({ diff --git a/client/cypress/integration/frontend/rooms/rooms-page.spec.js b/client/cypress/integration/frontend/rooms/rooms-page.spec.js index 7fca57f5..9ea65979 100644 --- a/client/cypress/integration/frontend/rooms/rooms-page.spec.js +++ b/client/cypress/integration/frontend/rooms/rooms-page.spec.js @@ -72,7 +72,7 @@ describe('The Rooms Page', () => { cy.get('[data-cy=add-room]').should('exist'); }); - it('add room should not exist for student', () => { + it('actions should not exist for student', () => { const operations = getOperations(false); cy.mockGraphqlOps({ operations, @@ -81,7 +81,7 @@ describe('The Rooms Page', () => { cy.visit('/rooms'); cy.getByDataCy('room-widget').should('have.length', 1); - cy.get('[data-cy=add-room]').should('not.exist'); + cy.getByDataCy('toggle-room-actions-menu').should('not.exist'); }); it('adds a room as teacher', () => { diff --git a/client/src/pages/room.vue b/client/src/pages/room.vue index c3e0a5da..fe8af0da 100644 --- a/client/src/pages/room.vue +++ b/client/src/pages/room.vue @@ -12,7 +12,9 @@ v-if="canEdit"/>
{{ room.description }}
@@ -55,8 +57,8 @@ computed: { canEdit() { - return !this.me.readOnly && !this.me.selectedClass.readOnly; - } + return this.me.isTeacher && !this.me.readOnly && !this.me.selectedClass.readOnly; + }, }, apollo: { @@ -64,7 +66,7 @@ query: ROOM_ENTRIES_QUERY, variables() { return { - slug: this.slug + slug: this.slug, }; }, update({room}) { @@ -72,8 +74,8 @@ return this.$getRidOfEdges(room); }, pollInterval: 5000, - } - } + }, + }, };