Skip to content

Commit

Permalink
Merge branch 'release/2021-07'
Browse files Browse the repository at this point in the history
  • Loading branch information
pusztaie committed Jul 20, 2021
2 parents 702a66a + 8ec7fc3 commit aac83da
Show file tree
Hide file tree
Showing 115 changed files with 4,999 additions and 6,679 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { pathWithQueryParams } from '../../../src/services/query-string-builder'

const contextMenuItems = ['Details', 'Copy to', 'Edit', 'Move to', 'Versions', 'Share', 'Delete', 'Set permissions']

describe('Grid context menu', () => {
before(() => {
cy.login()
cy.visit(pathWithQueryParams({ path: '/', newParams: { repoUrl: Cypress.env('repoUrl') } }))
})

it('right-click on a content in the grid makes context-menu open', () => {
cy.get('[data-test="drawer-menu-item-content"]').click()
cy.checkContextMenu({
selector: '[data-test="table-cell-it-workspace"]',
contextMenuItems,
clickAction: 'rightclick',
})
})

it('click on ... (Actions) in the grid makes context-menu open', () => {
cy.get('[data-test="drawer-menu-item-content"]').click()
cy.checkContextMenu({
selector: '[data-test="actions-button-it"]',
contextMenuItems,
clickAction: 'click',
})
})
})
13 changes: 5 additions & 8 deletions apps/sensenet/cypress/integration/tree/tree.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,10 @@ describe('Tree', () => {
it('Right click on the Tree item should make context-menu open.', () => {
const contextMenuItems = ['Details', 'Copy to', 'Edit', 'Move to', 'Versions', 'Share', 'Delete', 'Set permissions']
cy.get('[data-test="drawer-menu-item-content"]').click()
cy.get('[data-test="menu-item-it-workspace"]')
.rightclick()
.then(() => {
cy.get('ul[role="menu"] li').each(($el) => {
expect(contextMenuItems).to.include($el.text())
})
cy.get('body').click()
})
cy.checkContextMenu({
selector: '[data-test="menu-item-it-workspace"]',
contextMenuItems,
clickAction: 'rightclick',
})
})
})
63 changes: 63 additions & 0 deletions apps/sensenet/cypress/integration/ui/batchOperations.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { PATHS, resolvePathParams } from '../../../src/application-paths'
import { pathWithQueryParams } from '../../../src/services/query-string-builder'

describe('Batch operations: ', () => {
beforeEach(() => {
cy.login()
cy.visit(pathWithQueryParams({ path: '/', newParams: { repoUrl: Cypress.env('repoUrl') } }))
cy.visit(
pathWithQueryParams({
path: resolvePathParams({ path: PATHS.content.appPath, params: { browseType: 'explorer' } }),
newParams: { repoUrl: Cypress.env('repoUrl'), path: '/Marketing/Document_Library' },
}),
)
})

it('multiple content delete works as it is intended', () => {
cy.get('[data-test="menu-item-chicago"]').click({ force: true })
cy.get('[data-test="table-row-selection-control-100pages.docx"]').click({ force: true })
cy.get('[data-test="table-row-selection-control-100pages.pdf"]')
.find('input[type="checkbox"]')
.check({ force: true })
cy.get('[data-test="batch-delete"]').click()
cy.get('[data-test="delete-permanently"] input[type="checkbox"]').check()
cy.get('[data-test="button-delete-confirm"]').click()
cy.get('[data-test="table-cell-100pages.docx"]').should('not.exist')
cy.get('[data-test="table-cell-100pages.pdf"]').should('not.exist')
})

it('multiple content move works as it is intended', () => {
cy.get('[data-test="menu-item-munich"]').click({ force: true })
cy.get('[data-test="table-row-selection-control-100pages.docx"]').click({ force: true })
cy.get('[data-test="table-row-selection-control-100pages.pdf"]')
.find('input[type="checkbox"]')
.check({ force: true })
cy.get('[data-test="batch-move"]').click()
cy.get('[data-test="picker-up"]').dblclick()
cy.get('[data-test="picker-checkbox-item-chicago"]').click()
cy.get('[data-test="picker-submit"]').click()
cy.get('[data-test="snackbar-message"]').should('have.text', '2 items has been moved to Chicago')
cy.get('[data-test="table-cell-100pages.docx"]').should('not.exist')
cy.get('[data-test="table-cell-100pages.pdf"]').should('not.exist')
cy.get('[data-test="menu-item-chicago"]').click({ force: true })
cy.get('[data-test="table-cell-100pages.docx"]').should('exist')
cy.get('[data-test="table-cell-100pages.pdf"]').should('exist')
})
it('multiple content copy works as it is intended', () => {
cy.get('[data-test="menu-item-chicago"]').click({ force: true })
cy.get('[data-test="table-row-selection-control-100pages.docx"]').click({ force: true })
cy.get('[data-test="table-row-selection-control-100pages.pdf"]')
.find('input[type="checkbox"]')
.check({ force: true })
cy.get('[data-test="batch-copy"]').click()
cy.get('[data-test="picker-up"]').dblclick()
cy.get('[data-test="picker-checkbox-item-munich"]').click()
cy.get('[data-test="picker-submit"]').click()
cy.get('[data-test="snackbar-message"]').should('have.text', '2 items has been copied to Munich')
cy.get('[data-test="table-cell-100pages.docx"]').should('exist')
cy.get('[data-test="table-cell-100pages.pdf"]').should('exist')
cy.get('[data-test="menu-item-munich"]').click({ force: true })
cy.get('[data-test="table-cell-100pages.docx"]').should('exist')
cy.get('[data-test="table-cell-100pages.pdf"]').should('exist')
})
})
11 changes: 11 additions & 0 deletions apps/sensenet/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,14 @@ Cypress.Commands.add('scrollToItem', ({ container, selector, done }) => {
timeout()
})
})

