|
@@ -22,15 +22,11 @@ describe('<ReviewPanel />', function () {
|
|
|
const scope = mockScope('')
|
|
const scope = mockScope('')
|
|
|
scope.editor.showVisual = true
|
|
scope.editor.showVisual = true
|
|
|
|
|
|
|
|
- // Making a shallow copy, otherwise cannot spy on an object declared outside the test file
|
|
|
|
|
- const newScope = { ...scope }
|
|
|
|
|
- cy.spy(newScope, 'toggleTrackChangesForEveryone').as(
|
|
|
|
|
- 'toggleTrackChangesForEveryone'
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ cy.wrap(scope).as('scope')
|
|
|
|
|
|
|
|
cy.mount(
|
|
cy.mount(
|
|
|
<Container className="rp-size-expanded">
|
|
<Container className="rp-size-expanded">
|
|
|
- <EditorProviders scope={newScope}>
|
|
|
|
|
|
|
+ <EditorProviders scope={scope}>
|
|
|
<CodeMirrorEditor />
|
|
<CodeMirrorEditor />
|
|
|
</EditorProviders>
|
|
</EditorProviders>
|
|
|
</Container>
|
|
</Container>
|
|
@@ -90,7 +86,9 @@ describe('<ReviewPanel />', function () {
|
|
|
cy.findByLabelText(/track changes for everyone/i).click({
|
|
cy.findByLabelText(/track changes for everyone/i).click({
|
|
|
force: true,
|
|
force: true,
|
|
|
})
|
|
})
|
|
|
- cy.get('@toggleTrackChangesForEveryone').should('be.calledOnce')
|
|
|
|
|
|
|
+ cy.get('@scope')
|
|
|
|
|
+ .its('toggleTrackChangesForEveryone')
|
|
|
|
|
+ .should('be.calledOnce')
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -118,4 +116,19 @@ describe('<ReviewPanel />', function () {
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
+
|
|
|
|
|
+ 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')
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
})
|
|
})
|