-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'integration/2024-evolution' into staging
- Loading branch information
Showing
6 changed files
with
88 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
tbx/navigation/migrations/0008_navigationsettings_footer_newsletter_cta.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Generated by Django 5.1.5 on 2025-02-10 08:23 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("navigation", "0007_divisionmixin_and_navigationsetmixin"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="navigationsettings", | ||
name="footer_newsletter_cta_text", | ||
field=models.CharField(blank=True, max_length=255), | ||
), | ||
migrations.AddField( | ||
model_name="navigationsettings", | ||
name="footer_newsletter_cta_url", | ||
field=models.URLField(blank=True), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from django.test import SimpleTestCase | ||
|
||
from wagtail.admin.panels.base import get_form_for_model | ||
|
||
from tbx.navigation.models import NavigationSettings | ||
|
||
|
||
class NavigationSettingsFormTestCase(SimpleTestCase): | ||
def setUp(self): | ||
self.form_class = get_form_for_model( | ||
NavigationSettings, | ||
fields=[ | ||
"footer_newsletter_cta_url", | ||
"footer_newsletter_cta_text", | ||
], | ||
) | ||
|
||
def test_cta_optional(self): | ||
form = self.form_class( | ||
data={"footer_newsletter_cta_url": "", "footer_newsletter_cta_text": ""} | ||
) | ||
self.assertTrue(form.is_valid()) | ||
|
||
def test_cta_text_required_if_url_supplied(self): | ||
form = self.form_class( | ||
data={ | ||
"footer_newsletter_cta_url": "https://example.com", | ||
"footer_newsletter_cta_text": "", | ||
} | ||
) | ||
self.assertFormError( | ||
form, | ||
"footer_newsletter_cta_text", | ||
"The CTA footer text is required when a URL is supplied", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters