Skip to content

Commit

Permalink
fix: use same text color for excluded and selectedExcluded (#1147)
Browse files Browse the repository at this point in the history
* fix: use same text color for excluded and selectedExcluded

* test: add rendering tests

* fix: lock icon on locked excluded
  • Loading branch information
T-Wizard committed Mar 15, 2023
1 parent 94049ec commit 48c85d4
Show file tree
Hide file tree
Showing 6 changed files with 160 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function RowColumn({ index, rowIndex, columnIndex, style, data }) {
const handleKeyDownCallback = useCallback(getFieldKeyboardNavigation({ ...actions, focusListItems }), [actions]);

const cell = useMemo(() => getCellFromPages({ pages, cellIndex }), [pages, cellIndex]);
const isSelected = cell?.qState === 'S' || cell?.qState === 'XS' || cell?.qState === 'L';
const isSelected = cell?.qState === 'S' || cell?.qState === 'XS' || cell?.qState === 'L' || cell?.qState === 'XL';

const classArr = useMemo(
() => getValueStateClasses({ column, histogram, checkboxes, cell, showGray }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const RowColRoot = styled('div', {
[`& .${classes.XS}`]: {
...getSelectedStyle({ theme }),
background: theme.palette.selected.excluded,
color: theme.palette.selected.mainContrastText,
color: theme.palette.selected.excludedContrastText,
border: isGridMode ? 'none' : undefined,
},

Expand Down
79 changes: 79 additions & 0 deletions test/rendering/listbox/__fixtures__/locked_states.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
const fixture = {
getLayout: () => ({
title: 'Field title',
qInfo: {
qId: 'qId',
},
visualization: 'listbox',
qListObject: {
qDimensionInfo: {
qLocked: true,
},
qSize: {
qcy: 5,
},
qInitialDataFetch: [{ qLeft: 0, qWidth: 0, qTop: 0, qHeight: 0 }],
},
qSelectionInfo: {
qInSelections: false,
},
layoutOptions: {
layoutOrder: 'row',
},
}),
getListObjectData: () => [
{
qMatrix: [
[
{
qText: 'Locked',
qNum: 'NaN',
qElemNumber: 0,
qState: 'L',
},
],
[
{
qText: 'Alternative',
qNum: 'NaN',
qElemNumber: 1,
qState: 'A',
},
],
[
{
qText: 'Optional',
qNum: 'NaN',
qElemNumber: 2,
qState: 'O',
},
],
[
{
qText: 'Locked Excluded',
qNum: 'NaN',
qElemNumber: 3,
qState: 'XL',
},
],
[
{
qText: 'Excluded',
qNum: 'NaN',
qElemNumber: 4,
qState: 'X',
},
],
],
qTails: [],
qArea: {
qLeft: 0,
qTop: 0,
qWidth: 1,
qHeight: 5,
},
},
],
};

export default fixture;
79 changes: 79 additions & 0 deletions test/rendering/listbox/__fixtures__/not_locked_states.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
const fixture = {
getLayout: () => ({
title: 'Field title',
qInfo: {
qId: 'qId',
},
visualization: 'listbox',
qListObject: {
qDimensionInfo: {
qLocked: false,
},
qSize: {
qcy: 5,
},
qInitialDataFetch: [{ qLeft: 0, qWidth: 0, qTop: 0, qHeight: 0 }],
},
qSelectionInfo: {
qInSelections: false,
},
layoutOptions: {
layoutOrder: 'row',
},
}),
getListObjectData: () => [
{
qMatrix: [
[
{
qText: 'Selected',
qNum: 'NaN',
qElemNumber: 0,
qState: 'S',
},
],
[
{
qText: 'Alternative',
qNum: 'NaN',
qElemNumber: 1,
qState: 'A',
},
],
[
{
qText: 'Optional',
qNum: 'NaN',
qElemNumber: 2,
qState: 'O',
},
],
[
{
qText: 'Selected Excluded',
qNum: 'NaN',
qElemNumber: 3,
qState: 'XS',
},
],
[
{
qText: 'Excluded',
qNum: 'NaN',
qElemNumber: 4,
qState: 'X',
},
],
],
qTails: [],
qArea: {
qLeft: 0,
qTop: 0,
qWidth: 1,
qHeight: 5,
},
},
],
};

export default fixture;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 48c85d4

Please sign in to comment.