Skip to content

Commit

Permalink
fix missing use case
Browse files Browse the repository at this point in the history
  • Loading branch information
jcger committed May 3, 2023
1 parent 2ff49bf commit 7e22704
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,21 @@ describe('toggleColumn', () => {
]
`);
});

it('adds a column even if no column is currently shown', async () => {
expect(
toggleColumn({
column: { id: '_id', schema: 'string' },
columns: [],
defaultColumns: [],
})
).toMatchInlineSnapshot(`
Array [
Object {
"id": "_id",
"schema": "string",
},
]
`);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ const insert = ({
return [...columns.slice(0, defaultIndex), column, ...columns.slice(defaultIndex)];
}

if (columns.length === 0) {
return [column];
}

// if the column isn't shown and it's not part of the default config
// push it into the second position. Behaviour copied by t_grid, security
// does this to insert right after the timestamp column
Expand Down

0 comments on commit 7e22704

Please sign in to comment.