richie-education 3.2.2-dev62 → 3.3.1-dev1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -146,9 +146,8 @@ export const SaleTunnelInformationSingular = () => {
146
146
  const discount = query.data?.discount ?? props.paymentPlan?.discount;
147
147
  const fromBatchOrder = query.data?.from_batch_order ?? props.paymentPlan?.from_batch_order;
148
148
 
149
- const showPaymentSchedule =
149
+ const isCredentialWithPrice =
150
150
  product.type === ProductType.CREDENTIAL &&
151
- schedule &&
152
151
  (discountedPrice != null ? discountedPrice > 0 : price != null && price > 0);
153
152
 
154
153
  useEffect(() => {
@@ -204,18 +203,19 @@ export const SaleTunnelInformationSingular = () => {
204
203
  </div>
205
204
  )}
206
205
  <div>
207
- {showPaymentSchedule ? (
208
- <PaymentScheduleBlock schedule={schedule!} />
209
- ) : (
210
- <div>
211
- <h4 className="block-title">
212
- <FormattedMessage {...messages.paymentSchedule} />
213
- </h4>
214
- <Alert type={VariantType.NEUTRAL}>
215
- <FormattedMessage {...messages.noPaymentSchedule} />
216
- </Alert>
217
- </div>
218
- )}
206
+ {isCredentialWithPrice &&
207
+ (schedule ? (
208
+ <PaymentScheduleBlock schedule={schedule!} />
209
+ ) : (
210
+ <div>
211
+ <h4 className="block-title">
212
+ <FormattedMessage {...messages.paymentSchedule} />
213
+ </h4>
214
+ <Alert type={VariantType.NEUTRAL}>
215
+ <FormattedMessage {...messages.noPaymentSchedule} />
216
+ </Alert>
217
+ </div>
218
+ ))}
219
219
  <Voucher
220
220
  discount={discount}
221
221
  voucherError={voucherError}
@@ -374,8 +374,16 @@ describe('SaleTunnel', () => {
374
374
  );
375
375
  await user.type(screen.getByLabelText('Voucher code'), 'DISCOUNT100');
376
376
  await user.click(screen.getByRole('button', { name: 'Validate' }));
377
- await screen.findByRole('heading', { level: 4, name: 'Payment schedule' });
378
- screen.getByText('No payment required. This order is fully covered.');
377
+ await screen.findByRole('heading', { level: 3, name: 'Information' });
378
+ await screen.findByText(
379
+ 'No billing information required. This order is covered by your organization.',
380
+ );
381
+ expect(
382
+ screen.queryByRole('heading', { level: 4, name: 'Payment schedule' }),
383
+ ).not.toBeInTheDocument();
384
+ expect(
385
+ screen.queryByText('No payment required. This order is fully covered.'),
386
+ ).not.toBeInTheDocument();
379
387
  await screen.findByTestId('sale-tunnel__total__amount');
380
388
  const $totalAmountVoucher = screen.getByTestId('sale-tunnel__total__amount');
381
389
  expect($totalAmountVoucher).toHaveTextContent(
@@ -484,8 +484,12 @@ describe.each([
484
484
  });
485
485
  });
486
486
  } else {
487
- await screen.findByRole('heading', { level: 4, name: 'Payment schedule' });
488
- screen.getByText('No payment required. This order is fully covered.');
487
+ expect(
488
+ screen.queryByRole('heading', { level: 4, name: 'Payment schedule' }),
489
+ ).not.toBeInTheDocument();
490
+ expect(
491
+ screen.queryByText('No payment required. This order is fully covered.'),
492
+ ).not.toBeInTheDocument();
489
493
  expect(screen.queryByRole('table')).toBeNull();
490
494
  }
491
495
 
@@ -624,8 +628,12 @@ describe.each([
624
628
  });
625
629
  });
626
630
  } else {
627
- await screen.findByRole('heading', { level: 4, name: 'Payment schedule' });
628
- screen.getByText('No payment required. This order is fully covered.');
631
+ expect(
632
+ screen.queryByRole('heading', { level: 4, name: 'Payment schedule' }),
633
+ ).not.toBeInTheDocument();
634
+ expect(
635
+ screen.queryByText('No payment required. This order is fully covered.'),
636
+ ).not.toBeInTheDocument();
629
637
  expect(screen.queryByRole('table')).toBeNull();
630
638
  }
631
639
 
@@ -838,10 +846,12 @@ describe.each([
838
846
  'No billing information required. This order is covered by your organization.',
839
847
  ),
840
848
  ).toBeInTheDocument();
841
- expect(screen.getByRole('heading', { level: 4, name: 'Payment schedule' })).toBeInTheDocument();
842
849
  expect(
843
- screen.getByText('No payment required. This order is fully covered.'),
844
- ).toBeInTheDocument();
850
+ screen.queryByRole('heading', { level: 4, name: 'Payment schedule' }),
851
+ ).not.toBeInTheDocument();
852
+ expect(
853
+ screen.queryByText('No payment required. This order is fully covered.'),
854
+ ).not.toBeInTheDocument();
845
855
  });
846
856
 
847
857
  it('should hide voucher code input when one is already used', async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "richie-education",
3
- "version": "3.2.2-dev62",
3
+ "version": "3.3.1-dev1",
4
4
  "description": "A CMS to build learning portals for Open Education",
5
5
  "main": "sandbox/manage.py",
6
6
  "scripts": {