safeArea.style.test.mjs 670 B

123456789101112131415161718192021222324
  1. import assert from 'node:assert/strict'
  2. import { buildSafeAreaCssVarsStyle } from '../safeAreaCss.js'
  3. const style = buildSafeAreaCssVarsStyle({
  4. topSafeHeight: 44,
  5. navContentHeight: 40,
  6. headerHeight: 84,
  7. capsuleRightSafeWidth: 96,
  8. })
  9. assert.equal(style['--sq-safe-top'], '44px')
  10. assert.equal(style['--sq-nav-height'], '40px')
  11. assert.equal(style['--sq-header-height'], '84px')
  12. assert.equal(style['--sq-capsule-right-safe'], '96px')
  13. const noCapsuleStyle = buildSafeAreaCssVarsStyle({
  14. topSafeHeight: 20,
  15. navContentHeight: 44,
  16. headerHeight: 64,
  17. capsuleRightSafeWidth: 0,
  18. })
  19. assert.equal(noCapsuleStyle['--sq-capsule-right-safe'], '0px')
  20. console.log('ok')