-
Notifications
You must be signed in to change notification settings - Fork 2
Issue 52959: LKSM/LKB: Existing file not shown in Bulk Edit #1801
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
eb3d434
Issue 52959: LKSM/LKB: Existing file not shown in Bulk Edit
XingY fd9a9fc
Issue 52959: LKSM/LKB: Existing file not shown in Bulk Edit
XingY bf95acc
code review changes
XingY bc02028
lint
XingY 019f57b
code review changes
XingY 6d1b08f
Merge branch 'develop' into fb_fileIssues256
XingY 22362fa
Merge branch 'develop' into fb_fileIssues256
XingY 1a11268
code review changes
XingY 3790e8c
add test for moving multiple runs
XingY 61ef9e4
Merge branch 'develop' into fb_fileIssues256
XingY 3cb6b59
Merge branch 'develop' into fb_fileIssues256
XingY File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 0 additions & 83 deletions
83
packages/components/src/internal/components/forms/BulkUpdateForm.spec.tsx
This file was deleted.
Oops, something went wrong.
120 changes: 120 additions & 0 deletions
120
packages/components/src/internal/components/forms/BulkUpdateForm.test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| import React from 'react'; | ||
| import { render, waitFor } from '@testing-library/react'; | ||
| import { fromJS, List } from 'immutable'; | ||
|
|
||
| import { QueryColumn } from '../../../public/QueryColumn'; | ||
| import { QueryInfo } from '../../../public/QueryInfo'; | ||
|
|
||
| import { GridResponse } from '../editable/models'; | ||
|
|
||
| import { getTestAPIWrapper } from '../../APIWrapper'; | ||
|
|
||
| import { BulkUpdateForm, BulkUpdateFormProps } from './BulkUpdateForm'; | ||
|
|
||
| const COLUMN_CAN_UPDATE = new QueryColumn({ | ||
| fieldKey: 'update', | ||
| name: 'update', | ||
| caption: 'update', | ||
| fieldKeyArray: ['update'], | ||
| shownInUpdateView: true, | ||
| userEditable: true, | ||
| }); | ||
| const COLUMN_CANNOT_UPDATE = new QueryColumn({ | ||
| fieldKey: 'neither', | ||
| name: 'neither', | ||
| caption: 'neither', | ||
| fieldKeyArray: ['neither'], | ||
| shownInUpdateView: false, | ||
| userEditable: true, | ||
| }); | ||
| const COLUMN_FILE_INPUT = new QueryColumn({ | ||
| fieldKey: 'fileInput', | ||
| name: 'fileInput', | ||
| caption: 'fileInput', | ||
| fieldKeyArray: ['fileInput'], | ||
| shownInUpdateView: true, | ||
| userEditable: true, | ||
| inputType: 'file', | ||
| }); | ||
| const SCHEMA = 'samples'; | ||
| const QUERY = 'testST'; | ||
| const QUERY_INFO = QueryInfo.fromJsonForTests({ | ||
| name: QUERY, | ||
| schemaName: SCHEMA, | ||
| columns: { | ||
| update: COLUMN_CAN_UPDATE, | ||
| neither: COLUMN_CANNOT_UPDATE, | ||
| fileInput: COLUMN_FILE_INPUT, | ||
| }, | ||
| }); | ||
|
|
||
| const DEFAULT_PROPS: BulkUpdateFormProps = { | ||
| api: getTestAPIWrapper(jest.fn), | ||
| onComplete: jest.fn(), | ||
| onCancel: jest.fn(), | ||
| onSubmitForEdit: jest.fn(), | ||
| queryInfo: QUERY_INFO, | ||
| viewName: undefined, | ||
| selectedIds: [], | ||
| updateRows: jest.fn(), | ||
| }; | ||
|
|
||
| const mockGridResponse: GridResponse = { | ||
| data: fromJS({ | ||
| '127796': { | ||
| update: { | ||
| value: 'abc', | ||
| }, | ||
| fileInput: { | ||
| value: '/trunk/build/deploy/files/LKSM/@files/sampletype/test.txt', | ||
| url: '/LKSM-dan/core-downloadFileLink.view?propertyId=82852', | ||
| displayValue: 'sampletype/test.txt', | ||
| }, | ||
| }, | ||
| '127797': { | ||
| update: { | ||
| value: 'abc', | ||
| }, | ||
| fileInput: { | ||
| value: '/trunk/build/deploy/files/LKSM/@files/sampletype/test.txt', | ||
| url: '/LKSM-dan/core-downloadFileLink.view?propertyId=82852', | ||
| displayValue: 'sampletype/test.txt', | ||
| }, | ||
| }, | ||
| }), | ||
| dataIds: List(['127796', '127797']), | ||
| }; | ||
|
|
||
| jest.mock('../../actions', () => ({ | ||
| ...jest.requireActual('../../actions'), | ||
| getSelectedDataDeprecated: jest.fn().mockImplementation(() => mockGridResponse), | ||
| })); | ||
|
|
||
| describe('BulkUpdateForm', () => { | ||
| // TODO missing test cases for main functionality of component | ||
| describe('columnFilter', () => { | ||
| test('filters without uniqueKeyField', async () => { | ||
| render(<BulkUpdateForm {...DEFAULT_PROPS} />); | ||
|
|
||
| await waitFor(() => { | ||
| expect(document.querySelectorAll('.query-info-form')).toHaveLength(1); | ||
| }); | ||
| expect(document.querySelectorAll('.toggle-group-icon')).toHaveLength(2); | ||
| expect(document.querySelectorAll('input#update')).toHaveLength(1); | ||
| expect(document.querySelector('input#update').getAttribute('value')).toBe('abc'); | ||
| expect(document.querySelectorAll('.attachment-card__name')).toHaveLength(1); | ||
| expect(document.querySelector('.attachment-card__name')).toHaveTextContent('test.txt'); | ||
| }); | ||
|
|
||
| test('filters with uniqueFieldKey', async () => { | ||
| render(<BulkUpdateForm {...DEFAULT_PROPS} uniqueFieldKey="update" />); | ||
|
|
||
| await waitFor(() => { | ||
| expect(document.querySelectorAll('.query-info-form')).toHaveLength(1); | ||
| }); | ||
| expect(document.querySelectorAll('.toggle-group-icon')).toHaveLength(1); | ||
| expect(document.querySelectorAll('input#update')).toHaveLength(0); | ||
| expect(document.querySelectorAll('.attachment-card__name')).toHaveLength(1); | ||
| }); | ||
| }); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.