' +
'
' +
'
' + escHtml(title) + '
' +
(message ? '
' + message + '
' : '') +
- '
' +
+ '
' +
'
' +
'
' +
'' +
diff --git a/tests/test_order_arrival_multi_rows.py b/tests/test_order_arrival_multi_rows.py
new file mode 100644
index 0000000..7b19713
--- /dev/null
+++ b/tests/test_order_arrival_multi_rows.py
@@ -0,0 +1,34 @@
+"""订单详情到货批次批量加行回归测试。"""
+
+import unittest
+from pathlib import Path
+
+
+APP_JS = (Path(__file__).resolve().parents[1] / 'static/js/app.js').read_text(encoding='utf-8')
+
+
+class OrderArrivalMultiRowsTest(unittest.TestCase):
+ def test_detail_toolbar_places_multi_row_button_before_single_row_button(self):
+ multi_pos = APP_JS.index('id="addMultiBatchBtn"')
+ single_pos = APP_JS.index('id="addBatchBtn"', multi_pos)
+ self.assertLess(multi_pos, single_pos)
+ self.assertIn('onclick="promptAddArrivalBatchRows(this)"', APP_JS[multi_pos:single_pos])
+
+ def test_multi_row_prompt_requires_bounded_integer(self):
+ self.assertIn("showCenteredPrompt('添加多行'", APP_JS)
+ self.assertIn("type: 'number', min: 1, max: 100, step: 1", APP_JS)
+ self.assertIn('!Number.isInteger(count) || count < 1 || count > 100', APP_JS)
+
+ def test_shared_row_builder_allows_repeated_appends(self):
+ self.assertIn('function appendArrivalBatchEditingRow(btn)', APP_JS)
+ self.assertIn('for (var i = 0; i < count; i++)', APP_JS)
+ self.assertIn('var row = appendArrivalBatchEditingRow(btn)', APP_JS)
+ self.assertNotIn("tbody.querySelector('.batch-editing')", APP_JS)
+
+ def test_centered_prompt_supports_numeric_inputs_without_breaking_text_default(self):
+ self.assertIn('window.showCenteredPrompt = function(title, message, defaultValue, options)', APP_JS)
+ self.assertIn("var inputType = options.type === 'number' ? 'number' : 'text'", APP_JS)
+
+
+if __name__ == '__main__':
+ unittest.main()