Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

refactor: migrated deprecated Input and ValidationForm group components #617

Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
058a2c8
refactor: migrated deprecated Input and ValidationForm group componen…
abdullahwaheed Aug 3, 2022
01376d5
refactor: migrated deprecated Input group component from UpdateQuanti…
abdullahwaheed Aug 3, 2022
32dadc9
fix: unit tests
abdullahwaheed Aug 3, 2022
e9f5ce2
fix: pinned NPM version to fix breaking CI issue of peer dependency
abdullahwaheed Aug 16, 2022
6b9b4e4
Merge branch 'master' of github.com:edx/frontend-app-payment into abd…
abdullahwaheed Aug 26, 2022
6230903
Merge branch 'master' of github.com:edx/frontend-app-payment into abd…
abdullahwaheed Sep 22, 2022
2c3aa21
Merge branch 'master' of github.com:edx/frontend-app-payment into abd…
abdullahwaheed Nov 8, 2022
5e34995
Merge branch 'master' of github.com:edx/frontend-app-payment into abd…
abdullahwaheed Nov 11, 2022
b2a67fa
Merge branch 'master' of github.com:edx/frontend-app-payment into abd…
abdullahwaheed Nov 15, 2022
339246f
Merge branch 'master' into abdullahwaheed/paragon-form-deprecations
pshiu Nov 17, 2022
6811f32
Merge branch 'master' of github.com:edx/frontend-app-payment into abd…
abdullahwaheed Nov 18, 2022
54239eb
Merge branch 'abdullahwaheed/paragon-form-deprecations' of github.com…
abdullahwaheed Nov 18, 2022
d51d67f
refactor: updated unit tests
abdullahwaheed Nov 18, 2022
61dc747
Merge branch 'master' of github.com:edx/frontend-app-payment into abd…
abdullahwaheed Dec 9, 2022
f912a4b
Merge branch 'master' into abdullahwaheed/paragon-form-deprecations
abdullahwaheed Jan 6, 2023
e3089f8
Merge branch 'master' into abdullahwaheed/paragon-form-deprecations
abdullahwaheed Jan 24, 2023
887d314
Merge branch 'master' into abdullahwaheed/paragon-form-deprecations
arbrandes Jan 24, 2023
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
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
strategy:
matrix:
node: [16]
npm: [8.5.x]
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -22,6 +23,7 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- run: npm install -g npm@${{ matrix.npm }}

