Skip to content

Commit 7f14e31

Browse files
committed
chore(test): zero out safe-area insets in test environments
1 parent 4fe98a4 commit 7f14e31

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

core/scripts/testing/scripts.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,24 @@
4848
document.head.appendChild(style);
4949
}
5050

51+
/**
52+
* Zero out safe-area insets in test environments.
53+
* The default 20px --ion-safe-area-top from core.scss is for legacy
54+
* status bar simulation but doesn't represent real browser behavior.
55+
* Tests that need to verify safe-area handling should explicitly set
56+
* these values in their test HTML files.
57+
*/
58+
const safeAreaStyle = document.createElement('style');
59+
safeAreaStyle.innerHTML = `
60+
:root {
61+
--ion-safe-area-top: 0px;
62+
--ion-safe-area-bottom: 0px;
63+
--ion-safe-area-left: 0px;
64+
--ion-safe-area-right: 0px;
65+
}
66+
`;
67+
document.head.appendChild(safeAreaStyle);
68+
5169
/**
5270
* The `palette` param is used to load a specific palette
5371
* for the theme.

0 commit comments

Comments
 (0)