30 lines
1.0 KiB
Python
30 lines
1.0 KiB
Python
import tempfile
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
from scripts.patch_admin_timeline_ui import build_lifecycle_script, patch_clipboard
|
|
|
|
|
|
class AdminTimelinePatchTests(unittest.TestCase):
|
|
def test_lifecycle_script_collapses_retrieval_events_and_preserves_hover_borders(self):
|
|
script = build_lifecycle_script()
|
|
|
|
self.assertIn("fcbx-retrieval-event", script)
|
|
self.assertIn("展开全部取件记录", script)
|
|
self.assertIn("row.style.overflow = 'visible'", script)
|
|
|
|
def test_clipboard_rewrite_keeps_module_declaration_separator(self):
|
|
source = '''const m=async(a,e={})=>{try{return!0}catch(r){return!1}},R=async(a,e={})=>{return a};export{m};'''
|
|
with tempfile.TemporaryDirectory() as temp_dir:
|
|
path = Path(temp_dir) / "clipboard-test.js"
|
|
path.write_text(source, encoding="utf-8")
|
|
|
|
self.assertTrue(patch_clipboard(path))
|
|
patched = path.read_text(encoding="utf-8")
|
|
|
|
self.assertIn("}},R=async", patched)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|