- name: Install dependencies
run: npm ci
Expand Down
32 changes: 19 additions & 13 deletions src/payment/__snapshots__/PaymentPage.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2353,20 +2353,26 @@ exports[`<PaymentPage /> Renders correctly in various states should render the b
<div
className="position-relative"
>
<input
className="form-control form-control-sm"
defaultValue={1}
id="code-quantity"
max="100"
min="1"
name="code-quantity"
style={
Object {
"width": "5rem",
<div
className="pgn__form-control-decorator-group form-control-sm"
>
<input
className="has-value form-control"
defaultValue={1}
id="code-quantity"
max="100"
min="1"
name="code-quantity"
onBlur={[Function]}
onChange={[Function]}
style={
Object {
"width": "5rem",
}
}
}
type="number"
/>
type="number"
/>
</div>
<small
className="text-muted small"
style={
Expand Down
8 changes: 4 additions & 4 deletions src/payment/cart/CouponForm.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { Button, Input, ValidationFormGroup } from '@edx/paragon';
import { Button, Form } from '@edx/paragon';
import { FormattedMessage } from '@edx/frontend-platform/i18n';
import { sendTrackEvent } from '@edx/frontend-platform/analytics';

Expand Down Expand Up @@ -44,16 +44,16 @@ class CouponForm extends Component {

return (
<form onSubmit={this.handleAddSubmit} className="summary-row d-flex align-items-end">
<ValidationFormGroup for={id} invalid={false} className="mb-0 mr-2">
<Form.Group controlId={id} invalid={false} className="mb-0 mr-2">
<label className="h6 d-block" htmlFor={id}>
<FormattedMessage
id="payment.coupon.label"
defaultMessage="Add coupon code (optional)"
description="Label for the add coupon form"
/>
</label>
<Input name={id} id={id} type="text" defaultValue={code} />
</ValidationFormGroup>
<Form.Control name={id} id={id} type="text" defaultValue={code} />
</Form.Group>
<Button
disabled={isBasketProcessing}
variant="outline-primary"
Expand Down
4 changes: 2 additions & 2 deletions src/payment/cart/UpdateQuantityForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useCallback } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { FormattedMessage } from '@edx/frontend-platform/i18n';
import { StatefulButton, Input } from '@edx/paragon';
import { StatefulButton, Form } from '@edx/paragon';

import { updateQuantity } from '../data/actions';
import { updateQuantityFormSelector } from '../data/selectors';
Expand Down Expand Up @@ -34,7 +34,7 @@ function UpdateQuantityForm(props) {
/>
</label>
<div className="position-relative">
<Input
<Form.Control
className="form-control-sm"
name={id}
id={id}
Expand Down
70 changes: 42 additions & 28 deletions src/payment/cart/__snapshots__/Cart.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -198,22 +198,30 @@ exports[`<Cart /> renders a basic, one product cart with coupon form 1`] = `
onSubmit={[Function]}
>
<div
className="form-group mb-0 mr-2"
className="pgn__form-group mb-0 mr-2"
invalid={false}
>
<label
className="h6 d-block"
htmlFor="couponField"
>
Add coupon code (optional)
</label>
<input
aria-describedby=""
className="form-control"
defaultValue=""
id="couponField"
name="couponField"
type="text"
/>
Array [
<label
className="h6 d-block"
htmlFor="couponField"
>
Add coupon code (optional)
</label>,
<div
className="pgn__form-control-decorator-group"
>
<input
className="form-control"
defaultValue=""
id="couponField"
name="couponField"
onBlur={[Function]}
onChange={[Function]}
type="text"
/>
</div>,
]
</div>
<button
className="btn btn-outline-primary"
Expand Down Expand Up @@ -325,20 +333,26 @@ exports[`<Cart /> renders a bulk enrollment cart 1`] = `
<div
className="position-relative"
>
<input
className="form-control form-control-sm"
defaultValue={1}
id="code-quantity"
max="100"
min="1"
name="code-quantity"
style={
Object {
"width": "5rem",
<div
className="pgn__form-control-decorator-group form-control-sm"
>
<input
className="has-value form-control"
defaultValue={1}
id="code-quantity"
max="100"
min="1"
name="code-quantity"
onBlur={[Function]}
onChange={[Function]}
style={
Object {
"width": "5rem",
}
}
}
type="number"
/>
type="number"
/>
</div>
<small
className="text-muted small"
style={
Expand Down
38 changes: 23 additions & 15 deletions src/payment/cart/__snapshots__/CouponForm.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,30 @@ exports[`CouponForm should render a form when there is no coupon 1`] = `
onSubmit={[Function]}
>
<div
className="form-group mb-0 mr-2"
className="pgn__form-group mb-0 mr-2"
invalid={false}
>
<label
className="h6 d-block"
htmlFor="couponField"
>
Add coupon code (optional)
</label>
<input
aria-describedby=""
className="form-control"
defaultValue=""
id="couponField"
name="couponField"
type="text"
/>
Array [
<label
className="h6 d-block"
htmlFor="couponField"
>
Add coupon code (optional)
</label>,
<div
className="pgn__form-control-decorator-group"
>
<input
className="form-control"
defaultValue=""
id="couponField"
name="couponField"
onBlur={[Function]}
onChange={[Function]}
type="text"
/>
</div>,
]
</div>
<button
className="btn btn-outline-primary"
Expand Down