Refs #30563 -- Added tests for merging form Media with different ordering.

This commit is contained in:
David Smith 2020-08-30 13:40:16 +01:00 committed by Mariusz Felisiak
parent e26a7a8ef4
commit 1ac337cca6
1 changed files with 4 additions and 0 deletions

View File

@ -581,6 +581,7 @@ class FormsMediaTestCase(SimpleTestCase):
widget1 = Media(css={'screen': ['c.css'], 'all': ['d.css', 'e.css']})
widget2 = Media(css={'screen': ['a.css']})
widget3 = Media(css={'screen': ['a.css', 'b.css', 'c.css'], 'all': ['e.css']})
widget4 = Media(css={'all': ['d.css', 'e.css'], 'screen': ['c.css']})
merged = widget1 + widget2
# c.css comes before a.css because widget1 + widget2 establishes this
# order.
@ -588,3 +589,6 @@ class FormsMediaTestCase(SimpleTestCase):
merged = merged + widget3
# widget3 contains an explicit ordering of c.css and a.css.
self.assertEqual(merged._css, {'screen': ['a.css', 'b.css', 'c.css'], 'all': ['d.css', 'e.css']})
# Media ordering does not matter.
merged = widget1 + widget4
self.assertEqual(merged._css, {'screen': ['c.css'], 'all': ['d.css', 'e.css']})