feat: add price filter and dynamic slider to catalog
All checks were successful
Build and Push Docker Image / build (push) Successful in 41s
All checks were successful
Build and Push Docker Image / build (push) Successful in 41s
- Implemented JavaScript-based price slider for catalog filtering - Updated catalog views to handle min/max price inputs and compute slider bounds - Enhanced templates (`index.html`, `side-bar.html`) with filtering form and updated URLs - Added CSS for price slider styling and form layout - Introduced utility functions for URL building and price parsing - Expanded tests for price filtering, sliders, and sidebar active states - Updated context processor and header for dynamic navigation with price filters
This commit is contained in:
@@ -3,7 +3,13 @@ from unittest.mock import patch
|
||||
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
from santehray.settings import collect_hosts, collect_origins, normalize_host, normalize_origin
|
||||
from santehray.settings import (
|
||||
collect_hosts,
|
||||
collect_origins,
|
||||
env_choice,
|
||||
normalize_host,
|
||||
normalize_origin,
|
||||
)
|
||||
|
||||
|
||||
class SettingsNormalizationTests(SimpleTestCase):
|
||||
@@ -26,3 +32,25 @@ class SettingsNormalizationTests(SimpleTestCase):
|
||||
|
||||
def test_normalize_origin_preserves_explicit_scheme_and_port(self):
|
||||
self.assertEqual(normalize_origin("https://preview-1.azimkin.dev:8443"), "https://preview-1.azimkin.dev:8443")
|
||||
|
||||
def test_env_choice_accepts_allowed_value(self):
|
||||
with patch.dict(os.environ, {"SECURE_REFERRER_POLICY": "strict-origin-when-cross-origin"}):
|
||||
self.assertEqual(
|
||||
env_choice(
|
||||
"SECURE_REFERRER_POLICY",
|
||||
"same-origin",
|
||||
{"same-origin", "strict-origin-when-cross-origin"},
|
||||
),
|
||||
"strict-origin-when-cross-origin",
|
||||
)
|
||||
|
||||
def test_env_choice_falls_back_for_invalid_value(self):
|
||||
with patch.dict(os.environ, {"SECURE_REFERRER_POLICY": "invalid-policy"}):
|
||||
self.assertEqual(
|
||||
env_choice(
|
||||
"SECURE_REFERRER_POLICY",
|
||||
"same-origin",
|
||||
{"same-origin", "strict-origin-when-cross-origin"},
|
||||
),
|
||||
"same-origin",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user