snapshot: preserve dynamic builder and section ordering work
This commit is contained in:
@@ -4,7 +4,7 @@ from django.contrib.auth import get_user_model
|
||||
from django.test import TestCase
|
||||
|
||||
from workflows.branding import get_company_email_domain
|
||||
from workflows.models import FormConditionalRuleConfig, FormCustomFieldConfig, FormFieldConfig, FormSectionConfig, OnboardingRequest
|
||||
from workflows.models import FormConditionalRuleConfig, FormCustomFieldConfig, FormCustomSectionConfig, FormFieldConfig, FormSectionConfig, OnboardingRequest
|
||||
|
||||
|
||||
class OnboardingFlowTests(TestCase):
|
||||
@@ -153,7 +153,7 @@ class OnboardingFlowTests(TestCase):
|
||||
self.assertIn('business-card-box', html)
|
||||
self.assertIn('employment-end-box', html)
|
||||
self.assertIn('data-conditional-target="business-card-box"', html)
|
||||
self.assertIn('data-conditional-target="phone-box"', html)
|
||||
self.assertNotIn('data-conditional-target="phone-box"', html)
|
||||
|
||||
def test_onboarding_page_uses_stored_conditional_rule_config(self):
|
||||
FormConditionalRuleConfig.objects.update_or_create(
|
||||
@@ -193,6 +193,39 @@ class OnboardingFlowTests(TestCase):
|
||||
|
||||
self.assertLess(html.index('Bürostandort'), html.index('Anrede'))
|
||||
|
||||
def test_phone_direct_dial_field_is_visible_without_successor(self):
|
||||
response = self.client.get('/onboarding/new/', HTTP_HOST='localhost')
|
||||
html = response.content.decode('utf-8')
|
||||
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertIn('Telefon-Direktwahl', html)
|
||||
self.assertNotIn('data-conditional-target="phone-box"', html)
|
||||
|
||||
def test_onboarding_custom_section_is_rendered_in_navigation(self):
|
||||
FormCustomSectionConfig.objects.create(
|
||||
form_type='onboarding',
|
||||
section_key='benefits',
|
||||
sort_order=10,
|
||||
title='Benefits',
|
||||
is_active=True,
|
||||
)
|
||||
FormCustomFieldConfig.objects.create(
|
||||
form_type='onboarding',
|
||||
field_key='meal_allowance',
|
||||
section_key='benefits',
|
||||
sort_order=0,
|
||||
field_type='text',
|
||||
is_active=True,
|
||||
label='Essenszuschuss',
|
||||
)
|
||||
|
||||
response = self.client.get('/onboarding/new/', HTTP_HOST='localhost')
|
||||
html = response.content.decode('utf-8')
|
||||
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertIn('Benefits', html)
|
||||
self.assertIn('Essenszuschuss', html)
|
||||
|
||||
@patch('workflows.views.process_onboarding_request.delay')
|
||||
def test_onboarding_custom_field_is_rendered_and_saved(self, mock_delay):
|
||||
FormCustomFieldConfig.objects.create(
|
||||
|
||||
Reference in New Issue
Block a user