Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed my reservations page reservation tags #268

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion app/shared/reservation-state-label/ReservationStateLabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import Label from 'shared/label';
import { injectT } from 'i18n';

function ReservationStateLabel({ reservation, t }) {
if (!reservation.needManualConfirmation && reservation.state !== 'cancelled') {
const states = constants.RESERVATION_STATE;
const statesToExclude = [states.CANCELLED, states.WAITING_FOR_PAYMENT];

if (!reservation.needManualConfirmation && !statesToExclude.includes(reservation.state)) {
return <span />;
}
const { labelBsStyle, labelTextId } = constants.RESERVATION_STATE_LABELS[reservation.state];
Expand Down
10 changes: 10 additions & 0 deletions app/shared/reservation-state-label/ReservationStateLabel.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ describe('shared/reservation-state-label/ReservationStateLabel', () => {
const state = 'requested';
getTests(needManualConfirmation, state);
});

describe('if reservation state is "waiting_for_payment"', () => {
const state = 'waiting_for_payment';
getTests(needManualConfirmation, state);
});
});

describe('if reservation does not need manual confirmation', () => {
Expand All @@ -80,6 +85,11 @@ describe('shared/reservation-state-label/ReservationStateLabel', () => {
getTests(needManualConfirmation, state);
});

describe('if reservation state is "waiting_for_payment"', () => {
const state = 'waiting_for_payment';
getTests(needManualConfirmation, state);
});

describe('if reservation state is "confirmed"', () => {
const state = 'confirmed';

Expand Down
Loading