-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5659 from owncloud/feat/refresh-list
[full-ci] feat: refresh list on breadcrumb click
- Loading branch information
Showing
5 changed files
with
96 additions
and
6 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
changelog/unreleased/enhancement-refresh-list-via-breadcrumbs
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,6 @@ | ||
Enhancement: refresh files list via breadcrumbs | ||
|
||
In the personal and public files lists we've added a click handler to the last breadcrumb item representing the current folder that reloads the files list. | ||
|
||
https://github.com/owncloud/web/issues/2018 | ||
https://github.com/owncloud/web/pull/5659 |
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
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
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
55 changes: 55 additions & 0 deletions
55
packages/web-app-files/tests/integration/specs/appBar.spec.js
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,55 @@ | ||
import '@testing-library/jest-dom' | ||
import { render, waitFor, fireEvent } from '@testing-library/vue' | ||
import { config } from '@vue/test-utils' | ||
|
||
import StoreFiles from '@files/src/store' | ||
import Store from '@runtime/src/store' | ||
import { bus } from '@pkg/src/instance' | ||
|
||
import AppBar from '@files/src/components/AppBar/AppBar.vue' | ||
|
||
const store = { | ||
...Store, | ||
modules: { | ||
...Store.modules, | ||
user: { | ||
...Store.modules.user, | ||
state: { | ||
...Store.modules.user.state, | ||
id: 'alice' | ||
} | ||
}, | ||
Files: { | ||
...StoreFiles | ||
} | ||
} | ||
} | ||
|
||
describe('AppBar contains set of actions and informations', () => { | ||
describe('when breadcrumbs are visible', () => { | ||
beforeEach(() => { | ||
config.mocks.publicPage = () => false | ||
|
||
bus.emit = jest.fn(path => path) | ||
}) | ||
|
||
test('user can refresh files list by clicking on last breadcrumb item', async () => { | ||
render( | ||
AppBar, | ||
{ | ||
store, | ||
routes: [{ name: 'files-personal', path: '/files/list/personal/:item?/:page?' }] | ||
}, | ||
(vue, store, router) => { | ||
vue.directive('translate', () => {}) | ||
router.push({ name: 'files-personal', params: { item: '/documents' } }) | ||
} | ||
) | ||
const item = document.querySelector('[data-testid="files-breadcrumbs"] .oc-button') | ||
|
||
await waitFor(() => expect(item).toBeVisible()) | ||
await fireEvent.click(item) | ||
expect(bus.emit).toHaveBeenCalledWith('app.files.list.load', '/documents') | ||
}) | ||
}) | ||
}) |