Skip to content

Commit

Permalink
Merge pull request #3609 from open-formulieren/refactor/3593-revert-t…
Browse files Browse the repository at this point in the history
…oken-removal-during-migration

🩹 [#3593] Un-break mail styling with local design to…
  • Loading branch information
CharString authored Nov 16, 2023
2 parents 08acaad + 9c6f3b7 commit 718fbfc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,12 @@ def apply_mapping(design_tokens: TokenContainer) -> TokenContainer:
assign(result, new, old_value, missing=dict)
tokens_to_unset.add(old)

for token in tokens_to_unset:
# don't delete utility tokens!
if not any(token.startswith(prefix) for prefix in OBSOLETE_PREFIXES):
continue
delete(result, token)
# TODO: re-enable this when #3593 is properly resolved.
# for token in tokens_to_unset:
# # don't delete utility tokens!
# if not any(token.startswith(prefix) for prefix in OBSOLETE_PREFIXES):
# continue
# delete(result, token)

return remove_empty_design_tokens(result)

Expand Down
17 changes: 14 additions & 3 deletions src/openforms/config/tests/test_migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ def test_map_old_token_to_new(self):

self.assertEqual(
updated,
{"utrecht": {"page-footer": {"background-color": {"value": "blue"}}}},
{
"of": {"page-footer": {"bg": {"value": "blue"}}},
"utrecht": {"page-footer": {"background-color": {"value": "blue"}}},
},
)

def test_map_and_merge_old_token_to_new(self):
Expand All @@ -102,12 +105,13 @@ def test_map_and_merge_old_token_to_new(self):
self.assertEqual(
updated,
{
"of": {"page-header": {"bg": {"value": "blue"}}},
"utrecht": {
"page-header": {
"background-color": {"value": "blue"},
"color": {"value": "pink"},
}
}
},
},
)

Expand All @@ -121,7 +125,10 @@ def test_do_not_overwrite_existing_token(self):

self.assertEqual(
updated,
{"utrecht": {"page-header": {"background-color": {"value": "blue"}}}},
{
"of": {"page-header": {"bg": {"value": "red"}}},
"utrecht": {"page-header": {"background-color": {"value": "blue"}}},
},
)


Expand Down Expand Up @@ -259,6 +266,10 @@ def test_design_tokens_updated_correctly(self):
expected = {
"of": {
"text": {"font-size": {"value": "1rem"}},
"page-header": {
"bg": {"value": "#07838f"},
"fg": {"value": "#FFFFFF"},
},
},
"utrecht": {
"page-footer": {
Expand Down

0 comments on commit 718fbfc

Please sign in to comment.