Skip to content

Commit 1ec6b55

Browse files
PivotGrid - Fix focus color, type CellClickEvent with KeyboardEvent, add visual test
1 parent 00b82d1 commit 1ec6b55

7 files changed

Lines changed: 54 additions & 7 deletions

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import { createScreenshotsComparer } from 'devextreme-screenshot-comparer';
2+
import PivotGrid from 'devextreme-testcafe-models/pivotGrid';
3+
import { createWidget } from '../../../../helpers/createWidget';
4+
import url from '../../../../helpers/getPageUrl';
5+
import { testScreenshot } from '../../../../helpers/themeUtils';
6+
import { sales } from '../data';
7+
8+
fixture.disablePageReloads`pivotGrid_kbn_expandIcon`
9+
.page(url(__dirname, '../../../container.html'));
10+
11+
const PIVOT_GRID_SELECTOR = '#container';
12+
13+
test('Expandable cell should have a visible focus outline when focused by keyboard', async (t) => {
14+
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
15+
const pivotGrid = new PivotGrid(PIVOT_GRID_SELECTOR);
16+
17+
const expandableCell = pivotGrid.getRowsArea().getCell(0);
18+
19+
await t
20+
.click(expandableCell)
21+
.pressKey('tab')
22+
.pressKey('shift+tab');
23+
24+
await testScreenshot(t, takeScreenshot, 'pivotgrid_kbn_expandable_cell_focused.png', { element: pivotGrid.element });
25+
26+
await t
27+
.expect(compareResults.isValid())
28+
.ok(compareResults.errorMessages());
29+
}).before(async () => createWidget('dxPivotGrid', {
30+
width: 600,
31+
allowExpandAll: true,
32+
dataSource: {
33+
fields: [{
34+
dataField: 'region',
35+
area: 'row',
36+
expanded: false,
37+
}, {
38+
dataField: 'city',
39+
area: 'row',
40+
}, {
41+
dataField: 'date',
42+
area: 'column',
43+
}, {
44+
dataField: 'amount',
45+
area: 'data',
46+
summaryType: 'sum',
47+
dataType: 'number',
48+
}],
49+
store: sales,
50+
},
51+
}));

packages/devextreme-scss/scss/widgets/base/pivotGrid/_index.scss

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ $pivotgrid-grandtotalcolor: null !default;
1818
$pivotgrid-accent-color: null !default;
1919
$pivotgrid-empty-area-text-padding: null !default;
2020
$pivotgrid-button-top-padding: null !default;
21-
$base-focus-color: null !default;
2221

2322
@use "../mixins" as *;
2423
@use "../icon_fonts" as *;
@@ -130,7 +129,7 @@ $pivotgrid-expand-icon-text-offset: 0;
130129
.dx-pivotgrid {
131130
td[aria-expanded]:focus-visible {
132131
outline: 2px solid;
133-
outline-color: $base-focus-color;
132+
outline-color: $pivotgrid-accent-color;
134133
outline-offset: -2px;
135134
}
136135

packages/devextreme-scss/scss/widgets/fluent/pivotGrid/_index.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
$pivotgrid-accent-color: $pivotgrid-accent-color,
3131
$pivotgrid-empty-area-text-padding: $pivotgrid-empty-area-text-padding,
3232
$pivotgrid-button-top-padding: $pivotgrid-button-top-padding,
33-
$base-focus-color: $base-focus-color,
3433
);
3534

3635
// adduse

packages/devextreme-scss/scss/widgets/generic/pivotGrid/_index.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
$pivotgrid-accent-color: $pivotgrid-accent-color,
3030
$pivotgrid-empty-area-text-padding: $pivotgrid-empty-area-text-padding,
3131
$pivotgrid-button-top-padding: $pivotgrid-button-top-padding,
32-
$base-focus-color: $base-focus-color,
3332
);
3433

3534
// adduse

packages/devextreme-scss/scss/widgets/material/pivotGrid/_index.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
$pivotgrid-accent-color: $pivotgrid-accent-color,
3131
$pivotgrid-empty-area-text-padding: $pivotgrid-empty-area-text-padding,
3232
$pivotgrid-button-top-padding: $pivotgrid-button-top-padding,
33-
$base-focus-color: $base-focus-color,
3433
);
3534

3635
// adduse

packages/devextreme/js/ui/pivot_grid.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export type PivotGridTotalDisplayMode = 'both' | 'columns' | 'none' | 'rows';
5555
* @type object
5656
* @inherits Cancelable,NativeEventInfo
5757
*/
58-
export type CellClickEvent = Cancelable & NativeEventInfo<dxPivotGrid, MouseEvent | PointerEvent> & {
58+
export type CellClickEvent = Cancelable & NativeEventInfo<dxPivotGrid, KeyboardEvent | MouseEvent | PointerEvent> & {
5959
/** @docid _ui_pivot_grid_CellClickEvent.area */
6060
readonly area?: string;
6161
/** @docid _ui_pivot_grid_CellClickEvent.cellElement */

packages/devextreme/ts/dx.all.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24438,7 +24438,7 @@ declare module DevExpress.ui {
2443824438
export type CellClickEvent = DevExpress.common.core.events.Cancelable &
2443924439
DevExpress.common.core.events.NativeEventInfo<
2444024440
dxPivotGrid,
24441-
MouseEvent | PointerEvent
24441+
KeyboardEvent | MouseEvent | PointerEvent
2444224442
> & {
2444324443
/**
2444424444
* [descr:_ui_pivot_grid_CellClickEvent.area]

0 commit comments

Comments
 (0)