1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-28 09:24:24 +01:00

(test) fix running test

Also: (quality) updated browserbd on caniuse
(ui) improved help text
This commit is contained in:
Sylvain 2023-03-06 16:56:42 +01:00
parent 38aec6b1fd
commit ffe6e59681
4 changed files with 12 additions and 14 deletions

View File

@ -95,12 +95,13 @@ export const PlanPricingForm = <TContext extends object>({ register, control, fo
<section className="plan-pricing-form" data-testid="plan-pricing-form">
<header>
<p className="title">{t('app.admin.plan_pricing_form.prices')}</p>
<p className="description">{t('app.admin.plan_pricing_form.copy_prices_from_help')}</p>
<p className="description">{t('app.admin.plan_pricing_form.about_prices')}</p>
</header>
<div className="content">
{plans && <FormSelect options={plans}
control={control}
label={t('app.admin.plan_pricing_form.copy_prices_from')}
tooltip={t('app.admin.plan_pricing_form.copy_prices_from_help')}
onChange={handleCopyPrices}
id="parent_plan_id" />}
{<FabTabs tabs={[

View File

@ -224,6 +224,7 @@ en:
email: "Email address"
plan_pricing_form:
prices: "Prices"
about_prices: "The prices defined here will apply to members subscribing to this plan, for machines and spaces."
copy_prices_from: "Copy prices from"
copy_prices_from_help: "This will replace all the prices of this plan with the prices of the selected plan"
machines: "Machines"

View File

@ -31,7 +31,7 @@ describe('PlanForm', () => {
expect(screen.getByLabelText(/app.admin.plan_form.period/)).toBeInTheDocument();
expect(screen.getByLabelText(/app.admin.plan_form.partner_plan/)).toBeInTheDocument();
expect(screen.queryByTestId('plan-pricing-form')).toBeNull();
expect(screen.getByRole('button', { name: /app.admin.plan_form.ACTION_plan/ })).toBeInTheDocument();
expect(screen.getByRole('button', { name: /app.admin.plan_form.save/ })).toBeInTheDocument();
});
test('create new plan', async () => {
@ -66,7 +66,7 @@ describe('PlanForm', () => {
// advanced_accounting_attributes.analytical_section
fireEvent.change(screen.getByLabelText(/app.admin.advanced_accounting_form.analytical_section/), { target: { value: '9B20A' } });
// send the form
fireEvent.click(screen.getByRole('button', { name: /app.admin.plan_form.ACTION_plan/ }));
fireEvent.click(screen.getByRole('button', { name: /app.admin.plan_form.save/ }));
await waitFor(() => {
const expected: Plan = {
base_name: 'Test Plan',
@ -119,7 +119,7 @@ describe('PlanForm', () => {
expect(screen.getByLabelText(/app.admin.plan_form.notified_partner/)).toBeInTheDocument();
expect(screen.getByText(/app.admin.plan_form.alert_partner_notification/)).toBeInTheDocument();
expect(screen.getByTestId('plan-pricing-form')).toBeInTheDocument();
expect(screen.getByRole('button', { name: /app.admin.plan_form.ACTION_plan/ })).toBeInTheDocument();
expect(screen.getByRole('button', { name: /app.admin.plan_form.save/ })).toBeInTheDocument();
});
test('selecting transversal plan disables group select', async () => {
@ -162,7 +162,7 @@ describe('PlanForm', () => {
// update machine price
fireEvent.change(screen.getByLabelText(new RegExp(machine.name)), { target: { value: 42.42 } });
// send the form
fireEvent.click(screen.getByRole('button', { name: /app.admin.plan_form.ACTION_plan/ }));
fireEvent.click(screen.getByRole('button', { name: /app.admin.plan_form.save/ }));
await waitFor(() => {
const expected = {
prices_attributes: expect.arrayContaining([{

View File

@ -4664,15 +4664,10 @@ caniuse-api@^3.0.0:
lodash.memoize "^4.1.2"
lodash.uniq "^4.5.0"
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001219, caniuse-lite@^1.0.30001313, caniuse-lite@^1.0.30001332:
version "1.0.30001397"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001397.tgz"
integrity sha512-SW9N2TbCdLf0eiNDRrrQXx2sOkaakNZbCjgNpPyMJJbiOrU5QzMIrXOVMRM1myBXTD5iTkdrtU/EguCrBocHlA==
caniuse-lite@^1.0.30001400:
version "1.0.30001439"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001439.tgz#ab7371faeb4adff4b74dad1718a6fd122e45d9cb"
integrity sha512-1MgUzEkoMO6gKfXflStpYgZDlFM7M/ck/bgfVCACO5vnAf0fXoNVHdWtqGU+MYca+4bL9Z5bpOVmR33cWW9G2A==
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001219, caniuse-lite@^1.0.30001313, caniuse-lite@^1.0.30001332, caniuse-lite@^1.0.30001400:
version "1.0.30001460"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001460.tgz"
integrity sha512-Bud7abqjvEjipUkpLs4D7gR0l8hBYBHoa+tGtKJHvT2AYzLp1z7EmVkUT4ERpVUfca8S2HGIVs883D8pUH1ZzQ==
chalk@4.1.1:
version "4.1.1"
@ -8242,6 +8237,7 @@ object-keys@^1.0.12, object-keys@^1.1.1:
integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==
object-to-formdata-tz@4.4.3, "object-to-formdata@npm:object-to-formdata-tz@4.4.3":
name object-to-formdata
version "4.4.3"
resolved "https://registry.yarnpkg.com/object-to-formdata-tz/-/object-to-formdata-tz-4.4.3.tgz#3059059d0f02ce90c7fdd9d83f491e8af34707ae"
integrity sha512-3XK2hDLCUAfpwatU6Jr3WzzF3ncmzScXPUiIOWgXdYwnxijCojqH41w3DdHRLoPs3MgUHzHBAtLVOFmSlaDWlQ==