Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mollykreis committed Mar 8, 2024
1 parent d882e9a commit 62e20e0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import type { TableRecord } from '../../../table/types';
import { TablePageObject } from '../../../table/testing/table.pageobject';
import { TableColumnDateTextPageObject } from '../testing/table-column-date-text.pageobject';
import { lang, themeProviderTag } from '../../../theme-provider';
import { DateTextFormat } from '../types';

interface SimpleTableRecord extends TableRecord {
field?: number | null;
Expand Down Expand Up @@ -515,49 +516,37 @@ describe('TableColumnDateText', () => {
{
name: 'value is not specified',
data: [{}],
cellValue: '',
groupValue: 'No value',
usesColumnPlaceholder: true
groupValue: 'No value'
},
{
name: 'value is undefined',
data: [{ field: undefined }],
cellValue: '',
groupValue: 'No value',
usesColumnPlaceholder: true
groupValue: 'No value'
},
{
name: 'value is null',
data: [{ field: null }],
cellValue: '',
groupValue: 'No value',
usesColumnPlaceholder: true
groupValue: 'No value'
},
{
name: 'value is Number.NaN',
data: [{ field: Number.NaN }],
cellValue: '',
groupValue: '',
usesColumnPlaceholder: false
groupValue: ''
},
{
name: 'value is valid and non-zero',
data: [{ field: 1708984169258 }],
cellValue: 'Feb 26, 2024, 3:49:29 PM',
groupValue: 'Feb 26, 2024, 3:49:29 PM',
usesColumnPlaceholder: false
groupValue: '2/26/2024'
},
{
name: 'value is incorrect type',
data: [{ field: 'not a number' as unknown as number }],
cellValue: '',
groupValue: '',
usesColumnPlaceholder: false
groupValue: ''
},
{
name: 'value is specified and falsey',
data: [{ field: 0 }],
groupValue: 'Dec 31, 1969, 6:00:00 PM'
groupValue: '1/1/1970'
},
{
name: 'value is Inf',
Expand Down Expand Up @@ -590,6 +579,10 @@ describe('TableColumnDateText', () => {
spec(
`group row renders expected value when ${name}`,
async () => {
// 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;
column.customTimeZone = 'UTC';
await table.setData(value.data);
await connect();
await waitForUpdatesAsync();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export abstract class TableColumnTextGroupHeaderViewBase<
* Text to render in the cell.
*
* The value is initialized to `tableGroupRowNoValuePlaceholder` because if the group
* row never has a value defined on it, the change handlers in the implementation may
* never get called but the text needs to be correct.
* row never has a value defined on it, the change handlers may never get called but
* the text needs to be correct.
*/
@observable
public text = tableGroupRowNoValuePlaceholderLabel.getValueFor(this);
Expand Down

0 comments on commit 62e20e0

Please sign in to comment.