Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TabPanel: support focused but not selected state in Generic #27995

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.
62 changes: 61 additions & 1 deletion e2e/testcafe-devextreme/tests/navigation/tabPanel/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,6 @@ test('TabPanel borders without scrolling', async (t) => {

await t.dispatchEvent(firstItem.element, 'mousedown');
await testScreenshot(t, takeScreenshot, `TabPanel 1 item active,tabsPosition=${tabsPosition}.png`, { element: '#container' });

// TODO: this test is unstable
// await t
// .dispatchEvent(thirdItem.element, 'mouseup')
Expand Down Expand Up @@ -533,6 +532,67 @@ test('TabPanel borders without scrolling', async (t) => {

return createWidget('dxTabPanel', tabPanelOptions);
});

test(`TabPanel tabs selected item focus with tabsPosition=${tabsPosition}`, async (t) => {
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);

const tabPanel = new TabPanel('#container');

await t.click(tabPanel.multiView.element);
await testScreenshot(t, takeScreenshot, `TabPanel item focus when clicking on multiview,tabsPosition=${tabsPosition}.png`, { element: '#container' });

await t.pressKey('right');
await testScreenshot(t, takeScreenshot, `TabPanel disabled item is focused,tabsPosition=${tabsPosition}.png`, { element: '#container' });

await t.click(tabPanel.multiView.element);

await t.pressKey('left');
await testScreenshot(t, takeScreenshot, `TabPanel focus not selected item,tabsPosition=${tabsPosition}.png`, { element: '#container' });

await t
.expect(compareResults.isValid())
.ok(compareResults.errorMessages());
}).before(async () => {
await ClientFunction(() => {
(window as any).DevExpress.ui.dxTabs.defaultOptions({
options: {
useInkRipple: false,
},
});
})();

const dataSource = [
{
title: 'John Heart',
text: 'John Heart',
}, {
title: 'Olivia Peyton',
text: 'Olivia Peyton',
}, {
title: 'Robert Reagan',
text: 'Robert Reagan',
disabled: true,
}, {
title: 'Greta Sims',
text: 'Greta Sims',
}, {
title: 'Olivia Peyton',
text: 'Olivia Peyton',
},
] as Item[];

const tabPanelOptions = {
dataSource,
height: 250,
width: 450,
tabsPosition,
selectedIndex: 1,
// prevent firing dxinactive event for to avoid failing test
itemHoldTimeout: 5000,
};

return createWidget('dxTabPanel', tabPanelOptions);
});
});