Cypress.Commands.add('checkContextMenu', ({ selector, contextMenuItems, clickAction }) => {
cy.get(selector)
[clickAction]()
.then(() => {
cy.get('ul[role="menu"] li').each(($el) => {
expect(contextMenuItems).to.include($el.text())
})
cy.get('body').click()
})
})
13 changes: 13 additions & 0 deletions apps/sensenet/cypress/support/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,18 @@ declare namespace Cypress {
selector: string
done?: (element: HTMLElement) => void
}): Promise<HTMLElement>

/**
* Check the context menu items for the selected item
*/
checkContextMenu({
selector,
contextMenuItems,
clickAction,
}: {
selector: string
contextMenuItems: string[]
clickAction: 'click' | 'rightclick'
}): void
}
}
58 changes: 29 additions & 29 deletions apps/sensenet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@app/sensenet",
"version": "1.21.0",
"version": "1.22.0",
"main": "dist/index.js",
"files": [
"dist",
Expand Down Expand Up @@ -38,66 +38,66 @@
]
},
"devDependencies": {
"@cypress/code-coverage": "^3.9.4",
"@relative-ci/agent": "^1.5.0",
"@cypress/code-coverage": "^3.9.6",
"@relative-ci/agent": "^2.0.0",
"@types/autosuggest-highlight": "^3.1.1",
"@types/react": "^17.0.3",
"@types/react": "^17.0.11",
"@types/react-autosuggest": "^10.1.4",
"@types/react-dom": "^17.0.3",
"@types/react-dom": "^17.0.7",
"@types/react-responsive": "^8.0.2",
"@types/react-router": "^5.1.12",
"@types/react-router": "^5.1.15",
"@types/react-router-dom": "^5.1.7",
"@types/react-virtualized": "^9.21.11",
"@types/uuid": "^8.0.1",
"clean-webpack-plugin": "^4.0.0-alpha.0",
"compression-webpack-plugin": "7.1.2",
"copy-webpack-plugin": "^8.1.1",
"css-loader": "^5.2.4",
"css-minimizer-webpack-plugin": "^2.0.0",
"cypress": "^7.1.0",
"compression-webpack-plugin": "8.0.0",
"copy-webpack-plugin": "^9.0.0",
"css-loader": "^5.2.6",
"css-minimizer-webpack-plugin": "^3.0.1",
"cypress": "^7.5.0",
"cypress-file-upload": "^5.0.6",
"cypress-xpath": "^1.6.2",
"file-loader": "^6.1.1",
"fork-ts-checker-webpack-plugin": "^6.2.1",
"fork-ts-checker-webpack-plugin": "^6.2.10",
"html-webpack-plugin": "^5.3.1",
"mini-css-extract-plugin": "^1.5.0",
"monaco-editor-webpack-plugin": "^3.0.1",
"monaco-editor-webpack-plugin": "^4.0.0",
"nyc": "^15.1.0",
"nyc-config-tsx": "^0.1.0",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"source-map-support": "^0.5.19",
"style-loader": "^2.0.0",
"terser-webpack-plugin": "^5.1.1",
"ts-loader": "^9.0.0",
"ts-node": "^9.1.1",
"terser-webpack-plugin": "^5.1.3",
"ts-loader": "^9.2.3",
"ts-node": "^10.0.0",
"url-loader": "^4.1.1",
"webpack": "^5.34.0",
"webpack": "^5.38.1",
"webpack-bundle-analyzer": "^4.4.1",
"webpack-cli": "^4.6.0",
"webpack-cli": "^4.7.2",
"webpack-dev-server": "^3.11.2",
"webpack-merge": "^5.7.3"
"webpack-merge": "^5.8.0"
},
"dependencies": {
"@iconify-icons/logos": "^1.1.9",
"@iconify-icons/logos": "^1.1.10",
"@iconify/react": "^1.1.4",
"@material-ui/core": "^4.11.4",
"@material-ui/icons": "^4.11.2",
"@material-ui/lab": "^4.0.0-alpha.58",
"@sensenet/authentication-oidc-react": "^2.3.1",
"@sensenet/client-core": "^4.0.0",
"@sensenet/client-utils": "^2.1.1",
"@sensenet/controls-react": "^8.0.0",
"@sensenet/client-core": "^4.0.1",
"@sensenet/client-utils": "^2.1.2",
"@sensenet/controls-react": "^8.0.1",
"@sensenet/default-content-types": "^5.0.0",
"@sensenet/document-viewer-react": "^4.2.0",
"@sensenet/hooks-react": "^1.6.1",
"@sensenet/document-viewer-react": "^4.2.1",
"@sensenet/hooks-react": "^1.6.2",
"@sensenet/list-controls-react": "^2.1.1",
"@sensenet/pickers-react": "^2.1.1",
"@sensenet/query": "^2.1.1",
"@sensenet/repository-events": "^2.1.1",
"@sensenet/pickers-react": "^2.1.2",
"@sensenet/query": "^2.1.2",
"@sensenet/repository-events": "^2.1.2",
"autosuggest-highlight": "^3.1.1",
"clsx": "^1.1.1",
"date-fns": "^2.21.3",
"date-fns": "^2.22.1",
"filesize": "^6.3.0",
"react": "^16.13.0",
"react-autosuggest": "^10.1.0",
Expand Down
3 changes: 3 additions & 0 deletions apps/sensenet/src/components/ContentBreadcrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export const ContentBreadcrumbs = <T extends GenericContent = GenericContent>(pr
<div className={classes.batchActionWrapper}>
<Tooltip title={localization.batchActions.delete} placement="bottom">
<IconButton
data-test="batch-delete"
aria-label="delete"
onClick={() => {
openDialog({
Expand All @@ -94,6 +95,7 @@ export const ContentBreadcrumbs = <T extends GenericContent = GenericContent>(pr
</Tooltip>
<Tooltip title={localization.batchActions.move} placement="bottom">
<IconButton
data-test="batch-move"
aria-label="move"
onClick={() => {
openDialog({
Expand All @@ -115,6 +117,7 @@ export const ContentBreadcrumbs = <T extends GenericContent = GenericContent>(pr
</Tooltip>
<Tooltip title={localization.batchActions.copy} placement="bottom">
<IconButton
data-test="batch-copy"
aria-label="copy"
onClick={() => {
openDialog({
Expand Down
1 change: 1 addition & 0 deletions apps/sensenet/src/components/NotificationComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export const NotificationComponent: FunctionComponent = () => {
<div style={{ display: 'flex', alignItems: 'center' }}>
<Icon item={value} style={{ marginRight: '1em' }} />
<div
data-test="snackbar-message"
title={value.message}
style={{ overflow: 'hidden', textOverflow: 'ellipsis', wordBreak: 'break-word' }}>
{(count > 1 && value.data?.digestMessage && value.data.digestMessage.replace('{count}', count)) ||
Expand Down
4 changes: 3 additions & 1 deletion apps/sensenet/src/components/SelectionControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ export const SelectionControl: FunctionComponent<SelectionControlProps> = ({
}, [selectionService.selection])

return (
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', width: 40, height: 40 }}>
<div
data-test={`table-row-selection-control-${content.Name.replace(/\s+/g, '-').toLowerCase()}`}
style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', width: 40, height: 40 }}>
<Checkbox
checked={isSelected}
style={{ display: selection.length > 0 ? undefined : 'none' }}
Expand Down
5 changes: 3 additions & 2 deletions apps/sensenet/src/components/content-list/actions-field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import { useGlobalStyles } from '../../globalStyles'

export const ActionsField: FC<{
onOpen: (ev: MouseEvent<HTMLButtonElement>) => void
}> = ({ onOpen }) => {
name: string
}> = ({ onOpen, name }) => {
const globalClasses = useGlobalStyles()
return (
<TableCell component="div" className={clsx(globalClasses.centered, globalClasses.virtualizedCellStyle)}>
<IconButton onClick={onOpen}>
<IconButton onClick={onOpen} data-test={`actions-button-${name?.replace(/\s+/g, '-').toLowerCase()}`}>
<MoreHoriz />
</IconButton>
</TableCell>
Expand Down
5 changes: 4 additions & 1 deletion apps/sensenet/src/components/content-list/content-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,10 @@ export const ContentList = <T extends GenericContent = GenericContent>(props: Co
case 'Actions':
return (
<ContextMenuWrapper onContextMenu={(ev) => openContext(ev, fieldOptions.rowData)}>
<ActionsField onOpen={(ev) => openContext(ev, fieldOptions.rowData)} />
<ActionsField
onOpen={(ev) => openContext(ev, fieldOptions.rowData)}
name={fieldOptions.rowData.Name as string}
/>
</ContextMenuWrapper>
)
case 'Enabled':
Expand Down
13 changes: 11 additions & 2 deletions apps/sensenet/src/components/dialogs/approve.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export function Approve(props: ApproveProps) {
const globalClasses = useGlobalStyles()

const name = content.DisplayName ?? content.Name
const submitProps = { color: 'primary', variant: 'contained' } as const
const cancelProps = { className: globalClasses.cancelButton } as const

const reject = async () => {
if (!aboutToReject) {
Expand Down Expand Up @@ -78,10 +80,17 @@ export function Approve(props: ApproveProps) {
{localization.cancelButton}
</Button>
<div>
<Button aria-label={localization.rejectButton} onClick={reject} className={globalClasses.cancelButton}>
<Button
aria-label={localization.rejectButton}
onClick={reject}
{...(aboutToReject ? submitProps : cancelProps)}>
{localization.rejectButton}
</Button>
<Button aria-label={localization.approveButton} onClick={approve} color="primary" variant="contained">
<Button
aria-label={localization.approveButton}
onClick={approve}
{...(aboutToReject ? cancelProps : submitProps)}
style={{ marginLeft: '38px' }}>
{localization.approveButton}
</Button>
</div>
Expand Down
5 changes: 3 additions & 2 deletions apps/sensenet/src/components/dialogs/dialog-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ export type DialogWithProps = (
type Action = { type: 'PUSH_DIALOG'; dialog: DialogWithProps } | { type: 'POP_DIALOG' } | { type: 'CLOSE_ALL_DIALOGS' }

const initialState: DialogWithProps[] = []
const DialogContext =
createContext<{ dialogs: typeof initialState; dispatch: React.Dispatch<Action> } | undefined>(undefined)
const DialogContext = createContext<{ dialogs: typeof initialState; dispatch: React.Dispatch<Action> } | undefined>(
undefined,
)

function dialogReducer(state: typeof initialState, action: Action) {
switch (action.type) {
Expand Down
Loading

0 comments on commit aac83da

Please sign in to comment.