Refs #33765 -- Added tests for trailing whitespace in JavaScript source map references.

This commit is contained in:
Adam Johnson 2022-06-03 12:04:59 +01:00 committed by Mariusz Felisiak
parent d0863429a3
commit 00639dbd6d
2 changed files with 16 additions and 0 deletions

View File

@ -0,0 +1,2 @@
//# sourceMappingURL=source_map.js.map
let a_variable = 1;

View File

@ -280,6 +280,20 @@ class TestHashedFiles:
) )
self.assertPostCondition() self.assertPostCondition()
def test_js_source_map_trailing_whitespace(self):
relpath = self.hashed_file_path("cached/source_map_trailing_whitespace.js")
self.assertEqual(
relpath, "cached/source_map_trailing_whitespace.cd45b8534a87.js"
)
with storage.staticfiles_storage.open(relpath) as relfile:
content = relfile.read()
self.assertNotIn(b"//# sourceMappingURL=source_map.js.map\t ", content)
self.assertIn(
b"//# sourceMappingURL=source_map.js.99914b932bd3.map",
content,
)
self.assertPostCondition()
def test_js_source_map_sensitive(self): def test_js_source_map_sensitive(self):
relpath = self.hashed_file_path("cached/source_map_sensitive.js") relpath = self.hashed_file_path("cached/source_map_sensitive.js")
self.assertEqual(relpath, "cached/source_map_sensitive.5da96fdd3cb3.js") self.assertEqual(relpath, "cached/source_map_sensitive.5da96fdd3cb3.js")