[true, false].forEach((rtlEnabled) => {
Expand Down
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.
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.
8 changes: 4 additions & 4 deletions e2e/testcafe-devextreme/tests/navigation/tabPanel/focus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ test('[{0: selected}] -> click to multiView -> click to external button', async
.click(tabPanel.multiView.getItem(0).element)
.expect(tabPanel.isFocused).ok()
.expect(tabPanel.tabs.isFocused)
.notOk()
.ok()
.expect(tabPanel.tabs.getItem(0).isFocused)
.ok()
.expect(tabPanel.multiView.getItem(0).isFocused)
Expand Down Expand Up @@ -147,7 +147,7 @@ test('[{0: selected}, {1}] -> click to multiView -> navigate to tabs[1] -> click
.click(tabPanel.multiView.getItem(0).element)
.expect(tabPanel.isFocused).ok()
.expect(tabPanel.tabs.isFocused)
.notOk()
.ok()
.expect(tabPanel.tabs.getItem(0).isFocused)
.ok()
.expect(tabPanel.tabs.getItem(1).isFocused)
Expand All @@ -161,7 +161,7 @@ test('[{0: selected}, {1}] -> click to multiView -> navigate to tabs[1] -> click
.pressKey('right')
.expect(tabPanel.isFocused).ok()
.expect(tabPanel.tabs.isFocused)
.notOk()
.ok()
.expect(tabPanel.tabs.getItem(0).isFocused)
.notOk()
.expect(tabPanel.tabs.getItem(1).isFocused)
Expand Down Expand Up @@ -199,7 +199,7 @@ test('[{0: selected}] -> click to multiView -> press "tab" -> press "tab"', asyn
.click(tabPanel.multiView.getItem(0).element)
.expect(tabPanel.isFocused).ok()
.expect(tabPanel.tabs.isFocused)
.notOk()
.ok()
.expect(tabPanel.tabs.getItem(0).isFocused)
.ok()
.expect(tabPanel.multiView.getItem(0).isFocused)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,4 @@
.dx-multiview-wrapper {
border: $generic-tabs-border;
}

&.dx-state-focused {
.dx-multiview-wrapper.dx-state-focused {
border-color: $tabs-focused-border-color;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,6 @@
}
}

&.dx-state-focused {
&.dx-disabled-focused-tab {
.dx-tabs-wrapper {
border-block-start: $generic-tabs-border;
}

.dx-tabs-nav-button {
border-block-start: $generic-tabs-border;
}
}

.dx-tabs-wrapper {
border-block-start: $generic-tabs-border-focus;
}

.dx-tabs-nav-button {
border-block-start: $generic-tabs-border-focus;
}
}

&:not(.dx-empty-collection) {
.dx-multiview-wrapper {
border-block-end: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@
.dx-tabs-wrapper {
border-inline-start: $generic-tabs-border;
border-inline-end: $generic-tabs-border;

@include dx-tabs-border-mixin(
$generic-tabs-border,
none,
$generic-tabs-border,
none,
);
}

.dx-tabs .dx-tabs-scrollable {
Expand All @@ -39,26 +32,6 @@
}
}

&.dx-state-focused {
&.dx-disabled-focused-tab {
.dx-tabs-wrapper {
border-inline-end: $generic-tabs-border;
}

.dx-tabs-nav-button {
border-inline-end: $generic-tabs-border;
}
}

.dx-tabs-wrapper {
border-inline-end: $generic-tabs-border-focus;
}

.dx-tabs-nav-button {
border-inline-end: $generic-tabs-border-focus;
}
}

&:not(.dx-empty-collection) {
.dx-multiview-wrapper {
border-inline-start: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@
.dx-tabs-wrapper {
border-inline-start: $generic-tabs-border;
border-inline-end: $generic-tabs-border;

@include dx-tabs-border-mixin(
$generic-tabs-border,
none,
$generic-tabs-border,
none,
);
}

.dx-tabs .dx-tabs-scrollable {
Expand All @@ -39,26 +32,6 @@
}
}

&.dx-state-focused {
&.dx-disabled-focused-tab {
.dx-tabs-wrapper {
border-inline-start: $generic-tabs-border;
}

.dx-tabs-nav-button {
border-inline-start: $generic-tabs-border;
}
}

.dx-tabs-wrapper {
border-inline-start: $generic-tabs-border-focus;
}

.dx-tabs-nav-button {
border-inline-start: $generic-tabs-border-focus;
}
}

&:not(.dx-empty-collection) {
.dx-multiview-wrapper {
border-inline-end: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,6 @@
}
}

&.dx-state-focused {
&.dx-disabled-focused-tab {
.dx-tabs-wrapper {
border-block-end: $generic-tabs-border;
}

.dx-tabs-nav-button {
border-block-end: $generic-tabs-border;
}
}

.dx-tabs-wrapper {
border-block-end: $generic-tabs-border-focus;
}

.dx-tabs-nav-button {
border-block-end: $generic-tabs-border-focus;
}
}

&:not(.dx-empty-collection) {
.dx-multiview-wrapper {
border-block-start: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
.dx-tabpanel-tab {
padding: $generic-tabpanel-tabs-item-padding;

&.dx-state-focused::after {
border-color: $tabs-border-color;
}

&.dx-state-disabled {
&::after {
z-index: 3;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,40 +14,9 @@

.dx-tabpanel-tabs-position-bottom {
.dx-tabpanel-tab {
&:first-child:not(.dx-state-focused, .dx-tab-selected) {
&.dx-state-hover {
@include dx-tabs-border-mixin(
$generic-tabpanel-tab-border-hover-bottom,
null,
null,
$generic-tabs-border-transparent,
);
}
}

&:last-child:not(.dx-state-focused, .dx-tab-selected) {
&.dx-state-hover {
@include dx-tabs-border-mixin(
$generic-tabpanel-tab-border-hover-bottom,
$generic-tabs-border-transparent,
null,
null,
);
}
}

&.dx-state-hover {
@include dx-tabs-border-mixin(
$generic-tabpanel-tab-border-hover-bottom,
null,
null,
null,
);
}

&.dx-tab-selected {
@include dx-tabs-border-mixin(
none,
$generic-tabpanel-tab-border-transparent,
null,
null,
null,
Expand All @@ -56,78 +25,8 @@
border-block-start: $generic-tabpanel-tab-border-selected-bottom;
}

&.dx-state-active {
@include dx-tabs-border-mixin(
$generic-tabpanel-tab-border-active-bottom,
null,
null,
null,
);
}

&.dx-state-focused:not(.dx-state-disabled) {
@include dx-tabs-border-mixin(
none,
null,
null,
null,
);

border-block-start: $generic-tabpanel-tab-border-focused-bottom;
}

&.dx-state-disabled:not(.dx-state-focused) {
@include dx-tabs-border-mixin(
null,
none,
null,
null,
);

border-block-start: $generic-tabs-border;
}

&.dx-state-disabled.dx-state-focused {
@include dx-tabs-border-mixin(
none,
null,
null,
null,
);

border-block-start: $generic-tabs-border-focused-disabled-bottom;
}

&.dx-tab-selected,
&.dx-state-focused,
&.dx-state-disabled {
&.dx-tab-selected {
margin-block-start: -$generic-tabs-border-width;
}
}

&.dx-state-focused {
&.dx-disabled-focused-tab {
.dx-tabpanel-tab.dx-state-disabled:not(.dx-state-focused) {
@include dx-tabs-border-mixin(
none,
null,
null,
null,
);

border-block-start: $generic-tabs-border;
}
}

.dx-tabpanel-tab.dx-state-disabled:not(.dx-state-focused) {
@include dx-tabs-border-mixin(
null,
none,
null,
null,
);

border-block-start: $generic-tabs-border-focus;
}
}
}
Loading
Loading