2024-07-24 09:40:24 -04:00
|
|
|
import '../../helpers/bootstrap-3'
|
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'
|
2024-03-25 07:54:13 -04:00
|
|
|
import { TestContainer } from '../source-editor/helpers/test-container'
|
2023-06-14 04:29:24 -04:00
|
|
|
|
|
|
|
describe('<ReviewPanel />', function () {
|
|
|
|
beforeEach(function () {
|
|
|
|
window.metaAttributesCache.set('ol-preventCompileOnLoad', true)
|
|
|
|
|
|
|
|
cy.interceptEvents()
|
|
|
|
|
|
|
|
const scope = mockScope('')
|
|
|
|
scope.editor.showVisual = true
|
|
|
|
|
2023-11-13 06:11:33 -05:00
|
|
|
// The tests expect no documents, so remove them from the scope
|
|
|
|
scope.project.rootFolder = []
|
|
|
|
|
2023-06-15 05:52:54 -04:00
|
|
|
cy.wrap(scope).as('scope')
|
2023-06-14 04:29:24 -04:00
|
|
|
|
|
|
|
cy.mount(
|
2024-03-25 07:54:13 -04:00
|
|
|
<TestContainer 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>
|
2024-03-25 07:54:13 -04:00
|
|
|
</TestContainer>
|
2023-06-14 04:29:24 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
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(() => {
|
2023-12-13 09:30:06 -05:00
|
|
|
cy.findByTestId('review-panel-track-changes-menu').should('not.exist')
|
2023-06-14 04:29:24 -04:00
|
|
|
cy.findByRole('button', { name: /track changes is/i }).click()
|
|
|
|
// verify the menu is expanded
|
2023-12-13 09:30:06 -05:00
|
|
|
cy.findByTestId('review-panel-track-changes-menu')
|
|
|
|
.as('menu')
|
2023-06-14 04:29:24 -04:00
|
|
|
.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()
|
2023-12-13 09:30:06 -05:00
|
|
|
cy.get('@menu').should('not.exist')
|
2023-06-14 04:29:24 -04:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
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,
|
|
|
|
})
|
2024-06-05 04:33:11 -04:00
|
|
|
cy.findByLabelText(/track changes for everyone/i).should('be.checked')
|
|
|
|
// TODO: assert that track changes is on for everyone
|
2023-06-14 04:29:24 -04:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2024-06-05 04:33:11 -04:00
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
|
|
|
it.skip('renders track changes with "on" state', function () {
|
2023-06-14 04:29:24 -04:00
|
|
|
const scope = mockScope('')
|
|
|
|
scope.editor.showVisual = true
|
|
|
|
scope.editor.wantTrackChanges = true
|
|
|
|
|
|
|
|
cy.mount(
|
2024-03-25 07:54:13 -04:00
|
|
|
<TestContainer className="rp-size-expanded">
|
2023-06-14 04:29:24 -04:00
|
|
|
<EditorProviders scope={scope}>
|
|
|
|
<CodeMirrorEditor />
|
|
|
|
</EditorProviders>
|
2024-03-25 07:54:13 -04:00
|
|
|
</TestContainer>
|
2023-06-14 04:29:24 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
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 })
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2024-06-05 04:33:11 -04:00
|
|
|
// eslint-disable-next-line mocha/no-skipped-tests
|
|
|
|
it.skip('calls the toggler function on click', function () {
|
2023-06-15 05:52:54 -04:00
|
|
|
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
|
|
|
})
|