Skip to content

Commit a50aa00

Browse files
julien-ncSwikritiT
andauthored
Update some npm pkgs and make adjustments (#380)
Signed-off-by: Julien Veyssier <[email protected]> Signed-off-by: Swikriti Tripathi <[email protected]> Co-authored-by: Swikriti Tripathi <[email protected]>
1 parent 57b7553 commit a50aa00

File tree

12 files changed

+15677
-26202
lines changed

12 files changed

+15677
-26202
lines changed

jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ module.exports = {
55
testMatch: ['**/tests/**/*.spec.{js,ts}'],
66
moduleNameMapper: {
77
'\\.(scss)$': '<rootDir>/tests/jest/stubs/empty.js',
8+
'@nextcloud/l10n/gettext': require.resolve('@nextcloud/l10n/gettext'),
89
},
910
preset: '@vue/cli-plugin-unit-jest/presets/no-babel',
1011
collectCoverage: true,

package-lock.json

Lines changed: 15635 additions & 26096 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@
3434
"extends @nextcloud/browserslist-config"
3535
],
3636
"engines": {
37-
"node": "^14.0.0",
38-
"npm": "^7.0.0"
37+
"node": ">= 16.0.0",
38+
"npm": "^8.0.0"
3939
},
4040
"dependencies": {
4141
"@nextcloud/auth": "^2.0.0",
4242
"@nextcloud/axios": "^2.1.0",
4343
"@nextcloud/dialogs": "^3.2.0",
4444
"@nextcloud/initial-state": "^2.0.0",
45-
"@nextcloud/l10n": "^1.4.1",
45+
"@nextcloud/l10n": "^2.1.0",
4646
"@nextcloud/moment": "^1.1.1",
4747
"@nextcloud/router": "^2.0.0",
4848
"@nextcloud/vue": "^7.0.0",
@@ -57,10 +57,10 @@
5757
"@nextcloud/eslint-config": "^8.1.2",
5858
"@nextcloud/stylelint-config": "^2.2.0",
5959
"@nextcloud/webpack-vue-config": "^5.3.0",
60-
"@vue/cli-plugin-unit-jest": "~5.0.0",
61-
"@vue/test-utils": "^1.3.4",
60+
"@vue/cli-plugin-unit-jest": "5.0.6",
61+
"@vue/test-utils": "1.3.4",
6262
"@vue/vue2-jest": "^27.0.0",
63-
"eslint-webpack-plugin": "^3.2.0",
64-
"stylelint-webpack-plugin": "^3.3.0"
63+
"eslint-webpack-plugin": "^4.0.1",
64+
"stylelint-webpack-plugin": "^4.1.1"
6565
}
6666
}

