Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'image/webp' mime type support #855

Merged
merged 1 commit into from
Apr 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added cypress/fixtures/image.webp
Binary file not shown.
78 changes: 78 additions & 0 deletions cypress/integration/image.webp.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/**
* @copyright Copyright (c) 2019 John Molakvoæ <[email protected]>
*
* @author John Molakvoæ <[email protected]>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

import { randHash } from '../utils/'
const randUser = randHash()

describe('Open image.webp in viewer', function() {
before(function() {
// Init user
cy.nextcloudCreateUser(randUser, 'password')
cy.login(randUser, 'password')

// Upload test files
cy.uploadFile('image.webp', 'image/webp')
cy.visit('/apps/files')

// wait a bit for things to be settled
cy.wait(2000)
})
after(function() {
cy.logout()
})

it('See image.webp in the list', function() {
cy.get('#fileList tr[data-file="image.webp"]', { timeout: 10000 })
.should('contain', 'image.webp')
})

it('Open the viewer on file click', function() {
cy.openFile('image.webp')
cy.get('body > .viewer').should('be.visible')
})

it('Does not see a loading animation', function() {
cy.get('body > .viewer', { timeout: 10000 })
.should('be.visible')
.and('have.class', 'modal-mask')
.and('not.have.class', 'icon-loading')
})

it('Is not in mobile fullscreen mode', function() {
cy.get('body > .viewer .modal-wrapper').should('not.have.class', 'modal-wrapper--full')
})

it('See the menu icon and title on the viewer header', function() {
cy.get('body > .viewer .modal-title').should('contain', 'image.webp')
cy.get('body > .viewer .modal-header button.action-item__menutoggle').should('be.visible')
cy.get('body > .viewer .modal-header button.icon-close').should('be.visible')
})

it('Does not see navigation arrows', function() {
cy.get('body > .viewer a.prev').should('not.be.visible')
cy.get('body > .viewer a.next').should('not.be.visible')
})

it('Does not have any visual regression', function() {
cy.matchImageSnapshot()
})
})
Binary file added image.webp
Binary file not shown.
4 changes: 2 additions & 2 deletions js/viewer-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/viewer-main.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/models/images.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default {
'image/x-xbitmap',
'image/bmp',
'image/svg+xml',
'image/webp',
],
component: Images,
}