1
0
mirror of https://gitlab.com/bramw/baserow.git synced 2024-11-21 15:27:53 +00:00
bramw_baserow/web-frontend/test/fixtures/grid.js
2024-06-25 07:27:14 +00:00

36 lines
930 B
JavaScript

export function createGridRows(mock, gridView, fields, rows = []) {
const fieldOptions = {}
for (let i = 1; i < fields.length; i++) {
fieldOptions[i] = {
width: 200,
hidden: false,
order: i,
}
}
mock.onGet(`/database/views/grid/${gridView.id}/`).reply(200, {
count: rows.length,
results: rows,
field_options: fieldOptions,
})
}
export function createPublicGridViewRows(mock, viewSlug, fields, rows = []) {
const fieldOptions = {}
for (let i = 1; i < fields.length; i++) {
fieldOptions[i] = {
width: 200,
hidden: false,
order: i,
}
}
mock.onGet(`/database/views/grid/${viewSlug}/public/rows/`).reply(200, {
count: rows.length,
results: rows,
field_options: fieldOptions,
})
}
export function deleteGridRow(mock, tableId, rowId, responseCode = 204) {
mock.onDelete(`/database/rows/table/${tableId}/${rowId}/`).reply(responseCode)
}