Skip to content

Commit 8a38344

Browse files
tay1orjonesemyarodkennylam
authored
fix(tabs): make IconTab's tooltip visible again (#18447)
* fix(tabs): make IconTab's tooltip visible again * chore(playwright): add expect() to test --------- Co-authored-by: emyarod <emyarod@users.noreply.github.com> Co-authored-by: kennylam <909118+kennylam@users.noreply.github.com>
1 parent 9883d53 commit 8a38344

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

e2e/components/Tabs/Tabs-test.e2e.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77

88
'use strict';
99

10-
const { test } = require('@playwright/test');
10+
const { expect, test } = require('@playwright/test');
1111
const { themes } = require('../../test-utils/env');
12+
const { snapshot } = require('../../test-utils/snapshot');
1213
const { snapshotStory } = require('../../test-utils/storybook');
1314

1415
test.describe('Tabs', () => {
@@ -52,6 +53,15 @@ test.describe('Tabs', () => {
5253
id: 'components-tabs--icon-20-only',
5354
theme,
5455
});
56+
57+
// Focus the tab to invoke the tooltip and snapshot it
58+
await page.keyboard.press('Tab');
59+
await expect(page.getByRole('tab', { name: 'Activity' })).toBeFocused();
60+
await snapshot(page, {
61+
theme,
62+
component: 'Tabs',
63+
id: 'components-tabs--icon-20-only | focused',
64+
});
5565
});
5666

5767
test('icon only @vrt', async ({ page }) => {
@@ -60,6 +70,15 @@ test.describe('Tabs', () => {
6070
id: 'components-tabs--icon-only',
6171
theme,
6272
});
73+
74+
// Focus the tab to invoke the tooltip and snapshot it
75+
await page.keyboard.press('Tab');
76+
await expect(page.getByRole('tab', { name: 'Activity' })).toBeFocused();
77+
await snapshot(page, {
78+
theme,
79+
component: 'Tabs',
80+
id: 'components-tabs--icon-only | focused',
81+
});
6382
});
6483

6584
test('contained @vrt', async ({ page }) => {

packages/react/src/components/Tabs/Tabs.stories.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ export const Icon20Only = () => {
378378
export const IconOnly = () => {
379379
return (
380380
<Tabs>
381-
<TabList>
381+
<TabList iconSize="default">
382382
<IconTab label="Analyze" disabled>
383383
<IbmWatsonDiscovery aria-label="Analyze" />
384384
</IconTab>

packages/styles/scss/components/tabs/_tabs.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,8 @@
522522
//-----------------------------
523523
// Icon Item
524524
//-----------------------------
525+
&.#{$prefix}--tabs__icon--default,
526+
&.#{$prefix}--tabs__icon--lg,
525527
&.#{$prefix}--tabs__icon--default .#{$prefix}--tab--list,
526528
&.#{$prefix}--tabs__icon--lg .#{$prefix}--tab--list {
527529
overflow-x: visible;

0 commit comments

Comments
 (0)