Skip to content

Commit

Permalink
API changes affecting tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ianthomas23 committed Nov 11, 2024
1 parent d2150f4 commit 1248890
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 19 deletions.
7 changes: 0 additions & 7 deletions ipydatagrid/datagrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -1006,13 +1006,6 @@ def __init__(self, *args, debounce_delay=160, **kwargs):

self.on_msg(self._handle_comm_msg)

def transform(self, _):
# TODO Implement sorting and filtering backend-side?
raise RuntimeError(
"Setting filters and sorting rules to a "
"StreamingDataGrid is not supported."
)

@property
def data(self):
return super().data
Expand Down
2 changes: 1 addition & 1 deletion tests/js/arrayUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('Test multi index array utilities', () => {
);

// Creating a model
const testModel = new ViewBasedJSONModel(testData.data);
const testModel = new ViewBasedJSONModel({ datasource: testData.data });
// Generating an array with location of nested level headers
const mutltiIndexArrayLocations =
ArrayUtils.generateMultiIndexArrayLocations(testModel);
Expand Down
2 changes: 1 addition & 1 deletion tests/js/filterMenu.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ namespace Private {
export function createSimpleModel(
data: DataGenerator.ISingleColOptions,
): ViewBasedJSONModel {
const model = new ViewBasedJSONModel(DataGenerator.singleCol(data).data);
const model = new ViewBasedJSONModel({ datasource: DataGenerator.singleCol(data).data });
return model;
}

Expand Down
20 changes: 10 additions & 10 deletions tests/js/viewbasedjsonmodel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,31 +133,31 @@ describe('Test .uniqueValues()', () => {
{ name: 'col3', type: 'number', data: [100, 200, 100, 300, 200] },
],
});
const testModel = new ViewBasedJSONModel(testData.data);
test('cellregion-column-header-0', () => {
expect(testModel.uniqueValues('column-header', 'col1')).toEqual([
const testModel = new ViewBasedJSONModel({ datasource: testData.data });
test('cellregion-column-header-0', async () => {
expect(await testModel.uniqueValues('column-header', 'col1')).toEqual([
10,
20,
30,
40,
50,
]);
});
test('cellregion-column-header-1', () => {
expect(testModel.uniqueValues('column-header', 'col2')).toEqual([
test('cellregion-column-header-1', async () => {
expect(await testModel.uniqueValues('column-header', 'col2')).toEqual([
true,
false,
]);
});
test('cellregion-column-header-2', () => {
expect(testModel.uniqueValues('column-header', 'col3')).toEqual([
test('cellregion-column-header-2', async () => {
expect(await testModel.uniqueValues('column-header', 'col3')).toEqual([
100,
200,
300,
]);
});
test('cellregion-corner-header-0', () => {
expect(testModel.uniqueValues('corner-header', 'index')).toEqual([
test('cellregion-corner-header-0', async () => {
expect(await testModel.uniqueValues('corner-header', 'index')).toEqual([
'A',
'C',
'B',
Expand All @@ -172,7 +172,7 @@ namespace Private {
type: 'number',
data: [1, 2, 3, 4],
});
const model = new ViewBasedJSONModel(testData.data);
const model = new ViewBasedJSONModel({ datasource: testData.data });
return model;
}
}

0 comments on commit 1248890

Please sign in to comment.