Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

B5 migration tool: Updated regex for make_data_attribute_renames #35160

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions corehq/apps/hqwebapp/tests/utils/test_bootstrap_changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ def test_make_data_attribute_renames_bootstrap5():
eq(renames, ['renamed data-toggle to data-bs-toggle'])


def test_ko_make_data_attribute_renames_bootstrap5():
line = """ data-bind="attr: {'data-target': '#modalGroup-' + id()}"\n"""
final_line, renames = make_data_attribute_renames(
line, get_spec('bootstrap_3_to_5')
)
eq(final_line, """ data-bind="attr: {'data-bs-target': '#modalGroup-' + id()}"\n""")
eq(renames, ['renamed data-target to data-bs-target'])


def test_make_javascript_dependency_renames():
line = """ "hqwebapp/js/bootstrap3/widgets",\n"""
final_line, renames = make_javascript_dependency_renames(
Expand Down
2 changes: 1 addition & 1 deletion corehq/apps/hqwebapp/utils/bootstrap/changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def make_data_attribute_renames(line, spec):
return _do_rename(
line,
spec['data_attribute_renames'],
lambda x: r"([\n }])(" + x + r")(=[\"\'])",
lambda x: r"([\n }\"\'])(" + x + r")([\"\']?[=:]\s*[\"\'])",
lambda x: r"\1" + spec['data_attribute_renames'][x] + r"\3"
)

Expand Down
Loading