Skip to content

Commit

Permalink
format + minor update
Browse files Browse the repository at this point in the history
  • Loading branch information
mollykreis committed Mar 21, 2024
1 parent 8aeecbd commit 610dbed
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ import {
controlLabelFont,
controlLabelFontColor
} from '../../../theme-provider/design-tokens';
import { placeholderStates, type PlaceholderState } from '../../../utilities/tests/states';
import {
placeholderStates,
type PlaceholderState
} from '../../../utilities/tests/states';

const metadata: Meta = {
title: 'Tests/Table Column: Anchor',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The <Tag name={tableColumnAnchorTag}/> column is used to display string fields a
- Do not provide `null`, `undefined`, empty, or whitespace labels with non-empty urls.
- Do not provide duplicate labels for different urls.
- If a label is not available or known for a url, the url itself may be explicitly provided for the label to ensure each distinct url has a distinct label.
- For records without a url, the label may also be omitted, but the omitted label should be consistent in using `null`, `undefined`, or empty string.
- For records without a url, the label may also be omitted. All omitted labels should consistently use `null`, `undefined`, or empty string but not a combination of those values.

### Target Configuration

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,10 @@ describe('TableColumnAnchor', () => {
}
];

async function initializeColumnAndTable(data: readonly SimpleTableRecord[], placeholder?: string): Promise<void> {
async function initializeColumnAndTable(
data: readonly SimpleTableRecord[],
placeholder?: string
): Promise<void> {
column.placeholder = placeholder;
await table.setData(data);
await connect();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ export const sharedTableActions = [

export const columnOperationBehavior = 'Column operations, such as sorting and grouping, are performed on the field values in the data records, not on the formatted values displayed within the cells.';

export const noNullAndUndefinedBestPractice = 'Avoid mixing `undefined` and `null` as values for the same field. When grouping this will lead to two groups (one for `null` values and one for `undefined` values) that both have the text `"No value"`.'
export const noNullAndUndefinedBestPractice = 'Avoid mixing `undefined` and `null` as values for the same field. When grouping this will lead to two groups (one for `null` values and one for `undefined` values) that both have the text `"No value"`.';
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ import {
controlLabelFont,
controlLabelFontColor
} from '../../../theme-provider/design-tokens';
import { placeholderStates, type PlaceholderState } from '../../../utilities/tests/states';
import {
placeholderStates,
type PlaceholderState
} from '../../../utilities/tests/states';

const metadata: Meta = {
title: 'Tests/Table Column: Date Text',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,10 @@ describe('TableColumnDateText', () => {
}
];

async function initializeColumnAndTable(data: readonly SimpleTableRecord[], placeholder?: string): Promise<void> {
async function initializeColumnAndTable(
data: readonly SimpleTableRecord[],
placeholder?: string
): Promise<void> {
// Set a custom time zone so that the behavior of the test does not
// depend on the configuration of the computer running the tests.
column.format = DateTextFormat.custom;
Expand All @@ -584,9 +587,9 @@ describe('TableColumnDateText', () => {
const expectedCellText = value.usesColumnPlaceholder
? placeholder
: value.cellValue;
expect(
pageObject.getRenderedCellContent(0, 0)
).toBe(expectedCellText);
expect(pageObject.getRenderedCellContent(0, 0)).toBe(
expectedCellText
);
expect(
pageObject.getRenderedGroupHeaderContent(0)
).toBe(value.groupValue);
Expand All @@ -600,9 +603,9 @@ describe('TableColumnDateText', () => {
async () => {
await initializeColumnAndTable(value.data);

expect(
pageObject.getRenderedCellContent(0, 0)
).toBe(value.cellValue);
expect(pageObject.getRenderedCellContent(0, 0)).toBe(
value.cellValue
);
expect(
pageObject.getRenderedGroupHeaderContent(0)
).toBe(value.groupValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import {
controlLabelFont,
controlLabelFontColor
} from '../../../theme-provider/design-tokens';
import { placeholderStates, type PlaceholderState } from '../../../utilities/tests/states';
import {
placeholderStates,
type PlaceholderState
} from '../../../utilities/tests/states';

const metadata: Meta = {
title: 'Tests/Table Column: Duration Text',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,10 @@ describe('TableColumnDurationText', () => {
}
];

async function initializeColumnAndTable(data: readonly SimpleTableRecord[], placeholder?: string): Promise<void> {
async function initializeColumnAndTable(
data: readonly SimpleTableRecord[],
placeholder?: string
): Promise<void> {
column.placeholder = placeholder;
await table.setData(data);
await connect();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ import {
controlLabelFontColor
} from '../../../theme-provider/design-tokens';
import { NumberTextAlignment } from '../types';
import { placeholderStates, type PlaceholderState } from '../../../utilities/tests/states';
import {
placeholderStates,
type PlaceholderState
} from '../../../utilities/tests/states';

const metadata: Meta = {
title: 'Tests/Table Column: Number Text',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { Canvas, Meta, Controls, Title } from '@storybook/blocks';
import { NimbleTableColumnNumberText } from './table-column-number-text.react';
import { columnOperationBehavior, noNullAndUndefinedBestPractice } from '../../base/tests/table-column-stories-utils';
import {
columnOperationBehavior,
noNullAndUndefinedBestPractice
} from '../../base/tests/table-column-stories-utils';
import * as tableColumnNumberTextStories from './table-column-number-text.stories';
import { tableColumnNumberTextTag } from '..';
import { tableTag } from '../../../table';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,10 @@ describe('TableColumnNumberText', () => {
}
];

async function initializeColumnAndTable(data: readonly SimpleTableRecord[], placeholder?: string): Promise<void> {
async function initializeColumnAndTable(
data: readonly SimpleTableRecord[],
placeholder?: string
): Promise<void> {
elementReferences.column1.placeholder = placeholder;
await table.setData(data);
await connect();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import {
controlLabelFont,
controlLabelFontColor
} from '../../../theme-provider/design-tokens';
import { placeholderStates, type PlaceholderState } from '../../../utilities/tests/states';
import {
placeholderStates,
type PlaceholderState
} from '../../../utilities/tests/states';

const metadata: Meta = {
title: 'Tests/Table Column: Text',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,10 @@ describe('TableColumnText', () => {
}
];

async function initializeColumnAndTable(data: readonly SimpleTableRecord[], placeholder?: string): Promise<void> {
async function initializeColumnAndTable(
data: readonly SimpleTableRecord[],
placeholder?: string
): Promise<void> {
column.placeholder = placeholder;
await table.setData(data);
await connect();
Expand Down

0 comments on commit 610dbed

Please sign in to comment.