many styling changes to applets and palettes applet esp.; all applets seeded w. < 3rows bumped to 3 w. new migration in apps.applets; setting palette no longer reloads entire page, only preset background-color vars; two new ITs in apps.dash.tests.ITs.test_views.SetPaletteTest to ensure dash.views functionality fires; unified h2 applet title html structure & styled its text vertically to waste less applet space
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
This commit is contained in:
@@ -1,10 +1,49 @@
|
||||
from selenium.webdriver.common.by import By
|
||||
|
||||
from apps.applets.models import Applet
|
||||
from apps.lyric.models import User
|
||||
|
||||
from .base import FunctionalTest
|
||||
|
||||
|
||||
class PaletteSwapTest(FunctionalTest):
|
||||
def test_selecting_palette_updates_body_class_without_page_reload(self):
|
||||
Applet.objects.get_or_create(slug="palette", defaults={
|
||||
"name": "Palette", "context": "dashboard",
|
||||
})
|
||||
user, _ = User.objects.get_or_create(email="swap@test.io")
|
||||
self.create_pre_authenticated_session("swap@test.io")
|
||||
self.browser.get(self.live_server_url)
|
||||
|
||||
body = self.browser.find_element(By.TAG_NAME, "body")
|
||||
self.assertIn("palette-default", body.get_attribute("class"))
|
||||
|
||||
# Mark the window — this survives JS execution but is wiped on a real reload
|
||||
self.browser.execute_script("window._no_reload_marker = true;")
|
||||
|
||||
# Click OK on a non-active palette
|
||||
btn = self.wait_for(
|
||||
lambda: self.browser.find_element(
|
||||
By.CSS_SELECTOR,
|
||||
".palette-item:has(.swatch:not(.active)) .btn-confirm",
|
||||
)
|
||||
)
|
||||
btn.click()
|
||||
|
||||
# Body palette class swaps without reload
|
||||
self.wait_for(
|
||||
lambda: self.assertNotIn(
|
||||
"palette-default",
|
||||
self.browser.find_element(By.TAG_NAME, "body").get_attribute("class"),
|
||||
)
|
||||
)
|
||||
|
||||
# Marker still present — no full page reload occurred
|
||||
self.assertTrue(
|
||||
self.browser.execute_script("return window._no_reload_marker === true;")
|
||||
)
|
||||
|
||||
|
||||
class SiteThemeTest(FunctionalTest):
|
||||
def test_page_renders_with_earthman_palette(self):
|
||||
self.browser.get(self.live_server_url)
|
||||
|
||||
Reference in New Issue
Block a user