src/views/Dashboard.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ export default {
287287
</script>
288288
289289
<style scoped lang="scss">
290-
::v-deep .connect-button {
290+
:deep(.connect-button) {
291291
margin-top: 10px;
292292
}
293293
</style>

tests/jest/components/AdminSettings.spec.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@ global.OC = {
2929

3030
global.t = (app, text) => text
3131

32-
global.navigator = {
32+
const writeText = jest.fn()
33+
34+
Object.assign(global.navigator, {
3335
clipboard: {
34-
writeText: jest.fn(),
36+
writeText,
3537
},
36-
}
38+
})
3739

3840
const selectors = {
3941
oauthInstanceInput: '#openproject-oauth-instance > .text-input-input-wrapper > input',

tests/jest/components/OAuthConnectButton.spec.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@ import * as dialogs from '@nextcloud/dialogs'
88
jest.mock('@nextcloud/axios')
99
jest.mock('@nextcloud/dialogs')
1010

11-
const { location } = window
11+
const realLocation = global.window.location
1212
const localVue = createLocalVue()
1313

1414
describe('OAuthConnectButton.vue', () => {
1515
let wrapper
1616
afterEach(() => {
17-
window.location = location
17+
Object.defineProperty(global.window, 'location', {
18+
writable: true,
19+
value: realLocation,
20+
})
1821
jest.clearAllMocks()
1922
})
2023
describe('when the admin config is not okay', () => {
@@ -25,8 +28,8 @@ describe('OAuthConnectButton.vue', () => {
2528
})
2629
describe('when the admin config is ok', () => {
2730
beforeEach(() => {
28-
delete window.location
29-
window.location = { replace: jest.fn(), pathname: '/index.php/apps/files/' }
31+
delete global.window.location
32+
global.window.location = { replace: jest.fn(), pathname: '/index.php/apps/files/' }
3033
wrapper = getWrapper()
3134
})
3235
describe('on successful retrieving of the OP OAuth URI', () => {

tests/jest/components/__snapshots__/AdminSettings.spec.js.snap

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,7 @@ exports[`AdminSettings.vue OpenProject OAuth values form edit mode should show t
6363
<div class="text-input-hint">Go to your OpenProject {htmlLink} as an Administrator and start the setup and copy the values here.</div>
6464
</div>
6565
</div>
66-
<div class="form-actions"><button data-v-7a8f3349="" type="button" disabled="disabled" data-test-id="submit-op-oauth-btn" class="button-vue button-vue--icon-and-text button-vue--vue-primary"><span data-v-7a8f3349="" class="button-vue__wrapper"><span data-v-7a8f3349="" class="button-vue__icon"><span aria-hidden="true" role="img" class="material-design-icon check-bold-icon" data-v-7a8f3349=""><svg fill="currentColor" width="20" height="20" viewBox="0 0 24 24" class="material-design-icon__svg"><path d="M9,20.42L2.79,14.21L5.62,11.38L9,14.77L18.88,4.88L21.71,7.71L9,20.42Z"><!----></path></svg></span></span> <span data-v-7a8f3349="" class="button-vue__text">
67-
Save
68-
</span></span></button></div>
66+
<div class="form-actions"><button data-v-6398caea="" disabled="disabled" type="button" data-test-id="submit-op-oauth-btn" class="button-vue button-vue--icon-and-text button-vue--vue-primary"><span data-v-6398caea="" class="button-vue__wrapper"><span data-v-6398caea="" class="button-vue__icon"><span aria-hidden="true" role="img" class="material-design-icon check-bold-icon" data-v-6398caea=""><svg fill="currentColor" width="20" height="20" viewBox="0 0 24 24" class="material-design-icon__svg"><path d="M9,20.42L2.79,14.21L5.62,11.38L9,14.77L18.88,4.88L21.71,7.71L9,20.42Z"><!----></path></svg></span></span><span data-v-6398caea="" class="button-vue__text">Save</span></span></button></div>
6967
</div>
7068
</div>
7169
`;
@@ -95,9 +93,7 @@ exports[`AdminSettings.vue OpenProject OAuth values form view mode and completed
9593
</div>
9694
<!---->
9795
</div>
98-
<div class="form-actions"><button data-v-7a8f3349="" type="button" data-test-id="reset-op-oauth-btn" class="button-vue button-vue--icon-and-text button-vue--vue-secondary"><span data-v-7a8f3349="" class="button-vue__wrapper"><span data-v-7a8f3349="" class="button-vue__icon"><span aria-hidden="true" role="img" class="material-design-icon autorenew-icon" data-v-7a8f3349=""><svg fill="currentColor" width="20" height="20" viewBox="0 0 24 24" class="material-design-icon__svg"><path d="M12,6V9L16,5L12,1V4A8,8 0 0,0 4,12C4,13.57 4.46,15.03 5.24,16.26L6.7,14.8C6.25,13.97 6,13 6,12A6,6 0 0,1 12,6M18.76,7.74L17.3,9.2C17.74,10.04 18,11 18,12A6,6 0 0,1 12,18V15L8,19L12,23V20A8,8 0 0,0 20,12C20,10.43 19.54,8.97 18.76,7.74Z"><!----></path></svg></span></span> <span data-v-7a8f3349="" class="button-vue__text">
99-
Replace OpenProject OAuth values
100-
</span></span></button></div>
96+
<div class="form-actions"><button data-v-6398caea="" type="button" data-test-id="reset-op-oauth-btn" class="button-vue button-vue--icon-and-text button-vue--vue-secondary"><span data-v-6398caea="" class="button-vue__wrapper"><span data-v-6398caea="" class="button-vue__icon"><span aria-hidden="true" role="img" class="material-design-icon autorenew-icon" data-v-6398caea=""><svg fill="currentColor" width="20" height="20" viewBox="0 0 24 24" class="material-design-icon__svg"><path d="M12,6V9L16,5L12,1V4A8,8 0 0,0 4,12C4,13.57 4.46,15.03 5.24,16.26L6.7,14.8C6.25,13.97 6,13 6,12A6,6 0 0,1 12,6M18.76,7.74L17.3,9.2C17.74,10.04 18,11 18,12A6,6 0 0,1 12,18V15L8,19L12,23V20A8,8 0 0,0 20,12C20,10.43 19.54,8.97 18.76,7.74Z"><!----></path></svg></span></span><span data-v-6398caea="" class="button-vue__text">Replace OpenProject OAuth values</span></span></button></div>
10197
</div>
10298
</div>
10399
`;
@@ -117,11 +113,7 @@ exports[`AdminSettings.vue default user configurations form should be visible wh
117113
</div>
118114
`;
119115
120-
exports[`AdminSettings.vue server host url form edit mode cancel button should be visible when the form is in completed state with edit mode 1`] = `
121-
<button data-v-7a8f3349="" type="button" data-test-id="cancel-edit-server-host-btn" class="button-vue mr-2 button-vue--text-only button-vue--vue-secondary"><span data-v-7a8f3349="" class="button-vue__wrapper"><!----> <span data-v-7a8f3349="" class="button-vue__text">
122-
Cancel
123-
</span></span></button>
124-
`;
116+
exports[`AdminSettings.vue server host url form edit mode cancel button should be visible when the form is in completed state with edit mode 1`] = `<button data-v-6398caea="" type="button" data-test-id="cancel-edit-server-host-btn" class="mr-2 button-vue button-vue--text-only button-vue--vue-secondary"><span data-v-6398caea="" class="button-vue__wrapper"><span data-v-6398caea="" class="button-vue__text">Cancel</span></span></button>`;
125117
126118
exports[`AdminSettings.vue server host url form edit mode readonly state should clear the readonly state when clicked on the input 1`] = `<input type="text" placeholder="https://www.my-openproject.com" class="">`;
127119
@@ -280,11 +272,7 @@ exports[`AdminSettings.vue server host url form edit mode submit button should s
280272
</div>
281273
`;
282274
283-
exports[`AdminSettings.vue server host url form view mode and completed state reset button should be visible when the form is in completed state 1`] = `
284-
<button data-v-7a8f3349="" type="button" data-test-id="reset-server-host-btn" class="button-vue button-vue--icon-and-text button-vue--vue-secondary"><span data-v-7a8f3349="" class="button-vue__wrapper"><span data-v-7a8f3349="" class="button-vue__icon"><span aria-hidden="true" role="img" class="material-design-icon pencil-icon" data-v-7a8f3349=""><svg fill="currentColor" width="20" height="20" viewBox="0 0 24 24" class="material-design-icon__svg"><path d="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z"><!----></path></svg></span></span> <span data-v-7a8f3349="" class="button-vue__text">
285-
Edit server information
286-
</span></span></button>
287-
`;
275+
exports[`AdminSettings.vue server host url form view mode and completed state reset button should be visible when the form is in completed state 1`] = `<button data-v-6398caea="" type="button" data-test-id="reset-server-host-btn" class="button-vue button-vue--icon-and-text button-vue--vue-secondary"><span data-v-6398caea="" class="button-vue__wrapper"><span data-v-6398caea="" class="button-vue__icon"><span aria-hidden="true" role="img" class="material-design-icon pencil-icon" data-v-6398caea=""><svg fill="currentColor" width="20" height="20" viewBox="0 0 24 24" class="material-design-icon__svg"><path d="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z"><!----></path></svg></span></span><span data-v-6398caea="" class="button-vue__text">Edit server information</span></span></button>`;
288276
289277
exports[`AdminSettings.vue server host url form view mode and completed state should show field value and hide the input field 1`] = `
290278
<div class="openproject-server-host">
@@ -302,9 +290,7 @@ exports[`AdminSettings.vue server host url form view mode and completed state sh
302290
</div>
303291
<!---->
304292
</div>
305-
<div class="form-actions"><button data-v-7a8f3349="" type="button" data-test-id="reset-server-host-btn" class="button-vue button-vue--icon-and-text button-vue--vue-secondary"><span data-v-7a8f3349="" class="button-vue__wrapper"><span data-v-7a8f3349="" class="button-vue__icon"><span aria-hidden="true" role="img" class="material-design-icon pencil-icon" data-v-7a8f3349=""><svg fill="currentColor" width="20" height="20" viewBox="0 0 24 24" class="material-design-icon__svg"><path d="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z"><!----></path></svg></span></span> <span data-v-7a8f3349="" class="button-vue__text">
306-
Edit server information
307-
</span></span></button>
293+
<div class="form-actions"><button data-v-6398caea="" type="button" data-test-id="reset-server-host-btn" class="button-vue button-vue--icon-and-text button-vue--vue-secondary"><span data-v-6398caea="" class="button-vue__wrapper"><span data-v-6398caea="" class="button-vue__icon"><span aria-hidden="true" role="img" class="material-design-icon pencil-icon" data-v-6398caea=""><svg fill="currentColor" width="20" height="20" viewBox="0 0 24 24" class="material-design-icon__svg"><path d="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z"><!----></path></svg></span></span><span data-v-6398caea="" class="button-vue__text">Edit server information</span></span></button>
308294
<!---->
309295
<!---->
310296
</div>

tests/jest/components/admin/__snapshots__/TextInput.spec.js.snap

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,7 @@ exports[`TextInput.vue with copy button prop should render copy button if set 1`
106106
<div class="text-input-label">
107107
some label
108108
</div>
109-
<div class="text-input-input-wrapper"><input type="text" placeholder="" class=""> <button data-v-7a8f3349="" type="button" disabled="disabled" title="Copy value" class="button-vue text-input-copy-value button-vue--icon-and-text button-vue--vue-secondary"><span data-v-7a8f3349="" class="button-vue__wrapper"><span data-v-7a8f3349="" class="button-vue__icon"><span aria-hidden="true" aria-label="" role="img" class="material-design-icon clippy-icon" data-v-7a8f3349=""><svg fill="currentColor" width="16" height="16" enable-background="new 0 0 16 16" version="1.1" viewBox="0 0 16 16" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><path d="m13 15h-11l0.0005-10h11v3.0002l1-0.0004 0.0005-5.0001c0.000058-0.5834-0.4165-1.0002-1.0005-1.0001l-3.467 0.0005c0.0008-1.183-0.9492-2.0001-2.1325-2.0001s-2.1333 0.8171-2.1333 2.0004h-3.2c-0.5834 0-1.0662 0.4166-1.0662 0.9999l-0.0005 12c-0.0000243 0.584 0.4833 1 1.0667 1l10.933-0.0005c0.584-0.001 1-0.416 1-1v-3h-1zm-8.8005-12h1.0672c0.5833 0 1.0666-0.4162 1.0666-0.9996 0-0.5833 0.4834-0.9337 1.0667-0.9337s1.0667 0.3504 1.0667 0.9337c0 0.5834 0.5333 0.9996 1.0666 0.9996h1.2667c0.517 0 1.2 0.4166 1.2 1h-9c-0.0004-0.65 0.5988-1 1.1988-1zm-1.1995 8h2v-1h-2zm7.9998-2v-2l-4 3 3.9998 3v-2l5.0002-0.00005v-2l-4.9998-0.00005zm-8 4h4v-1h-4zm6-7h-6v1h6zm-3 2h-3v1h3z"></path></svg></span></span> <span data-v-7a8f3349="" class="button-vue__text">
110-
Copy value
111-
</span></span></button></div>
109+
<div class="text-input-input-wrapper"><input type="text" placeholder="" class=""> <button data-v-6398caea="" disabled="disabled" type="button" title="Copy value" class="text-input-copy-value button-vue button-vue--icon-and-text button-vue--vue-secondary"><span data-v-6398caea="" class="button-vue__wrapper"><span data-v-6398caea="" class="button-vue__icon"><span aria-hidden="true" aria-label="" role="img" class="material-design-icon clippy-icon" data-v-6398caea=""><svg fill="currentColor" width="16" height="16" enable-background="new 0 0 16 16" version="1.1" viewBox="0 0 16 16" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><path d="m13 15h-11l0.0005-10h11v3.0002l1-0.0004 0.0005-5.0001c0.000058-0.5834-0.4165-1.0002-1.0005-1.0001l-3.467 0.0005c0.0008-1.183-0.9492-2.0001-2.1325-2.0001s-2.1333 0.8171-2.1333 2.0004h-3.2c-0.5834 0-1.0662 0.4166-1.0662 0.9999l-0.0005 12c-0.0000243 0.584 0.4833 1 1.0667 1l10.933-0.0005c0.584-0.001 1-0.416 1-1v-3h-1zm-8.8005-12h1.0672c0.5833 0 1.0666-0.4162 1.0666-0.9996 0-0.5833 0.4834-0.9337 1.0667-0.9337s1.0667 0.3504 1.0667 0.9337c0 0.5834 0.5333 0.9996 1.0666 0.9996h1.2667c0.517 0 1.2 0.4166 1.2 1h-9c-0.0004-0.65 0.5988-1 1.1988-1zm-1.1995 8h2v-1h-2zm7.9998-2v-2l-4 3 3.9998 3v-2l5.0002-0.00005v-2l-4.9998-0.00005zm-8 4h4v-1h-4zm6-7h-6v1h6zm-3 2h-3v1h3z"></path></svg></span></span><span data-v-6398caea="" class="button-vue__text">Copy value</span></span></button></div>
112110
<!---->
113111
</div>
114112
`;

tests/jest/components/tab/SearchInput.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ function mountSearchInput(fileInfo = {}, linkedWorkPackages = [], data = {}) {
487487
...data,
488488
}),
489489
stubs: {
490-
Avatar: true,
490+
NcAvatar: true,
491491
WorkPackage: true,
492492
},
493493
propsData: {

tests/jest/components/tab/__snapshots__/SearchInput.spec.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Object {
3737
`;
3838

3939
exports[`SearchInput.vue work packages multiselect search list should not be displayed if the search results is empty 1`] = `
40-
<ul class="multiselect__content" style="display: block;">
40+
<ul role="listbox" id="listbox-null" class="multiselect__content" style="display: block;">
4141
<!---->
4242
<li style="display: none;"><span class="multiselect__option"><span>No results</span></span></li>
4343
<li><span class="multiselect__option">

0 commit comments

Comments
 (0)