diff --git a/packages/components/package-lock.json b/packages/components/package-lock.json index 38b86638ce..d8cb7dee95 100644 --- a/packages/components/package-lock.json +++ b/packages/components/package-lock.json @@ -1,12 +1,12 @@ { "name": "@labkey/components", - "version": "2.398.0", + "version": "2.399.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@labkey/components", - "version": "2.398.0", + "version": "2.399.0", "license": "SEE LICENSE IN LICENSE.txt", "dependencies": { "@labkey/api": "1.27.0", diff --git a/packages/components/package.json b/packages/components/package.json index 7179663212..e9d3de104f 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -1,6 +1,6 @@ { "name": "@labkey/components", - "version": "2.398.0", + "version": "2.399.0", "description": "Components, models, actions, and utility functions for LabKey applications and pages", "sideEffects": false, "files": [ diff --git a/packages/components/releaseNotes/components.md b/packages/components/releaseNotes/components.md index bb703ffb41..7b2229795d 100644 --- a/packages/components/releaseNotes/components.md +++ b/packages/components/releaseNotes/components.md @@ -1,6 +1,11 @@ # @labkey/components Components, models, actions, and utility functions for LabKey applications and pages. +### version 2.399.0 +*Released*: 15 December 2023 +- Consolidate move entities to MoveRowsAction in query controller + - update API call controller and actions and update params to match new moveRows API format + ### version 2.398.0 *Released*: 14 December 2023 - In-app messaging for product updates diff --git a/packages/components/src/internal/components/base/Grid.test.tsx b/packages/components/src/internal/components/base/Grid.test.tsx index 84f68307fd..8c3527afb2 100644 --- a/packages/components/src/internal/components/base/Grid.test.tsx +++ b/packages/components/src/internal/components/base/Grid.test.tsx @@ -280,6 +280,10 @@ describe('Grid', () => { }); describe('GridHeader', () => { + beforeAll(() => { + global.console.error = jest.fn(); + }); + const DEFAULT_PROPS = { showHeader: true, columns: List.of( diff --git a/packages/components/src/internal/components/domainproperties/assay/__snapshots__/AssayDesignerPanels.spec.tsx.snap b/packages/components/src/internal/components/domainproperties/assay/__snapshots__/AssayDesignerPanels.spec.tsx.snap index 401700aed6..6e09581ce0 100644 --- a/packages/components/src/internal/components/domainproperties/assay/__snapshots__/AssayDesignerPanels.spec.tsx.snap +++ b/packages/components/src/internal/components/domainproperties/assay/__snapshots__/AssayDesignerPanels.spec.tsx.snap @@ -727,8 +727,6 @@ exports[`AssayDesignerPanels appPropertiesOnly for new assay 1`] = ` "schemaName": "exp", "viewName": undefined, }, - "moveActionName": "moveAssayRuns", - "moveControllerName": "assay", "nounAsParentPlural": "Assay Runs", "nounAsParentSingular": "Assay Run", "nounPlural": "runs", @@ -2564,8 +2562,6 @@ exports[`AssayDesignerPanels appPropertiesOnly with initModel 1`] = ` "schemaName": "exp", "viewName": undefined, }, - "moveActionName": "moveAssayRuns", - "moveControllerName": "assay", "nounAsParentPlural": "Assay Runs", "nounAsParentSingular": "Assay Run", "nounPlural": "runs", diff --git a/packages/components/src/internal/components/domainproperties/dataclasses/DataClassDesigner.spec.tsx b/packages/components/src/internal/components/domainproperties/dataclasses/DataClassDesigner.spec.tsx deleted file mode 100644 index 3795914ea4..0000000000 --- a/packages/components/src/internal/components/domainproperties/dataclasses/DataClassDesigner.spec.tsx +++ /dev/null @@ -1,126 +0,0 @@ -import React from 'react'; -import { mount, shallow } from 'enzyme'; - -import { List } from 'immutable'; -import { getTestAPIWrapper } from '../../../APIWrapper'; - -import { PROPERTIES_PANEL_ERROR_MSG } from '../constants'; -import getDomainDetailsJSON from '../../../../test/data/dataclass-getDomainDetails.json'; -import DomainForm from '../DomainForm'; - -import { waitForLifecycle } from '../../../test/enzymeTestHelpers'; - -import { FileAttachmentForm } from '../../../../public/files/FileAttachmentForm'; - -import { Alert } from '../../base/Alert'; - -import { SystemFields } from '../SystemFields'; - -import { DataClassPropertiesPanel } from './DataClassPropertiesPanel'; -import { DataClassModel } from './models'; -import { DataClassDesigner, DataClassDesignerImpl } from './DataClassDesigner'; - -const BASE_PROPS = { - api: getTestAPIWrapper(jest.fn), - onComplete: jest.fn(), - onCancel: jest.fn(), - loadNameExpressionOptions: jest.fn(async () => ({ prefix: '', allowUserSpecifiedNames: true })), - testMode: true, -}; - -describe('DataClassDesigner', () => { - test('default properties', async () => { - const form = ( - - ); - - const tree = shallow(form); - - await waitForLifecycle(tree); - - expect(tree).toMatchSnapshot(); - }); - - test('custom properties', async () => { - const form = ( - - ); - - const tree = shallow(form); - - await waitForLifecycle(tree); - - expect(tree).toMatchSnapshot(); - }); - - test('initModel', async () => { - const form = ( - - ); - const wrapped = shallow(form); - await waitForLifecycle(wrapped); - - expect(wrapped.find(DataClassPropertiesPanel)).toHaveLength(1); - expect(wrapped.find(DomainForm)).toHaveLength(1); - expect(wrapped.find(FileAttachmentForm)).toHaveLength(0); - expect(wrapped).toMatchSnapshot(); - wrapped.unmount(); - }); - - test('open fields panel', async () => { - const wrapped = mount(); - await waitForLifecycle(wrapped); - - const panelHeader = wrapped.find('div#domain-header'); - expect(wrapped.find('#domain-header').at(1).hasClass('domain-panel-header-collapsed')).toBeTruthy(); - panelHeader.simulate('click'); - expect(wrapped.find('#domain-header').at(1).hasClass('domain-panel-header-expanded')).toBeTruthy(); - expect(wrapped.find(FileAttachmentForm)).toHaveLength(1); - expect(wrapped.find(SystemFields)).toHaveLength(1); - - expect(wrapped.find(Alert)).toHaveLength(2); - expect(wrapped.find(Alert).at(0).text()).toEqual(PROPERTIES_PANEL_ERROR_MSG); - expect(wrapped.find(Alert).at(1).text()).toEqual( - 'Please correct errors in the properties panel before saving.' - ); - wrapped.unmount(); - }); -}); diff --git a/packages/components/src/internal/components/domainproperties/dataclasses/DataClassDesigner.test.tsx b/packages/components/src/internal/components/domainproperties/dataclasses/DataClassDesigner.test.tsx new file mode 100644 index 0000000000..90fdb2ff12 --- /dev/null +++ b/packages/components/src/internal/components/domainproperties/dataclasses/DataClassDesigner.test.tsx @@ -0,0 +1,129 @@ +import React from 'react'; +import { act, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import { List } from 'immutable'; + +import { getTestAPIWrapper } from '../../../APIWrapper'; +import { renderWithAppContext } from '../../../test/reactTestLibraryHelpers'; + +import { PROPERTIES_PANEL_ERROR_MSG } from '../constants'; +import getDomainDetailsJSON from '../../../../test/data/dataclass-getDomainDetails.json'; + +import { DataClassModel } from './models'; +import { DataClassDesigner, DataClassDesignerImpl } from './DataClassDesigner'; + +const BASE_PROPS = { + api: getTestAPIWrapper(jest.fn), + onComplete: jest.fn(), + onCancel: jest.fn(), + loadNameExpressionOptions: jest.fn(async () => ({ prefix: '', allowUserSpecifiedNames: true })), + testMode: true, +}; + +describe('DataClassDesigner', () => { + beforeAll(() => { + global.console.error = jest.fn(); + }); + + test('default properties', async () => { + const component = ( + + ); + await act(async () => { + const { container } = renderWithAppContext(component); + expect(container).toMatchSnapshot(); + }); + + expect(document.querySelectorAll('#dataclass-properties-hdr').length).toBe(1); + expect(document.querySelectorAll('.domain-form-panel').length).toBe(2); + expect(screen.getByText('Import or infer fields from file')).toBeInTheDocument(); + }); + + test('custom properties', async () => { + const component = ( + + ); + await act(async () => { + const { container } = renderWithAppContext(component); + expect(container).toMatchSnapshot(); + }); + + expect(document.querySelectorAll('#dataclass-properties-hdr').length).toBe(1); + expect(document.querySelectorAll('.domain-form-panel').length).toBe(2); + expect(screen.getByText('Import or infer fields from file')).toBeInTheDocument(); + }); + + test('initModel', async () => { + const component = ( + + ); + await act(async () => { + const { container } = renderWithAppContext(component); + expect(container).toMatchSnapshot(); + }); + + expect(document.querySelectorAll('#dataclass-properties-hdr').length).toBe(1); + expect(document.querySelectorAll('.domain-form-panel').length).toBe(2); + expect(screen.queryByText('Import or infer fields from file')).not.toBeInTheDocument(); + }); + + test('open fields panel', async () => { + const component = ; + await act(async () => { + renderWithAppContext(component); + }); + + let panelHeader = document.querySelector('div#domain-header'); + expect(panelHeader?.classList.contains('domain-panel-header-collapsed')).toBeTruthy(); + expect(panelHeader?.classList.contains('domain-panel-header-expanded')).toBeFalsy(); + userEvent.click(panelHeader); + + panelHeader = document.querySelector('div#domain-header'); + expect(panelHeader?.classList.contains('domain-panel-header-collapsed')).toBeFalsy(); + expect(panelHeader?.classList.contains('domain-panel-header-expanded')).toBeTruthy(); + expect(screen.queryByText('Import or infer fields from file')).toBeInTheDocument(); + expect(document.querySelectorAll('.domain-system-fields').length).toBe(1); + + expect(document.querySelectorAll('.alert').length).toBe(2); + expect(screen.queryByText(PROPERTIES_PANEL_ERROR_MSG)).toBeInTheDocument(); + expect(screen.queryByText('Please correct errors in the properties panel before saving.')).toBeInTheDocument(); + }); +}); diff --git a/packages/components/src/internal/components/domainproperties/dataclasses/__snapshots__/DataClassDesigner.spec.tsx.snap b/packages/components/src/internal/components/domainproperties/dataclasses/__snapshots__/DataClassDesigner.spec.tsx.snap deleted file mode 100644 index 45d8f689ab..0000000000 --- a/packages/components/src/internal/components/domainproperties/dataclasses/__snapshots__/DataClassDesigner.spec.tsx.snap +++ /dev/null @@ -1,1558 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`DataClassDesigner custom properties 1`] = ` - - - - - - -`; - -exports[`DataClassDesigner default properties 1`] = ` - - - - - -`; - -exports[`DataClassDesigner initModel 1`] = ` - - - - - -`; diff --git a/packages/components/src/internal/components/domainproperties/dataclasses/__snapshots__/DataClassDesigner.test.tsx.snap b/packages/components/src/internal/components/domainproperties/dataclasses/__snapshots__/DataClassDesigner.test.tsx.snap new file mode 100644 index 0000000000..08f9d633db --- /dev/null +++ b/packages/components/src/internal/components/domainproperties/dataclasses/__snapshots__/DataClassDesigner.test.tsx.snap @@ -0,0 +1,3427 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`DataClassDesigner custom properties 1`] = ` +
+
+
+
+ + Source Properties + + + + +
+
+
+
+
+
+ header text test +
+
+ +
+
+
+
+ + Name + * + +
+
+ +
+
+
+
+ + Description + + + + + +
+
+ +
+
+
+
+
+ Naming + + Pattern + + + + + +
+
+
+ +
+
+
+
+
+ + Category + + +
+
+
+
+
+ + +
+
+
+ Loading... +
+
+ +
+
+
+ + +
+
+
+
+
+
+
+
+
+ Sample + + Type + + + + + +
+
+
+
+
+ + +
+
+
+ Loading... +
+
+ +
+
+
+ + +
+
+
+
+
+
+
+
+
+
+
+
+ + + + + Fields + + + + + + 3 Fields Defined + +
+
+
+
+
+
+ +
+
+ Default System Fields +
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Enabled + + Name + + Label + + Data Type + + Required + + Description +
+ + + Name + + Source ID + + Text + + + + Contains a short name for this data object +
+ + + Description + + Description + + Text + + + + Contains a description for this data object +
+
+
+
+ Custom Fields +
+
+
+
+
+ + + Add + Field + +
+
+
+
+ + + Delete + +
+
+
+
+ + + + Export + +
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+ 0 + + fields + selected + +
+
+
+
+
+
+ +
+
+
+
+
+ + Name * + +
+
+ + Data Type * + +
+
+ + Required + +
+
+
+ + Details + +
+
+
+
+
+
+
+
+
+
+ + +
+
+
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+
+
+
+
+
+
+ + + +
+
+
+
+
+
+
+
+
+
+
+
+
+ Text Options +
+
+
+
+
+
+ Maximum Text + + Length + + + + + +
+
+
+
+
+ +
+ Unlimited +
+
+
+
+
+ + + No longer than + + characters + +
+
+
+
+
+
+
+
+
+ Name and Linking Options +
+
+
+
+
+
+ Description +
+