Skip to content

Commit 629c1c9

Browse files
committed
Merge remote-tracking branch 'jdufresne/go-back'
* jdufresne/go-back: Fix "go back" button in djDebugWindow
2 parents ad6d819 + bc18488 commit 629c1c9

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

debug_toolbar/static/debug_toolbar/js/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const $$ = {
2121
}
2222
},
2323
visible: function (element) {
24-
element.classList.contains("djdt-hidden");
24+
return !element.classList.contains("djdt-hidden");
2525
},
2626
executeScripts: function (scripts) {
2727
scripts.forEach(function (script) {

tests/test_integration.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
try:
2121
from selenium import webdriver
2222
from selenium.common.exceptions import NoSuchElementException
23+
from selenium.webdriver.common.by import By
2324
from selenium.webdriver.firefox.options import Options
25+
from selenium.webdriver.support import expected_conditions as EC
2426
from selenium.webdriver.support.wait import WebDriverWait
2527
except ImportError:
2628
webdriver = None
@@ -438,3 +440,30 @@ def test_django_cached_template_loader(self):
438440
"#djDebugWindow code"
439441
)
440442
)
443+
444+
def test_sql_action_and_go_back(self):
445+
self.selenium.get(self.live_server_url + "/execute_sql/")
446+
sql_panel = self.selenium.find_element_by_id("SQLPanel")
447+
debug_window = self.selenium.find_element_by_id("djDebugWindow")
448+
449+
# Click to show the SQL panel
450+
self.selenium.find_element_by_class_name("SQLPanel").click()
451+
452+
# SQL panel loads
453+
button = WebDriverWait(self.selenium, timeout=3).until(
454+
EC.visibility_of_element_located((By.CSS_SELECTOR, ".remoteCall"))
455+
)
456+
button.click()
457+
458+
# SQL selected window loads
459+
WebDriverWait(self.selenium, timeout=3).until(EC.visibility_of(debug_window))
460+
self.assertIn("SQL selected", debug_window.text)
461+
462+
# Close the SQL selected window
463+
debug_window.find_element_by_class_name("djDebugClose").click()
464+
WebDriverWait(self.selenium, timeout=3).until(
465+
EC.invisibility_of_element(debug_window)
466+
)
467+
468+
# SQL panel is still visible
469+
self.assertTrue(sql_panel.is_displayed())

0 commit comments

Comments
 (0)