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(() => {
|
beforeEach(() => {
|
||||||
cy.setup();
|
cy.setup();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('shows the onboarding page', () => {
|
it('shows the onboarding page', () => {
|
||||||
const operations = getOperations(true);
|
|
||||||
cy.mockGraphqlOps({
|
cy.mockGraphqlOps({
|
||||||
operations: {
|
operations: getOnboardingOperations(true),
|
||||||
...operations,
|
|
||||||
RoomsQuery: {
|
|
||||||
rooms: {
|
|
||||||
edges: []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
cy.visit('/rooms');
|
cy.visit('/rooms');
|
||||||
|
|
@ -44,6 +48,18 @@ describe('The Rooms Page', () => {
|
||||||
cy.url().should('include', 'new-room');
|
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', () => {
|
it('goes to the rooms page', () => {
|
||||||
const operations = getOperations(true);
|
const operations = getOperations(true);
|
||||||
cy.mockGraphqlOps({
|
cy.mockGraphqlOps({
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,9 @@
|
||||||
<router-link
|
<router-link
|
||||||
:to="newRoomRoute"
|
:to="newRoomRoute"
|
||||||
class="button button--primary"
|
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>
|
</div>
|
||||||
|
|
||||||
|
|
@ -21,11 +23,18 @@
|
||||||
import {NEW_ROOM_PAGE} from '@/router/room.names';
|
import {NEW_ROOM_PAGE} from '@/router/room.names';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
props: {
|
||||||
|
isTeacher: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
newRoomRoute: NEW_ROOM_PAGE
|
newRoomRoute: NEW_ROOM_PAGE,
|
||||||
};
|
};
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,9 @@
|
||||||
v-if="canAddRoom"/>
|
v-if="canAddRoom"/>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
<rooms-onboarding v-else/>
|
<rooms-onboarding
|
||||||
|
:is-teacher="me.isTeacher"
|
||||||
|
v-else/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue