-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Reset session if file rename changes mimetype from/to markdown
For the event target file, we cannot use `getMimetype()` or `getExtension()` as it's a node of type `NonExistingFile`. Fixes: #5736 Signed-off-by: Jonas <[email protected]>
- Loading branch information
1 parent
1b76944
commit 742747b
Showing
2 changed files
with
76 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/** | ||
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
|
||
import { randUser } from '../utils/index.js' | ||
|
||
const user = randUser() | ||
|
||
describe('Changing mimetype from/to markdown resets document session', function() { | ||
before(function() { | ||
// Init user | ||
cy.createUser(user) | ||
cy.login(user) | ||
cy.uploadFile('empty.md', 'text/markdown', 'test1.md') | ||
cy.uploadFile('empty.txt', 'text/plain', 'test2.txt') | ||
}) | ||
beforeEach(function() { | ||
cy.login(user) | ||
cy.visit('/apps/files') | ||
}) | ||
|
||
it('Rename from md to txt', function() { | ||
cy.openFile('test1.md') | ||
cy.getContent() | ||
.type('## Hello world') | ||
cy.closeFile() | ||
|
||
cy.moveFile('test1.md', 'test1.txt') | ||
cy.visit('/apps/files') | ||
|
||
cy.openFile('test1.txt') | ||
cy.getContent() | ||
.find('pre') | ||
.should('contain', '## Hello world') | ||
}) | ||
|
||
it('Rename from txt to md', function() { | ||
cy.openFile('test2.txt') | ||
cy.getContent() | ||
.type('Hello world') | ||
cy.closeFile() | ||
|
||
cy.moveFile('test2.txt', 'test2.md') | ||
cy.visit('/apps/files') | ||
|
||
cy.openFile('test2.md') | ||
cy.getContent() | ||
.should('contain', 'Hello world') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters