Keep the iOS status bar outside the Capacitor web view and replace startup geolocation watching with silent permission checks plus an explicit location action. Verified by full unit, App Store readiness, Qodana, production build, Capacitor sync, and Playwright mobile suites.
40 lines
2.2 KiB
JavaScript
40 lines
2.2 KiB
JavaScript
import { readFileSync } from "node:fs";
|
|
import { join } from "node:path";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
const root = process.cwd();
|
|
const indexSource = readFileSync(join(root, "index.html"), "utf8");
|
|
const mainStylesSource = readFileSync(join(root, "src/assets/main.css"), "utf8");
|
|
const mobileHeaderSource = readFileSync(join(root, "src/components/viewport/page/headers/MobileHeader.vue"), "utf8");
|
|
const desktopHeaderSource = readFileSync(join(root, "src/components/viewport/page/headers/DesktopHeader.vue"), "utf8");
|
|
const tabletHeaderSource = readFileSync(join(root, "src/components/viewport/page/headers/TabletHeader.vue"), "utf8");
|
|
const packageJson = JSON.parse(readFileSync(join(root, "package.json"), "utf8"));
|
|
const capacitorConfigSource = readFileSync(join(root, "capacitor.config.ts"), "utf8");
|
|
const iosInfoPlistSource = readFileSync(join(root, "ios/App/App/Info.plist"), "utf8");
|
|
|
|
describe("mobile header iOS safe-area contract", () => {
|
|
it("opts into safe-area viewport geometry", () => {
|
|
expect(indexSource).toContain("viewport-fit=cover");
|
|
expect(mainStylesSource).toContain("--pleno-mobile-safe-top: env(safe-area-inset-top, 0px);");
|
|
});
|
|
|
|
it("applies the inset to both the fixed header and its content spacer", () => {
|
|
expect(mobileHeaderSource).toContain("height: calc(80px + var(--pleno-mobile-safe-top));");
|
|
expect(mobileHeaderSource).toContain("padding-top: var(--pleno-mobile-safe-top);");
|
|
expect(mobileHeaderSource).toContain("min-height: calc(80px + var(--pleno-mobile-safe-top));");
|
|
});
|
|
|
|
it("does not introduce safe-area offsets into tablet or desktop headers", () => {
|
|
expect(desktopHeaderSource).not.toContain("safe-area-inset-top");
|
|
expect(tabletHeaderSource).not.toContain("safe-area-inset-top");
|
|
});
|
|
|
|
it("keeps the native iOS status bar outside the Capacitor web view", () => {
|
|
expect(packageJson.dependencies["@capacitor/status-bar"]).toBe("^8.0.3");
|
|
expect(capacitorConfigSource).toMatch(
|
|
/StatusBar:\s*\{[\s\S]*overlaysWebView:\s*false,[\s\S]*style:\s*"LIGHT",[\s\S]*backgroundColor:\s*"#FFFFFFFF"/
|
|
);
|
|
expect(iosInfoPlistSource).toMatch(/<key>UIViewControllerBasedStatusBarAppearance<\/key>\s*<true\/>/);
|
|
});
|
|
});
|