mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-11-29 10:24:20 +01:00
(test) fix running test
Also: (quality) updated browserbd on caniuse (ui) improved help text
This commit is contained in:
parent
38aec6b1fd
commit
ffe6e59681
@ -95,12 +95,13 @@ export const PlanPricingForm = <TContext extends object>({ register, control, fo
|
|||||||
<section className="plan-pricing-form" data-testid="plan-pricing-form">
|
<section className="plan-pricing-form" data-testid="plan-pricing-form">
|
||||||
<header>
|
<header>
|
||||||
<p className="title">{t('app.admin.plan_pricing_form.prices')}</p>
|
<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>
|
</header>
|
||||||
<div className="content">
|
<div className="content">
|
||||||
{plans && <FormSelect options={plans}
|
{plans && <FormSelect options={plans}
|
||||||
control={control}
|
control={control}
|
||||||
label={t('app.admin.plan_pricing_form.copy_prices_from')}
|
label={t('app.admin.plan_pricing_form.copy_prices_from')}
|
||||||
|
tooltip={t('app.admin.plan_pricing_form.copy_prices_from_help')}
|
||||||
onChange={handleCopyPrices}
|
onChange={handleCopyPrices}
|
||||||
id="parent_plan_id" />}
|
id="parent_plan_id" />}
|
||||||
{<FabTabs tabs={[
|
{<FabTabs tabs={[
|
||||||
|
@ -224,6 +224,7 @@ en:
|
|||||||
email: "Email address"
|
email: "Email address"
|
||||||
plan_pricing_form:
|
plan_pricing_form:
|
||||||
prices: "Prices"
|
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: "Copy prices from"
|
||||||
copy_prices_from_help: "This will replace all the prices of this plan with the prices of the selected plan"
|
copy_prices_from_help: "This will replace all the prices of this plan with the prices of the selected plan"
|
||||||
machines: "Machines"
|
machines: "Machines"
|
||||||
|
@ -31,7 +31,7 @@ describe('PlanForm', () => {
|
|||||||
expect(screen.getByLabelText(/app.admin.plan_form.period/)).toBeInTheDocument();
|
expect(screen.getByLabelText(/app.admin.plan_form.period/)).toBeInTheDocument();
|
||||||
expect(screen.getByLabelText(/app.admin.plan_form.partner_plan/)).toBeInTheDocument();
|
expect(screen.getByLabelText(/app.admin.plan_form.partner_plan/)).toBeInTheDocument();
|
||||||
expect(screen.queryByTestId('plan-pricing-form')).toBeNull();
|
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 () => {
|
test('create new plan', async () => {
|
||||||
@ -66,7 +66,7 @@ describe('PlanForm', () => {
|
|||||||
// advanced_accounting_attributes.analytical_section
|
// advanced_accounting_attributes.analytical_section
|
||||||
fireEvent.change(screen.getByLabelText(/app.admin.advanced_accounting_form.analytical_section/), { target: { value: '9B20A' } });
|
fireEvent.change(screen.getByLabelText(/app.admin.advanced_accounting_form.analytical_section/), { target: { value: '9B20A' } });
|
||||||
// send the form
|
// 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(() => {
|
await waitFor(() => {
|
||||||
const expected: Plan = {
|
const expected: Plan = {
|
||||||
base_name: 'Test Plan',
|
base_name: 'Test Plan',
|
||||||
@ -119,7 +119,7 @@ describe('PlanForm', () => {
|
|||||||
expect(screen.getByLabelText(/app.admin.plan_form.notified_partner/)).toBeInTheDocument();
|
expect(screen.getByLabelText(/app.admin.plan_form.notified_partner/)).toBeInTheDocument();
|
||||||
expect(screen.getByText(/app.admin.plan_form.alert_partner_notification/)).toBeInTheDocument();
|
expect(screen.getByText(/app.admin.plan_form.alert_partner_notification/)).toBeInTheDocument();
|
||||||
expect(screen.getByTestId('plan-pricing-form')).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 () => {
|
test('selecting transversal plan disables group select', async () => {
|
||||||
@ -162,7 +162,7 @@ describe('PlanForm', () => {
|
|||||||
// update machine price
|
// update machine price
|
||||||
fireEvent.change(screen.getByLabelText(new RegExp(machine.name)), { target: { value: 42.42 } });
|
fireEvent.change(screen.getByLabelText(new RegExp(machine.name)), { target: { value: 42.42 } });
|
||||||
// send the form
|
// 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(() => {
|
await waitFor(() => {
|
||||||
const expected = {
|
const expected = {
|
||||||
prices_attributes: expect.arrayContaining([{
|
prices_attributes: expect.arrayContaining([{
|
||||||
|
14
yarn.lock
14
yarn.lock
@ -4664,15 +4664,10 @@ caniuse-api@^3.0.0:
|
|||||||
lodash.memoize "^4.1.2"
|
lodash.memoize "^4.1.2"
|
||||||
lodash.uniq "^4.5.0"
|
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:
|
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.30001397"
|
version "1.0.30001460"
|
||||||
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001397.tgz"
|
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001460.tgz"
|
||||||
integrity sha512-SW9N2TbCdLf0eiNDRrrQXx2sOkaakNZbCjgNpPyMJJbiOrU5QzMIrXOVMRM1myBXTD5iTkdrtU/EguCrBocHlA==
|
integrity sha512-Bud7abqjvEjipUkpLs4D7gR0l8hBYBHoa+tGtKJHvT2AYzLp1z7EmVkUT4ERpVUfca8S2HGIVs883D8pUH1ZzQ==
|
||||||
|
|
||||||
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==
|
|
||||||
|
|
||||||
chalk@4.1.1:
|
chalk@4.1.1:
|
||||||
version "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==
|
integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==
|
||||||
|
|
||||||
object-to-formdata-tz@4.4.3, "object-to-formdata@npm:object-to-formdata-tz@4.4.3":
|
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"
|
version "4.4.3"
|
||||||
resolved "https://registry.yarnpkg.com/object-to-formdata-tz/-/object-to-formdata-tz-4.4.3.tgz#3059059d0f02ce90c7fdd9d83f491e8af34707ae"
|
resolved "https://registry.yarnpkg.com/object-to-formdata-tz/-/object-to-formdata-tz-4.4.3.tgz#3059059d0f02ce90c7fdd9d83f491e8af34707ae"
|
||||||
integrity sha512-3XK2hDLCUAfpwatU6Jr3WzzF3ncmzScXPUiIOWgXdYwnxijCojqH41w3DdHRLoPs3MgUHzHBAtLVOFmSlaDWlQ==
|
integrity sha512-3XK2hDLCUAfpwatU6Jr3WzzF3ncmzScXPUiIOWgXdYwnxijCojqH41w3DdHRLoPs3MgUHzHBAtLVOFmSlaDWlQ==
|
||||||
|
Loading…
Reference in New Issue
Block a user