Skip to content

Commit 41dce6b

Browse files
authored
Merge pull request #591 from nextcloud/feat/nc-vue-7
Bump @nextcloud/vue to 7
2 parents a19bbf4 + dfeae60 commit 41dce6b

File tree

4 files changed

+230
-366
lines changed

4 files changed

+230
-366
lines changed

lib/components/UploadPicker.cy.ts

Lines changed: 53 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ describe('UploadPicker rendering', () => {
88
cy.mount(UploadPicker)
99
cy.get('form').should('have.class', 'upload-picker')
1010
cy.get('form input[type="file"]').should('exist')
11-
cy.screenshot()
1211
})
1312
})
1413

@@ -35,7 +34,7 @@ describe('NewFileMenu handling', () => {
3534
displayName: 'Create empty file',
3635
templateName: 'New file',
3736
iconClass: 'icon-file',
38-
if: fileInfo => fileInfo.permissions.includes('CK'),
37+
if: (fileInfo) => fileInfo.permissions.includes('CK'),
3938
handler() {},
4039
}
4140

@@ -51,19 +50,18 @@ describe('NewFileMenu handling', () => {
5150
// Check and init aliases
5251
cy.get('form input[type="file"]').as('input').should('exist')
5352
cy.get('form .upload-picker__progress').as('progress').should('exist')
54-
cy.get('form .action-item__menutoggle').as('menuButton').should('exist')
53+
cy.get('form .action-item__menutoggle')
54+
.as('menuButton')
55+
.should('exist')
5556

5657
cy.get('@menuButton').click()
5758
cy.get('[data-upload-picker-add]').should('have.length', 1)
5859
cy.get('.upload-picker__menu-entry').should('have.length', 1)
5960

60-
cy.screenshot()
61-
6261
cy.get('.upload-picker__menu-entry')
6362
.click()
6463
.then(() => {
6564
expect(entry.handler).to.be.called
66-
cy.screenshot()
6765
})
6866
})
6967

@@ -74,25 +72,29 @@ describe('NewFileMenu handling', () => {
7472
// Check and init aliases
7573
cy.get('form input[type="file"]').as('input').should('exist')
7674
cy.get('form .upload-picker__progress').as('progress').should('exist')
77-
cy.get('form .action-item__menutoggle').as('menuButton').should('exist')
75+
cy.get('form .action-item__menutoggle')
76+
.as('menuButton')
77+
.should('exist')
7878

7979
cy.get('@menuButton').click()
8080
cy.get('[data-upload-picker-add]').should('have.length', 1)
8181
cy.get('.upload-picker__menu-entry').should('have.length', 1)
82-
cy.screenshot()
8382

8483
// Close menu
8584
cy.get('body').click()
86-
cy.get('[data-upload-picker-add]').should('not.exist')
87-
cy.get('.upload-picker__menu-entry').should('not.exist')
85+
cy.get('[data-upload-picker-add]').should('not.be.visible')
86+
cy.get('.upload-picker__menu-entry').should('not.be.visible')
8887

89-
cy.get('@component').then(component => {
90-
component.setContext(Object.assign({}, propsData.context, { permissions: 'GR' }))
88+
cy.get('@component').then((component) => {
89+
component.setContext(
90+
Object.assign({}, propsData.context, { permissions: 'GR' })
91+
)
9192
})
92-
cy.get('form .action-item__menutoggle').as('menuButton').should('not.exist')
93+
cy.get('form .action-item__menutoggle')
94+
.as('menuButton')
95+
.should('not.exist')
9396
cy.get('[data-upload-picker-add]').should('have.length', 1)
9497
cy.get('.upload-picker__menu-entry').should('not.exist')
95-
cy.screenshot()
9698
})
9799
})
98100

@@ -119,15 +121,15 @@ describe('UploadPicker valid uploads', () => {
119121
cy.intercept({
120122
method: 'PUT',
121123
url: '/remote.php/dav/uploads/*/web-file-upload*/*',
122-
}, req => {
124+
}, (req) => {
123125
chunksRequestsSpy()
124126
req.reply({
125127
statusCode: 201,
126128
})
127129
}).as('chunks')
128130

129131
// Intercept final assembly request
130-
cy.intercept('MOVE', '/remote.php/dav/uploads/*/web-file-upload*/.file', req => {
132+
cy.intercept('MOVE', '/remote.php/dav/uploads/*/web-file-upload*/.file', (req) => {
131133
req.reply({
132134
statusCode: 204,
133135
// Fake assembling chunks
@@ -146,15 +148,22 @@ describe('UploadPicker valid uploads', () => {
146148
})
147149

148150
cy.wait('@init').then(() => {
149-
cy.get('form .upload-picker__progress').as('progress').should('be.visible')
151+
cy.get('form .upload-picker__progress')
152+
.as('progress')
153+
.should('be.visible')
150154
})
151155
cy.wait('@chunks').then(() => {
152-
cy.get('form .upload-picker__progress').as('progress').should('be.visible')
153-
cy.get('@progress').children('progress').should('not.have.value', '0')
154-
cy.screenshot()
156+
cy.get('form .upload-picker__progress')
157+
.as('progress')
158+
.should('be.visible')
159+
cy.get('@progress')
160+
.children('progress')
161+
.should('not.have.value', '0')
155162
})
156163
cy.wait('@assembly', { timeout: 60000 }).then(() => {
157-
cy.get('form .upload-picker__progress').as('progress').should('not.be.visible')
164+
cy.get('form .upload-picker__progress')
165+
.as('progress')
166+
.should('not.be.visible')
158167
expect(chunksRequestsSpy).to.have.always.been.callCount(26)
159168
})
160169
})
@@ -174,9 +183,13 @@ describe('UploadPicker valid uploads', () => {
174183
lastModified: new Date().getTime(),
175184
})
176185

177-
cy.get('form .upload-picker__progress').as('progress').should('not.be.visible')
186+
cy.get('form .upload-picker__progress')
187+
.as('progress')
188+
.should('not.be.visible')
178189
cy.wait('@upload').then(() => {
179-
cy.get('@progress').children('progress').should('not.have.value', '0')
190+
cy.get('@progress')
191+
.children('progress')
192+
.should('not.have.value', '0')
180193
})
181194
})
182195
})
@@ -209,10 +222,12 @@ describe('Destination management', () => {
209222
})
210223

211224
cy.wait('@upload').then((upload) => {
212-
expect(upload.request.url).to.have.string('/remote.php/dav/files/user/image.jpg')
225+
expect(upload.request.url).to.have.string(
226+
'/remote.php/dav/files/user/image.jpg'
227+
)
213228
})
214229

215-
cy.get('@component').then(component => {
230+
cy.get('@component').then((component) => {
216231
component.setDestination('/Photos')
217232
// Wait for prop propagation
218233
expect(component.uploadManager.destination).to.equal('/Photos')
@@ -228,7 +243,9 @@ describe('Destination management', () => {
228243
})
229244

230245
cy.wait('@upload').then((upload) => {
231-
expect(upload.request.url).to.have.string('/remote.php/dav/files/user/Photos/image.jpg')
246+
expect(upload.request.url).to.have.string(
247+
'/remote.php/dav/files/user/Photos/image.jpg'
248+
)
232249
})
233250
})
234251
})
@@ -262,14 +279,18 @@ describe('Root management', () => {
262279
})
263280

264281
cy.wait('@upload').then((upload) => {
265-
expect(upload.request.url).to.have.string('/remote.php/dav/files/user/image.jpg')
282+
expect(upload.request.url).to.have.string(
283+
'/remote.php/dav/files/user/image.jpg'
284+
)
266285
})
267286

268-
cy.get('@component').then(component => {
287+
cy.get('@component').then((component) => {
269288
component.setRoot('dav/photos/admin/albums')
270289
component.setDestination('/2022 Summer Vacations')
271290
// Wait for prop propagation
272-
expect(component.uploadManager.root).to.match(/dav\/photos\/admin\/albums$/i)
291+
expect(component.uploadManager.root).to.match(
292+
/dav\/photos\/admin\/albums$/i
293+
)
273294
})
274295

275296
// Intercept single upload
@@ -287,7 +308,9 @@ describe('Root management', () => {
287308
})
288309

289310
cy.wait('@upload').then((upload) => {
290-
expect(upload.request.url).to.have.string('/remote.php/dav/photos/admin/albums/2022%20Summer%20Vacations/image.jpg')
311+
expect(upload.request.url).to.have.string(
312+
'/remote.php/dav/photos/admin/albums/2022%20Summer%20Vacations/image.jpg'
313+
)
291314
})
292315
})
293316
})

lib/components/UploadPicker.vue

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@
1515
</NcButton>
1616

1717
<!-- New file menu -->
18-
<Actions v-else :menu-title="addLabel">
18+
<NcActions v-else :menu-title="addLabel">
1919
<template #icon>
2020
<Plus title="" :size="20" decorative />
2121
</template>
22-
<ActionButton data-upload-picker-add @click="onClick">
22+
<NcActionButton data-upload-picker-add @click="onClick">
2323
<template #icon>
2424
<Upload title="" :size="20" decorative />
2525
</template>
2626
{{ uploadLabel }}
27-
</ActionButton>
27+
</NcActionButton>
2828

2929
<!-- Custom new file entries -->
30-
<ActionButton v-for="entry in newFileMenuEntries"
30+
<NcActionButton v-for="entry in newFileMenuEntries"
3131
:key="entry.id"
3232
:icon="entry.iconClass"
3333
class="upload-picker__menu-entry"
@@ -36,12 +36,12 @@
3636
<ActionIcon :svg="entry.iconSvgInline" />
3737
</template>
3838
{{ entry.displayName }}
39-
</ActionButton>
40-
</Actions>
39+
</NcActionButton>
40+
</NcActions>
4141

4242
<!-- Progressbar and status, hidden by css -->
4343
<div class="upload-picker__progress">
44-
<ProgressBar :error="hasFailure"
44+
<NcProgressBar :error="hasFailure"
4545
:value="progress"
4646
size="medium" />
4747
<p>{{ timeLeft }}</p>
@@ -76,10 +76,10 @@ import { getNewFileMenuEntries } from '@nextcloud/files'
7676
import { getUploader } from '../index.ts'
7777
import makeEta from 'simple-eta'
7878
79-
import ActionButton from '@nextcloud/vue/dist/Components/ActionButton.js'
80-
import Actions from '@nextcloud/vue/dist/Components/Actions.js'
81-
import NcButton from '@nextcloud/vue/dist/Components/Button.js'
82-
import ProgressBar from '@nextcloud/vue/dist/Components/ProgressBar.js'
79+
import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js'
80+
import NcActions from '@nextcloud/vue/dist/Components/NcActions.js'
81+
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
82+
import NcProgressBar from '@nextcloud/vue/dist/Components/NcProgressBar.js'
8383
8484
import Cancel from 'vue-material-design-icons/Cancel.vue'
8585
import Plus from 'vue-material-design-icons/Plus.vue'
@@ -97,13 +97,13 @@ const uploadManager = getUploader()
9797
export default {
9898
name: 'UploadPicker',
9999
components: {
100-
ActionButton,
100+
NcActionButton,
101101
ActionIcon,
102-
Actions,
102+
NcActions,
103103
NcButton,
104104
Cancel,
105105
Plus,
106-
ProgressBar,
106+
NcProgressBar,
107107
Upload,
108108
},
109109
@@ -300,7 +300,7 @@ export default {
300300
},
301301
302302
setContext(context) {
303-
logger.debug('Context changed to', context);
303+
logger.debug('Context changed to', context)
304304
this.newFileMenuEntries = getNewFileMenuEntries(context)
305305
},
306306
},

0 commit comments

Comments
 (0)