mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-13 21:53:43 +01:00
Merge pull request #24965 from overleaf/td-downshift-9-upgrade
Upgrade Downshift to version 9 GitOrigin-RevId: b36904ab0c82c09a633a25cd6fed651d7c8b19f7
This commit is contained in:
+22
-9
@@ -126,7 +126,7 @@ describe('<FigureModal />', function () {
|
||||
})
|
||||
|
||||
it('Lists files from project', function () {
|
||||
cy.findByRole('textbox', { name: 'Image file' }).click()
|
||||
cy.findByRole('combobox', { name: 'Image file' }).click()
|
||||
cy.findByRole('listbox')
|
||||
.children()
|
||||
.should('have.length', 2)
|
||||
@@ -137,7 +137,7 @@ describe('<FigureModal />', function () {
|
||||
|
||||
it('Enables insert button when choosing file', function () {
|
||||
cy.findByRole('button', { name: 'Insert figure' }).should('be.disabled')
|
||||
cy.findByRole('textbox', { name: 'Image file' }).click()
|
||||
cy.findByRole('combobox', { name: 'Image file' }).click()
|
||||
cy.findByRole('listbox').within(() => {
|
||||
cy.findByText('frog.jpg').click()
|
||||
})
|
||||
@@ -145,7 +145,7 @@ describe('<FigureModal />', function () {
|
||||
})
|
||||
|
||||
it('Inserts file when pressing insert button', function () {
|
||||
cy.findByRole('textbox', { name: 'Image file' }).click()
|
||||
cy.findByRole('combobox', { name: 'Image file' }).click()
|
||||
cy.findByRole('listbox').within(() => {
|
||||
cy.findByText('frog.jpg').click()
|
||||
})
|
||||
@@ -166,8 +166,8 @@ describe('<FigureModal />', function () {
|
||||
cy.findByRole('menu').within(() => {
|
||||
cy.findByRole('button', { name: 'From another project' }).click()
|
||||
})
|
||||
cy.findByRole('textbox', { name: 'Project' }).as('project-dropdown')
|
||||
cy.findByRole('textbox', { name: 'Image file' }).as('file-dropdown')
|
||||
cy.findByRole('combobox', { name: 'Project' }).as('project-dropdown')
|
||||
cy.findByRole('combobox', { name: 'Image file' }).as('file-dropdown')
|
||||
})
|
||||
|
||||
it('List projects and files in projects', function () {
|
||||
@@ -203,6 +203,19 @@ describe('<FigureModal />', function () {
|
||||
cy.findByRole('button', { name: 'Insert figure' }).should('be.enabled')
|
||||
})
|
||||
|
||||
it('Closes project dropdown on pressing Esc key but leaves modal open', function () {
|
||||
cy.findByRole('button', { name: 'Insert figure' }).should('be.disabled')
|
||||
cy.get('@project-dropdown').click()
|
||||
cy.findByRole('listbox').should('exist')
|
||||
cy.get('@project-dropdown').type('{esc}', { force: true })
|
||||
cy.findByRole('listbox').should('not.exist')
|
||||
cy.findByRole('dialog').should('exist')
|
||||
|
||||
// Check that a subsequent press of the Esc key closes the modal
|
||||
cy.get('@project-dropdown').type('{esc}', { force: true })
|
||||
cy.findByRole('dialog').should('not.exist')
|
||||
})
|
||||
|
||||
it('Creates linked file when pressing insert', function () {
|
||||
cy.get('@project-dropdown').click()
|
||||
cy.findByRole('listbox').within(() => {
|
||||
@@ -235,7 +248,7 @@ describe('<FigureModal />', function () {
|
||||
cy.findByRole('option', { name: 'My first project' }).click()
|
||||
})
|
||||
cy.findByRole('button', { name: 'select from output files' }).click()
|
||||
cy.findByRole('textbox', { name: 'Output file' }).click()
|
||||
cy.findByRole('combobox', { name: 'Output file' }).click()
|
||||
cy.findByRole('listbox').within(() => {
|
||||
cy.findByRole('option', { name: 'output.pdf' }).click()
|
||||
})
|
||||
@@ -298,7 +311,7 @@ describe('<FigureModal />', function () {
|
||||
cy.findByRole('menu').within(() => {
|
||||
cy.findByText('From another project').click()
|
||||
})
|
||||
cy.findByRole('textbox', { name: 'Project' }).click()
|
||||
cy.findByRole('combobox', { name: 'Project' }).click()
|
||||
cy.findByRole('listbox').within(() => {
|
||||
cy.findByRole('option', { name: 'My first project' }).click()
|
||||
})
|
||||
@@ -322,7 +335,7 @@ describe('<FigureModal />', function () {
|
||||
})
|
||||
expectNoOutputSwitch()
|
||||
it('should show output file selector', function () {
|
||||
cy.findByRole('textbox', { name: 'Output file' }).click()
|
||||
cy.findByRole('combobox', { name: 'Output file' }).click()
|
||||
cy.findByRole('listbox').within(() => {
|
||||
cy.findByRole('option', { name: 'output.pdf' }).click()
|
||||
})
|
||||
@@ -341,7 +354,7 @@ describe('<FigureModal />', function () {
|
||||
expectNoOutputSwitch()
|
||||
|
||||
it('should show source file selector', function () {
|
||||
cy.findByRole('textbox', { name: 'Image file' }).click()
|
||||
cy.findByRole('combobox', { name: 'Image file' }).click()
|
||||
cy.findByRole('listbox').within(() => {
|
||||
cy.findByRole('option', { name: 'frog.jpg' }).click()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user