Skip to content

Instantly share code, notes, and snippets.

@bfagundez
Last active March 23, 2023 23:21
Show Gist options
  • Save bfagundez/542b6e376745cc05338853ea39f9a218 to your computer and use it in GitHub Desktop.
Save bfagundez/542b6e376745cc05338853ea39f9a218 to your computer and use it in GitHub Desktop.
/* eslint-disable */
/**
* @jest-environment jsdom
*/
import { shallowMountQuasar } from '~/test/jest/utils'
import DataGrid from 'components/data/DataGrid.vue'
describe('DataGrid', () => {
const testSubject = shallowMountQuasar(DataGrid, {
propsData: {
dataSetId: 'dataSet1234567890',
dataTypeId: 'dataType1234567890',
dataTypeName: 'dataType Name',
data: [],
headers: [],
enableRelationshipManager: true,
enableDeleteRow: false,
enableEditResponse: false,
columnToScrollTo: null,
dataCollector: false,
rowCount: 0,
},
mocks: {
$entity: {
COLUMN: 'bogus',
DATASET: 'bogus'
},
$can: jest.fn(),
windowHeight: 1000,
elTop: 200,
},
modules: {
app: {
namespaced: true,
getters: {
gridDirty: () => false
}
},
editTables: {
namespaced: true,
getters: {
editMode: () => true,
gridUpdatedData: () => []
}
},
permissionSet: {
namespaced: true,
getters: {
userRecordPermission: () => jest.fn()
}
},
editions: {
namespaced: true,
getters: {
getCurrentEditionDataTableLimit: () => ({ maxColumnsSize })
}
}
}
})
describe('Menu Items on columns', () => {
it('disables Manage Relationship if column has renamed values', () => {
expect(testSubject.vm).toBeTruthy()
const thisStuff = testSubject.vm.getMainMenuItemStandard({
defaultItems: [],
column: {
colDef:{ headerName: 'test', fieldType: 'string' },
}
});
// validate option has been disabled
expect(thisStuff.something).toBe(true)
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment