Skip to content
Merged
7 changes: 4 additions & 3 deletions core/src/components/tab-bar/tab-bar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@
* @prop --border: Border of the tab bar
* @prop --color: Color of the tab bar
*/

@include padding-horizontal(var(--ion-safe-area-left), var(--ion-safe-area-right));

display: flex;

align-items: center;
justify-content: center;

width: auto;

/* stylelint-disable */
padding-right: var(--ion-safe-area-right);
padding-bottom: var(--ion-safe-area-bottom, 0);
padding-left: var(--ion-safe-area-left);
/* stylelint-enable */

border-top: var(--border);

Expand Down
46 changes: 46 additions & 0 deletions core/src/components/tab-bar/test/basic/tab-bar.e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { expect } from '@playwright/test';
import { configs, test } from '@utils/test/playwright';

/**
* This behavior needs to be tested in both modes and directions to
* make sure the safe area padding is applied only to that side
* regardless of direction
*/
configs().forEach(({ title, screenshot, config }) => {
test.describe(title('tab-bar: basic'), () => {
test.describe('safe area', () => {
test('should have padding added by the safe area', async ({ page }) => {
await page.setContent(
`
<style>
:root {
--ion-safe-area-left: 40px;
--ion-safe-area-right: 20px;
}
</style>

<ion-tab-bar selected-tab="1">
<ion-tab-button tab="1">
<ion-label>Recents</ion-label>
</ion-tab-button>

<ion-tab-button tab="2">
<ion-label>Favorites</ion-label>
<ion-badge>23</ion-badge>
</ion-tab-button>

<ion-tab-button tab="3">
<ion-label>Settings</ion-label>
</ion-tab-button>
</ion-tab-bar>
`,
config
);

const tabBar = page.locator('ion-tab-bar');

await expect(tabBar).toHaveScreenshot(screenshot(`tab-bar-safe-area`));
});
});
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.