2023-06-14 04:29:24 -04:00
|
|
|
import CodeMirrorEditor from '../../../../frontend/js/features/source-editor/components/codemirror-editor'
|
|
|
|
import { EditorProviders } from '../../helpers/editor-providers'
|
|
|
|
import { mockScope } from '../source-editor/helpers/mock-scope'
|
|
|
|
|
|
|
|
type ContainerProps = {
|
|
|
|
children: React.ReactNode
|
|
|
|
className?: string
|
|
|
|
}
|
|
|
|
|
|
|
|
function Container(props: ContainerProps) {
|
|
|
|
return <div style={{ width: 785, height: 785 }} {...props} />
|
|
|
|
}
|
|
|
|
|
|
|
|
describe('<ReviewPanel />', function () {
|
|
|
|
beforeEach(function () {
|
|
|
|
window.metaAttributesCache.set('ol-isReviewPanelReact', true)
|
|
|
|
window.metaAttributesCache.set('ol-preventCompileOnLoad', true)
|
|
|
|
|
|
|
|
cy.interceptEvents()
|
|
|
|
cy.interceptSpelling()
|
|
|
|
|
|
|
|
const scope = mockScope('')
|
|
|
|
scope.editor.showVisual = true
|
|
|
|
|
2023-06-15 05:52:54 -04:00
|
|
|
cy.wrap(scope).as('scope')
|
2023-06-14 04:29:24 -04:00
|
|
|
|
|
|
|
cy.mount(
|
|
|
|
<Container className="rp-size-expanded">
|
2023-06-15 05:52:54 -04:00
|
|
|
<EditorProviders scope={scope}>
|
2023-06-14 04:29:24 -04:00
|
|
|
<CodeMirrorEditor />
|
|
|
|
</EditorProviders>
|
|
|
|
</Container>
|
|
|
|
)
|
|
|
|
|
|
|
|
cy.findByTestId('review-panel').as('review-panel')
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('toolbar', function () {
|
|
|
|
describe('resolved comments dropdown', function () {
|
|
|
|
it('renders dropdown button', function () {
|
|
|
|
cy.findByRole('button', { name: /resolved comments/i })
|
|
|
|
})
|
|
|
|
|
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
2023-07-03 04:55:39 -04:00
|
|
|
it.skip('opens dropdown', function () {
|
|
|
|
cy.findByRole('button', { name: /resolved comments/i }).click()
|
|
|
|
// TODO dropdown opens/closes
|
|
|
|
})
|
2023-06-14 04:29:24 -04:00
|
|
|
|
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
|
|
|
it.skip('renders list of resolved comments', function () {})
|
|
|
|
|
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
|
|
|
it.skip('reopens resolved comment', function () {})
|
|
|
|
|
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
|
|
|
it.skip('deletes resolved comment', function () {})
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('track changes toggle menu', function () {
|
|
|
|
it('renders track changes toolbar', function () {
|
|
|
|
cy.get('@review-panel').within(() => {
|
|
|
|
cy.findByRole('button', { name: /track changes is (on|off)$/i })
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
it('opens/closes toggle menu', function () {
|
|
|
|
cy.get('@review-panel').within(() => {
|
|
|
|
cy.findByTestId('review-panel-track-changes-menu').as('menu')
|
|
|
|
cy.get('@menu').should('have.css', 'height', '1px')
|
|
|
|
cy.findByRole('button', { name: /track changes is/i }).click()
|
|
|
|
// verify the menu is expanded
|
|
|
|
cy.get('@menu')
|
|
|
|
.then($el => {
|
|
|
|
const height = window
|
|
|
|
.getComputedStyle($el[0])
|
|
|
|
.getPropertyValue('height')
|
|
|
|
return parseFloat(height)
|
|
|
|
})
|
|
|
|
.should('be.gt', 1)
|
|
|
|
cy.findByRole('button', { name: /track changes is/i }).click()
|
|
|
|
cy.get('@menu').should('have.css', 'height', '1px')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
it('toggles the "everyone" track changes switch', function () {
|
|
|
|
cy.get('@review-panel').within(() => {
|
|
|
|
cy.findByRole('button', { name: /track changes is off/i }).click()
|
|
|
|
cy.findByLabelText(/track changes for everyone/i).click({
|
|
|
|
force: true,
|
|
|
|
})
|
2023-06-15 05:52:54 -04:00
|
|
|
cy.get('@scope')
|
|
|
|
.its('toggleTrackChangesForEveryone')
|
|
|
|
.should('be.calledOnce')
|
2023-06-14 04:29:24 -04:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
it('renders track changes with "on" state', function () {
|
|
|
|
const scope = mockScope('')
|
|
|
|
scope.editor.showVisual = true
|
|
|
|
scope.editor.wantTrackChanges = true
|
|
|
|
|
|
|
|
cy.mount(
|
|
|
|
<Container className="rp-size-expanded">
|
|
|
|
<EditorProviders scope={scope}>
|
|
|
|
<CodeMirrorEditor />
|
|
|
|
</EditorProviders>
|
|
|
|
</Container>
|
|
|
|
)
|
|
|
|
|
|
|
|
cy.findByTestId('review-panel').within(() => {
|
|
|
|
cy.findByRole('button', { name: /track changes is on/i }).click()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
it('renders a disabled guests switch', function () {
|
|
|
|
cy.findByRole('button', { name: /track changes is off/i }).click()
|
|
|
|
cy.findByLabelText(/track changes for guests/i).should('be.disabled')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
2023-06-15 05:52:54 -04:00
|
|
|
|
|
|
|
describe('toggler', function () {
|
|
|
|
it('renders toggler button', function () {
|
|
|
|
cy.get('@review-panel').within(() => {
|
|
|
|
cy.findByRole('button', { name: /toggle review panel/i })
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
it('calls the toggler function on click', function () {
|
|
|
|
cy.get('@review-panel').within(() => {
|
|
|
|
cy.findByRole('button', { name: /toggle review panel/i }).click()
|
|
|
|
cy.get('@scope').its('toggleReviewPanel').should('be.calledOnce')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
2023-06-19 10:07:51 -04:00
|
|
|
|
|
|
|
describe('navigation', function () {
|
|
|
|
it('renders navigation', function () {
|
|
|
|
cy.get('@review-panel').within(() => {
|
|
|
|
cy.findByRole('tab', { name: /current file/i })
|
|
|
|
cy.findByRole('tab', { name: /overview/i })
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
it('selects the active tab', function () {
|
|
|
|
cy.get('@review-panel').within(() => {
|
|
|
|
cy.findByRole('tab', { name: /current file/i }).should(
|
|
|
|
'have.attr',
|
|
|
|
'aria-selected',
|
|
|
|
'true'
|
|
|
|
)
|
|
|
|
cy.findByRole('tab', { name: /overview/i }).should(
|
|
|
|
'have.attr',
|
|
|
|
'aria-selected',
|
|
|
|
'false'
|
|
|
|
)
|
|
|
|
cy.findByRole('tab', { name: /overview/i }).click()
|
|
|
|
cy.findByRole('tab', { name: /current file/i }).should(
|
|
|
|
'have.attr',
|
|
|
|
'aria-selected',
|
|
|
|
'false'
|
|
|
|
)
|
|
|
|
cy.findByRole('tab', { name: /overview/i }).should(
|
|
|
|
'have.attr',
|
|
|
|
'aria-selected',
|
|
|
|
'true'
|
|
|
|
)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
2023-06-29 08:56:05 -04:00
|
|
|
|
|
|
|
describe('comment entries', function () {
|
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
|
|
|
it.skip('shows threads and comments', function () {})
|
|
|
|
|
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
|
|
|
it.skip('edits comment', function () {})
|
|
|
|
|
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
|
|
|
it.skip('deletes comment', function () {})
|
|
|
|
|
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
|
|
|
it.skip('cancels comment editing', function () {})
|
|
|
|
|
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
|
|
|
it.skip('cancels comment deletion', function () {})
|
|
|
|
|
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
|
|
|
it.skip('adds new comment (replies) to a thread', function () {})
|
|
|
|
|
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
|
|
|
it.skip('resolves comment', function () {})
|
|
|
|
})
|
2023-07-04 07:05:12 -04:00
|
|
|
|
2023-07-05 10:07:36 -04:00
|
|
|
describe('change entries', function () {
|
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
2023-07-06 07:19:04 -04:00
|
|
|
it.skip('renders inserted entries in current file mode', function () {})
|
2023-07-05 10:07:36 -04:00
|
|
|
|
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
2023-07-06 07:19:04 -04:00
|
|
|
it.skip('renders deleted entries in current file mode', function () {})
|
|
|
|
|
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
|
|
|
it.skip('renders inserted entries in overview mode', function () {})
|
|
|
|
|
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
|
|
|
it.skip('renders deleted entries in overview mode', function () {})
|
2023-07-05 10:07:36 -04:00
|
|
|
|
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
|
|
|
it.skip('accepts change', function () {})
|
|
|
|
|
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
|
|
|
it.skip('rejects change', function () {})
|
|
|
|
})
|
|
|
|
|
2023-07-06 07:19:04 -04:00
|
|
|
describe('aggregate change entries', function () {
|
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
|
|
|
it.skip('renders changed entries in current file mode', function () {})
|
|
|
|
|
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
|
|
|
it.skip('renders changed entries in overview mode', function () {})
|
|
|
|
})
|
|
|
|
|
2023-07-07 06:13:25 -04:00
|
|
|
describe('add comment entry', function () {
|
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
|
|
|
it.skip('renders `add comment button`', function () {})
|
|
|
|
|
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
|
|
|
it.skip('cancels adding comment', function () {})
|
|
|
|
|
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
|
|
|
it.skip('adds comment', function () {})
|
|
|
|
})
|
|
|
|
|
2023-07-10 08:12:22 -04:00
|
|
|
describe('bulk actions entry', function () {
|
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
|
|
|
it.skip('renders the reject and accept all buttons`', function () {})
|
|
|
|
|
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
|
|
|
it.skip('accepts all changes', function () {})
|
|
|
|
|
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
|
|
|
it.skip('rejects all changes', function () {})
|
|
|
|
})
|
|
|
|
|
2023-07-04 07:05:12 -04:00
|
|
|
describe('overview mode', function () {
|
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
|
|
|
it.skip('shows list of files changed', function () {})
|
|
|
|
|
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
|
|
|
it.skip('renders comments', function () {})
|
|
|
|
})
|
2023-07-12 09:52:29 -04:00
|
|
|
|
|
|
|
describe('in editor widgets', function () {
|
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
|
|
|
it.skip('toggle review panel', function () {})
|
|
|
|
|
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
|
|
|
it.skip('accepts all changes', function () {})
|
|
|
|
|
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
|
|
|
it.skip('rejects all changes', function () {})
|
|
|
|
|
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
|
|
|
it.skip('add comment', function () {})
|
|
|
|
})
|
2023-07-12 10:13:08 -04:00
|
|
|
|
|
|
|
describe('upgrade track changes', function () {
|
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
|
|
|
it.skip('renders modal', function () {})
|
|
|
|
|
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
|
|
|
it.skip('closes modal', function () {})
|
|
|
|
|
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
|
|
|
it.skip('opens subscription page after clicking on `upgrade`', function () {})
|
|
|
|
|
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
|
|
|
it.skip('opens subscription page after clicking on `try it for free`', function () {})
|
|
|
|
|
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
|
|
|
it.skip('shows `ask project owner to upgrade` message', function () {})
|
|
|
|
})
|
2023-06-14 04:29:24 -04:00
|
|
|
})
|