diff --git a/packages/web-app-files/src/components/SideBar/Shares/Collaborators/ListItem.vue b/packages/web-app-files/src/components/SideBar/Shares/Collaborators/ListItem.vue index e6cffd7dbf7..95b065f66c3 100644 --- a/packages/web-app-files/src/components/SideBar/Shares/Collaborators/ListItem.vue +++ b/packages/web-app-files/src/components/SideBar/Shares/Collaborators/ListItem.vue @@ -45,7 +45,7 @@ · diff --git a/packages/web-app-files/tests/unit/components/SideBar/Shares/Collaborators/ListItem.spec.js b/packages/web-app-files/tests/unit/components/SideBar/Shares/Collaborators/ListItem.spec.js index 0c03a0d5324..7a06ef3a854 100644 --- a/packages/web-app-files/tests/unit/components/SideBar/Shares/Collaborators/ListItem.spec.js +++ b/packages/web-app-files/tests/unit/components/SideBar/Shares/Collaborators/ListItem.spec.js @@ -20,7 +20,8 @@ const selectors = { collaboratorName: '.files-collaborators-collaborator-name', shareType: '.files-collaborators-collaborator-share-type', collaboratorRole: '.files-collaborators-collaborator-role', - collaboratorEdit: '.files-collaborators-collaborator-edit' + collaboratorEdit: '.files-collaborators-collaborator-edit', + shareInheritanceIndicators: '.oc-resource-indicators' } describe('Collaborator ListItem component', () => { @@ -90,6 +91,17 @@ describe('Collaborator ListItem component', () => { expect(wrapper.find(selectors.collaboratorEdit).exists()).toBeFalsy() }) }) + describe('share inheritance indicators', () => { + it('show when sharedParentRoute is given', () => { + const wrapper = createWrapper({ sharedParentRoute: { params: { item: '/folder' } } }) + expect(wrapper.find(selectors.shareInheritanceIndicators).exists()).toBeTruthy() + expect(wrapper).toMatchSnapshot() + }) + it('do not show when sharedParentRoute is not given', () => { + const wrapper = createWrapper() + expect(wrapper.find(selectors.shareInheritanceIndicators).exists()).toBeFalsy() + }) + }) }) function createWrapper({ @@ -100,7 +112,8 @@ function createWrapper({ additionalInfo: 'brian@owncloud.com' }, role = peopleRoleViewerFolder, - modifiable = true + modifiable = true, + sharedParentRoute = null } = {}) { return mount(ListItem, { store: new Vuex.Store({ @@ -124,7 +137,8 @@ function createWrapper({ shareType, role }, - modifiable + modifiable, + sharedParentRoute }, localVue, stubs: { diff --git a/packages/web-app-files/tests/unit/components/SideBar/Shares/Collaborators/__snapshots__/ListItem.spec.js.snap b/packages/web-app-files/tests/unit/components/SideBar/Shares/Collaborators/__snapshots__/ListItem.spec.js.snap new file mode 100644 index 00000000000..99240fea193 --- /dev/null +++ b/packages/web-app-files/tests/unit/components/SideBar/Shares/Collaborators/__snapshots__/ListItem.spec.js.snap @@ -0,0 +1,23 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Collaborator ListItem component share inheritance indicators show when sharedParentRoute is given 1`] = ` +
+
+ +
+

Share receiver name: Brian Murphy (brian@owncloud.com)

+

· + via + folder + + Share type: User +

+ +
+
+
+ + +
+
+`; diff --git a/packages/web-app-files/tests/unit/components/SideBar/Shares/FileShares.spec.js b/packages/web-app-files/tests/unit/components/SideBar/Shares/FileShares.spec.js index 3826567fea4..88426fc3ce4 100644 --- a/packages/web-app-files/tests/unit/components/SideBar/Shares/FileShares.spec.js +++ b/packages/web-app-files/tests/unit/components/SideBar/Shares/FileShares.spec.js @@ -111,6 +111,13 @@ describe('FileShares', () => { await wrapper.vm.$nextTick() expect(spyOnReloadShares).toHaveBeenCalledTimes(1) }) + it('correctly passes the shared parent route to the collaborator list item', () => { + const wrapper = getShallowMountedWrapper({ + user, + outgoingCollaborators: collaborators + }) + expect(wrapper).toMatchSnapshot() + }) }) describe('current space', () => { @@ -196,6 +203,8 @@ const storeOptions = (data) => { owner = user } + const highlightedFile = 'testfile.jpg' + return { state: { user @@ -204,12 +213,17 @@ const storeOptions = (data) => { Files: { state: { incomingShares: incomingCollaborators, - sharesTree: [] + sharesTree: { [`/${highlightedFile}`]: [Collaborators[0]] } }, namespaced: true, getters: { highlightedFile: () => { - return getResource({ filename: 'testfile', extension: 'jpg', type: 'file', canShare }) + return getResource({ + filename: highlightedFile.split('.')[0], + extension: highlightedFile.split('.')[1], + type: 'file', + canShare + }) }, currentFileOutgoingCollaborators: () => outgoingCollaborators, currentFileOutgoingSharesLoading: () => false, @@ -264,7 +278,15 @@ function getMountedWrapper(data, loading = false) { mocks: { sharesLoading: loading, $route: { - params: {} + params: { storageId: 1 } + }, + $router: { + currentRoute: { name: 'some-route' }, + resolve: (r) => { + return { + href: r.name + } + } } }, stubs: { @@ -291,6 +313,14 @@ function getShallowMountedWrapper(data, loading = false) { params: { storageId: 1 } + }, + $router: { + currentRoute: { name: 'some-route' }, + resolve: (r) => { + return { + href: r.name + } + } } } }) diff --git a/packages/web-app-files/tests/unit/components/SideBar/Shares/__snapshots__/FileShares.spec.js.snap b/packages/web-app-files/tests/unit/components/SideBar/Shares/__snapshots__/FileShares.spec.js.snap index d3438731d0a..a00660d67b2 100644 --- a/packages/web-app-files/tests/unit/components/SideBar/Shares/__snapshots__/FileShares.spec.js.snap +++ b/packages/web-app-files/tests/unit/components/SideBar/Shares/__snapshots__/FileShares.spec.js.snap @@ -18,7 +18,7 @@ exports[`FileShares if currentUser can share initially renders add people dialog `; -exports[`FileShares if there are collaborators present renders sharedWithLabel and sharee list 1`] = ` +exports[`FileShares if there are collaborators present correctly passes the shared parent route to the collaborator list item 1`] = `
@@ -28,9 +28,30 @@ exports[`FileShares if there are collaborators present renders sharedWithLabel a
    +
  • + +
  • +
+ +
+`; + +exports[`FileShares if there are collaborators present renders sharedWithLabel and sharee list 1`] = ` +
+ +
+

Shared with

+ + + +
+
    +
  • + +