Files
rename-mvp/feature_tests_file_modal_selection.sh
T

45 lines
1.8 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
BASE_URL="${BASE_URL:-http://127.0.0.1:8085}"
ALT_BASE_URL="http://host.containers.internal:8085"
detect_base_url() {
if curl -fsS --max-time 2 "$BASE_URL/api/health" >/dev/null 2>&1; then
echo "$BASE_URL"
return
fi
if curl -fsS --max-time 2 "$ALT_BASE_URL/api/health" >/dev/null 2>&1; then
echo "$ALT_BASE_URL"
return
fi
echo "$BASE_URL"
}
BASE_URL="$(detect_base_url)"
echo "Using BASE_URL=$BASE_URL"
echo "== Feature test 1: modal selection modifiers are implemented =="
grep -q "modalSelectionAnchorPath" app/static/app.js || { echo "anchor state missing"; exit 1; }
grep -q "event.shiftKey" app/static/app.js || { echo "shift handling missing"; exit 1; }
grep -q "event.ctrlKey || event.metaKey" app/static/app.js || { echo "ctrl/meta handling missing"; exit 1; }
echo "modifier selection validation passed"
echo
echo "== Feature test 2: anchor reset on clear and folder reload =="
grep -q "state.modalSelectionAnchorPath = null;" app/static/app.js || { echo "anchor reset missing"; exit 1; }
grep -q "function clearModalSelection()" app/static/app.js || { echo "clearModalSelection missing"; exit 1; }
grep -q "async function loadModalFiles(subpath)" app/static/app.js || { echo "loadModalFiles missing"; exit 1; }
echo "anchor reset validation passed"
echo
echo "== Feature test 3: modal file list UI still present with batch actions =="
page="$(curl -fsS "$BASE_URL/")"
echo "$page" | grep -q 'id="modalFilesList"' || { echo "modalFilesList missing"; exit 1; }
echo "$page" | grep -q 'id="modalSelectAllFilesBtn"' || { echo "Select All button missing"; exit 1; }
echo "$page" | grep -q 'id="modalClearSelectionBtn"' || { echo "Clear Selection button missing"; exit 1; }
echo "modal UI validation passed"
echo
echo "All file modal selection feature tests passed."