feat(upload): add pause and cancel controls for active uploads
All checks were successful
Build and Publish Docker Image / deploy (push) Successful in 2m3s
All checks were successful
Build and Publish Docker Image / deploy (push) Successful in 2m3s
- Add CSS grid layout for upload-active-actions and hidden state - Implement JavaScript logic for pausing and cancelling uploads with confirmation - Add test to verify home page includes upload control elements
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@@ -29,6 +30,30 @@ func TestSetStaticCacheHeaders(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestHomeIncludesActiveUploadControls(t *testing.T) {
|
||||
app, cleanup := newTestApp(t)
|
||||
defer cleanup()
|
||||
|
||||
request := httptest.NewRequest(http.MethodGet, "/", nil)
|
||||
response := httptest.NewRecorder()
|
||||
app.Home(response, request)
|
||||
|
||||
if response.Code != http.StatusOK {
|
||||
t.Fatalf("status = %d, body = %s", response.Code, response.Body.String())
|
||||
}
|
||||
for _, want := range []string{
|
||||
`id="upload-active-actions"`,
|
||||
`id="cancel-upload"`,
|
||||
`id="pause-upload"`,
|
||||
`Cancel Upload`,
|
||||
`Pause Upload`,
|
||||
} {
|
||||
if !strings.Contains(response.Body.String(), want) {
|
||||
t.Fatalf("home page missing %q", want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestWebManifestIncludesShareTarget(t *testing.T) {
|
||||
data, err := os.ReadFile(filepath.Join("..", "..", "static", "site.webmanifest"))
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user