Skip to content

Commit 2596625

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 79b6db9 commit 2596625

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

feincms/static/feincms/item_editor.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,9 @@
537537
invoked. See Issue #372 */
538538
form_element.find("[type=submit][name=_save]").click()
539539
/* Disable all submit buttons to prevent double submission while page reloads */
540-
form_element.find("input[type=submit], button").attr("disabled", "disabled")
540+
form_element
541+
.find("input[type=submit], button")
542+
.attr("disabled", "disabled")
541543
} else {
542544
// Restore original value
543545
form_element.val($(this).data("original_value"))

tests/testapp/tests/test_template_change_fix.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@ def test_fix_is_present_in_javascript(self):
1616
"""Verify that the fix line exists in item_editor.js"""
1717
# Use BASEDIR from settings to construct the path
1818
js_file_path = os.path.join(
19-
settings.BASEDIR, '..', '..', 'feincms', 'static', 'feincms', 'item_editor.js'
19+
settings.BASEDIR,
20+
"..",
21+
"..",
22+
"feincms",
23+
"static",
24+
"feincms",
25+
"item_editor.js",
2026
)
2127
js_file_path = os.path.normpath(js_file_path)
2228

@@ -47,18 +53,24 @@ def test_fix_is_present_in_javascript(self):
4753

4854
def test_fix_order_is_correct(self):
4955
"""Verify that the disable happens AFTER the click, not before."""
50-
base_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
56+
base_dir = os.path.dirname(
57+
os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
58+
)
5159
js_file_path = os.path.join(
52-
base_dir, 'feincms', 'static', 'feincms', 'item_editor.js'
60+
base_dir, "feincms", "static", "feincms", "item_editor.js"
5361
)
5462
js_file_path = os.path.normpath(js_file_path)
5563

5664
with open(js_file_path, "r") as f:
5765
content = f.read()
5866

5967
# Find positions of both statements
60-
click_pos = content.find('form_element.find("[type=submit][name=_save]").click()')
61-
disable_pos = content.find('form_element.find("input[type=submit]").attr("disabled", "disabled")')
68+
click_pos = content.find(
69+
'form_element.find("[type=submit][name=_save]").click()'
70+
)
71+
disable_pos = content.find(
72+
'form_element.find("input[type=submit]").attr("disabled", "disabled")'
73+
)
6274

6375
self.assertGreater(click_pos, 0, "The click() statement should be present")
6476
self.assertGreater(disable_pos, 0, "The disable statement should be present")

0 commit comments

Comments
 (0)