Hide button for student
This commit is contained in:
parent
3a7f895354
commit
0af3494053
|
|
@ -19,21 +19,25 @@ describe('The Rooms Page', () => {
|
|||
},
|
||||
});
|
||||
|
||||
const getOnboardingOperations = (isTeacher) => {
|
||||
const operations = getOperations(isTeacher);
|
||||
return {
|
||||
...operations,
|
||||
RoomsQuery: {
|
||||
rooms: {
|
||||
edges: [],
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
cy.setup();
|
||||
});
|
||||
|
||||
it('shows the onboarding page', () => {
|
||||
const operations = getOperations(true);
|
||||
cy.mockGraphqlOps({
|
||||
operations: {
|
||||
...operations,
|
||||
RoomsQuery: {
|
||||
rooms: {
|
||||
edges: []
|
||||
}
|
||||
}
|
||||
},
|
||||
operations: getOnboardingOperations(true),
|
||||
});
|
||||
|
||||
cy.visit('/rooms');
|
||||
|
|
@ -44,6 +48,18 @@ describe('The Rooms Page', () => {
|
|||
cy.url().should('include', 'new-room');
|
||||
});
|
||||
|
||||
it('shows the onboarding page without button for student', () => {
|
||||
cy.mockGraphqlOps({
|
||||
operations: getOnboardingOperations(false),
|
||||
});
|
||||
|
||||
cy.visit('/rooms');
|
||||
cy.getByDataCy('page-title').should('contain', 'Räume');
|
||||
cy.getByDataCy('rooms-onboarding-text').should('contain', 'Hier können Sie Räume erstellen');
|
||||
cy.getByDataCy('page-footer').should('not.exist');
|
||||
cy.getByDataCy('create-room-button').should('not.exist');
|
||||
});
|
||||
|
||||
it('goes to the rooms page', () => {
|
||||
const operations = getOperations(true);
|
||||
cy.mockGraphqlOps({
|
||||
|
|
|
|||
|
|
@ -10,7 +10,9 @@
|
|||
<router-link
|
||||
:to="newRoomRoute"
|
||||
class="button button--primary"
|
||||
data-cy="create-room-button">Raum erstellen</router-link>
|
||||
data-cy="create-room-button"
|
||||
v-if="isTeacher">Raum erstellen
|
||||
</router-link>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
@ -21,11 +23,18 @@
|
|||
import {NEW_ROOM_PAGE} from '@/router/room.names';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
isTeacher: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
newRoomRoute: NEW_ROOM_PAGE
|
||||
newRoomRoute: NEW_ROOM_PAGE,
|
||||
};
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,9 @@
|
|||
v-if="canAddRoom"/>
|
||||
|
||||
</template>
|
||||
<rooms-onboarding v-else/>
|
||||
<rooms-onboarding
|
||||
:is-teacher="me.isTeacher"
|
||||
v-else/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue