|
|
@@ -6,6 +6,10 @@ import { getContainerEl } from 'cypress/react'
|
|
|
import { unmountComponentAtNode } from 'react-dom'
|
|
|
import { PdfPreviewProvider } from '../../../../frontend/js/features/pdf-preview/components/pdf-preview-provider'
|
|
|
|
|
|
+// Unicode directional isolates, added around placeables by @fluent/bundle/esm/resolver
|
|
|
+const FSI = '\u2068'
|
|
|
+const PDI = '\u2069'
|
|
|
+
|
|
|
describe('<PdfJSViewer/>', function () {
|
|
|
beforeEach(function () {
|
|
|
cy.interceptEvents()
|
|
|
@@ -26,12 +30,12 @@ describe('<PdfJSViewer/>', function () {
|
|
|
</EditorProviders>
|
|
|
)
|
|
|
|
|
|
- cy.waitForCompile()
|
|
|
+ cy.waitForCompile({ pdf: true })
|
|
|
|
|
|
- cy.findByLabelText('Page 1')
|
|
|
- cy.findByLabelText('Page 2')
|
|
|
- cy.findByLabelText('Page 3')
|
|
|
- cy.findByLabelText('Page 4').should('not.exist')
|
|
|
+ cy.findByRole('region', { name: `Page ${FSI}1${PDI}` })
|
|
|
+ cy.findByRole('region', { name: `Page ${FSI}2${PDI}` })
|
|
|
+ cy.findByRole('region', { name: `Page ${FSI}3${PDI}` })
|
|
|
+ cy.findByRole('region', { name: `Page ${FSI}4${PDI}` }).should('not.exist')
|
|
|
|
|
|
cy.contains('Your Paper')
|
|
|
})
|
|
|
@@ -53,7 +57,7 @@ describe('<PdfJSViewer/>', function () {
|
|
|
|
|
|
cy.waitForCompile()
|
|
|
|
|
|
- cy.findByLabelText('Loading…')
|
|
|
+ cy.get('.page.loading')
|
|
|
})
|
|
|
|
|
|
it('can be unmounted while loading a document', function () {
|
|
|
@@ -91,9 +95,9 @@ describe('<PdfJSViewer/>', function () {
|
|
|
</EditorProviders>
|
|
|
)
|
|
|
|
|
|
- cy.waitForCompile()
|
|
|
+ cy.waitForCompile({ pdf: true })
|
|
|
|
|
|
- cy.findByLabelText('Page 1')
|
|
|
+ cy.findByRole('region', { name: `Page ${FSI}1${PDI}` })
|
|
|
|
|
|
cy.then(() => unmountComponentAtNode(getContainerEl()))
|
|
|
})
|