mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 09:09:36 +02:00
Preserve source-only extensions on file switch (#27080)
GitOrigin-RevId: 661c70b78a508619e6532b87b0409f546b4d9e82
This commit is contained in:
@@ -40,9 +40,15 @@ describe('Project creation and compilation', function () {
|
||||
cy.get('.cm-line').should('have.length', 1)
|
||||
cy.get('.cm-line').type(markdownContent)
|
||||
cy.findByText('main.tex').click()
|
||||
cy.get('.cm-content').should('contain.text', '\\maketitle')
|
||||
cy.findByRole('textbox', { name: /Source Editor editing/i }).should(
|
||||
'contain.text',
|
||||
'\\maketitle'
|
||||
)
|
||||
cy.findByText(fileName).click()
|
||||
cy.get('.cm-content').should('contain.text', markdownContent)
|
||||
cy.findByRole('textbox', { name: /Source Editor editing/i }).should(
|
||||
'contain.text',
|
||||
markdownContent
|
||||
)
|
||||
})
|
||||
|
||||
it('can link and display linked image from other project', function () {
|
||||
|
||||
@@ -104,7 +104,10 @@ describe('editor', () => {
|
||||
force: true,
|
||||
})
|
||||
cy.get('button').contains('𝜉').click()
|
||||
cy.get('.cm-content').should('contain.text', '\\xi')
|
||||
cy.findByRole('textbox', { name: /Source Editor editing/i }).should(
|
||||
'contain.text',
|
||||
'\\xi'
|
||||
)
|
||||
|
||||
cy.log('recompile to force flush and avoid "unsaved changes" prompt')
|
||||
recompile()
|
||||
|
||||
@@ -55,8 +55,15 @@ describe('Project Sharing', function () {
|
||||
|
||||
function expectContentReadOnlyAccess() {
|
||||
cy.url().should('match', /\/project\/[a-fA-F0-9]{24}/)
|
||||
cy.get('.cm-content').should('contain.text', '\\maketitle')
|
||||
cy.get('.cm-content').should('have.attr', 'contenteditable', 'false')
|
||||
cy.findByRole('textbox', { name: /Source Editor editing/i }).should(
|
||||
'contain.text',
|
||||
'\\maketitle'
|
||||
)
|
||||
cy.findByRole('textbox', { name: /Source Editor editing/i }).should(
|
||||
'have.attr',
|
||||
'contenteditable',
|
||||
'false'
|
||||
)
|
||||
}
|
||||
|
||||
function expectContentWriteAccess() {
|
||||
@@ -64,13 +71,23 @@ describe('Project Sharing', function () {
|
||||
cy.url().should('match', /\/project\/[a-fA-F0-9]{24}/)
|
||||
const recompile = throttledRecompile()
|
||||
// wait for the editor to finish loading
|
||||
cy.get('.cm-content').should('contain.text', '\\maketitle')
|
||||
cy.findByRole('textbox', { name: /Source Editor editing/i }).should(
|
||||
'contain.text',
|
||||
'\\maketitle'
|
||||
)
|
||||
// the editor should be writable
|
||||
cy.get('.cm-content').should('have.attr', 'contenteditable', 'true')
|
||||
cy.findByRole('textbox', { name: /Source Editor editing/i }).should(
|
||||
'have.attr',
|
||||
'contenteditable',
|
||||
'true'
|
||||
)
|
||||
cy.findByText('\\maketitle').parent().click()
|
||||
cy.findByText('\\maketitle').parent().type(`\n\\section{{}${section}}`)
|
||||
// should have written
|
||||
cy.get('.cm-content').should('contain.text', `\\section{${section}}`)
|
||||
cy.findByRole('textbox', { name: /Source Editor editing/i }).should(
|
||||
'contain.text',
|
||||
`\\section{${section}}`
|
||||
)
|
||||
// check PDF
|
||||
recompile()
|
||||
cy.get('.pdf-viewer').should('contain.text', projectName)
|
||||
|
||||
@@ -161,7 +161,9 @@ describe('SandboxedCompiles', function () {
|
||||
})
|
||||
|
||||
cy.log('navigate to Section A')
|
||||
cy.get('.cm-content').within(() => cy.findByText('Section A').click())
|
||||
cy.findByRole('textbox', { name: /Source Editor editing/i }).within(
|
||||
() => cy.findByText('Section A').click()
|
||||
)
|
||||
cy.get('[aria-label="Go to code location in PDF"]').click()
|
||||
cy.get('@title').then((title: any) => {
|
||||
waitUntilScrollingFinished('.pdfjs-viewer-inner', title)
|
||||
@@ -170,7 +172,9 @@ describe('SandboxedCompiles', function () {
|
||||
})
|
||||
|
||||
cy.log('navigate to Section B')
|
||||
cy.get('.cm-content').within(() => cy.findByText('Section B').click())
|
||||
cy.findByRole('textbox', { name: /Source Editor editing/i }).within(
|
||||
() => cy.findByText('Section B').click()
|
||||
)
|
||||
cy.get('[aria-label="Go to code location in PDF"]').click()
|
||||
cy.get('@sectionA').then((title: any) => {
|
||||
waitUntilScrollingFinished('.pdfjs-viewer-inner', title)
|
||||
|
||||
Reference in New Issue
Block a user