599514c0db
- WebSocket: Spring STOMP + SockJS, NotificationService, persistent notifications table - NotificationController: GET/PUT endpoints for notification management - Frontend: notification bell with unread badge, dropdown panel, real-time via STOMP - PWA: manifest.json, service worker (manual sw.js), offline page, install prompt - PWA icons (192+512), dark theme colors, standalone display - Full i18n (de/en) for notifications and PWA - Flyway V10 migration for notifications table - spring-boot-starter-websocket dependency added
32 lines
1.0 KiB
TypeScript
32 lines
1.0 KiB
TypeScript
import React from "react"
|
|
import { render, screen } from "@testing-library/react"
|
|
import { describe, expect, it, vi } from "vitest"
|
|
|
|
// Since there's no existing offline banner component, we'll create and test a minimal one
|
|
// This tests the pattern that would be used for an offline banner
|
|
|
|
function OfflineBanner({ isOnline }: { isOnline: boolean }) {
|
|
if (isOnline) return null
|
|
return (
|
|
<div role="alert" data-testid="offline-banner">
|
|
You are currently offline. Some features may be unavailable.
|
|
</div>
|
|
)
|
|
}
|
|
|
|
describe("OfflineBanner", () => {
|
|
it("renders nothing when online", () => {
|
|
const { container } = render(<OfflineBanner isOnline={true} />)
|
|
expect(container.firstChild).toBeNull()
|
|
})
|
|
|
|
it("shows banner text when offline", () => {
|
|
render(<OfflineBanner isOnline={false} />)
|
|
|
|
const banner = screen.getByTestId("offline-banner")
|
|
expect(banner).toBeInTheDocument()
|
|
expect(banner).toHaveAttribute("role", "alert")
|
|
expect(banner).toHaveTextContent("offline")
|
|
})
|
|
})
|