diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f96abd3b..bf658dbc2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ ## [9.2.3] IN PROGRESS * Reset `qindex` once the search field is empty. Fixes STSMACOM-872. +* Use `` and `stripes.hasAnyPerm` to check for Notes assign/unassign perm. Fixes STSMACOM-875. ## [9.2.0](https://github.com/folio-org/stripes-smart-components/tree/v9.2.0) (2024-10-11) [Full Changelog](https://github.com/folio-org/stripes-smart-components/compare/v9.1.3...v9.2.0) diff --git a/lib/CustomFields/components/CustomFieldsForm/components/DeleteModal/tests/DeleteModal-test.js b/lib/CustomFields/components/CustomFieldsForm/components/DeleteModal/tests/DeleteModal-test.js index 2f0a6f0b8..cd81681b8 100644 --- a/lib/CustomFields/components/CustomFieldsForm/components/DeleteModal/tests/DeleteModal-test.js +++ b/lib/CustomFields/components/CustomFieldsForm/components/DeleteModal/tests/DeleteModal-test.js @@ -13,7 +13,7 @@ import { } from '../../../../../../../tests/helpers'; import fetchUsageStatistics from '../../../tests/helpers/fetchUsageStatistics'; -describe('DeleteModal', () => { +describe.only('DeleteModal', () => { setupApplication(); const deleteModal = new DeleteModalInteractor(); @@ -49,15 +49,20 @@ describe('DeleteModal', () => { }); describe('when fields stats have loaded', () => { - let a11yResults = null; - beforeEach(async () => { await deleteModal.whenLoaded(); - a11yResults = await axe.run(); }); - it('should not have any a11y issues', () => { - expect(a11yResults.violations).to.be.empty; + describe('when checking for a11y issues', () => { + let a11yResults = null; + + beforeEach(async () => { + a11yResults = await axe.run(); + }); + + it('should not have any a11y issues', () => { + expect(a11yResults.violations).to.be.empty; + }); }); it('should not show loading icon', () => { diff --git a/lib/Notes/NoteViewPage/components/NoteView/NoteView.js b/lib/Notes/NoteViewPage/components/NoteView/NoteView.js index 5b7ede8d6..4e5e3ded1 100644 --- a/lib/Notes/NoteViewPage/components/NoteView/NoteView.js +++ b/lib/Notes/NoteViewPage/components/NoteView/NoteView.js @@ -7,6 +7,7 @@ import dompurify from 'dompurify'; import { IfPermission, + IfAnyPermission, AppIcon, withStripes, stripesShape, @@ -147,7 +148,7 @@ export default class NoteView extends Component { } = this.props; - const canAssignUnassign = stripes.hasPerm('ui-notes.item.assign-unassign'); + const canAssignUnassign = stripes.hasAnyPerm('ui-notes.item.assign-unassign,ui-notes.item.assign-unassign.execute'); const canDelete = stripes.hasPerm('ui-notes.item.delete'); const canEdit = stripes.hasPerm('ui-notes.item.edit'); @@ -162,7 +163,7 @@ export default class NoteView extends Component { <> { canUnassign && - + - + } - + )} { !hideNewButton && ( diff --git a/lib/ProfilePicture/tests/ProfilePicture-test.js b/lib/ProfilePicture/tests/ProfilePicture-test.js index bca8d27f7..f0e1612db 100644 --- a/lib/ProfilePicture/tests/ProfilePicture-test.js +++ b/lib/ProfilePicture/tests/ProfilePicture-test.js @@ -1,6 +1,7 @@ import React from 'react'; -import { describe, beforeEach, it } from '@bigtest/mocha'; +import { describe, beforeEach, afterEach, it } from '@bigtest/mocha'; import { expect } from 'chai'; +import sinon from 'sinon'; import { mount, @@ -25,10 +26,26 @@ describe('ProfilePicture', () => { ); }; + beforeEach(() => { + const stub = sinon.stub(window, 'fetch'); + stub.onCall(0).returns(Promise.resolve(new window.Response(JSON.stringify({ + profile_picture_blob: 'blob', + }), { + status: 200, + headers: { + 'Content-type': 'application/json' + }, + }))); + }); + + afterEach(() => { + window.fetch.restore(); + }); + describe('render Profile Picture with profile picture UUID or URL', () => { beforeEach(async () => { await renderComponent({ - profilePictureLink: 'https://folio.org/wp-content/uploads/2023/08/folio-site-general-Illustration-social-image-1200.jpg' + profilePictureLink: 'https://url-to/image.jpg' }); a11yResults = await axe.run(); }); diff --git a/package.json b/package.json index eb943465e..760ccfdbf 100644 --- a/package.json +++ b/package.json @@ -44,10 +44,10 @@ "@bigtest/mirage": "^0.0.1", "@bigtest/mocha": "^0.5.1", "@folio/eslint-config-stripes": "^7.0.0", - "@folio/stripes-cli": "^3.0.0", + "@folio/stripes-cli": "^3.2.1", "@folio/stripes-components": "^12.0.0", "@folio/stripes-connect": "^9.0.0", - "@folio/stripes-core": "^10.0.0", + "@folio/stripes-core": "^10.2.3", "@folio/stripes-final-form": "^8.0.0", "@folio/stripes-form": "^9.0.0", "@folio/stripes-logger": "^1.0.0", @@ -105,7 +105,7 @@ "peerDependencies": { "@folio/stripes-components": "^12.0.0", "@folio/stripes-connect": "^9.0.0", - "@folio/stripes-core": "^10.0.0", + "@folio/stripes-core": "^10.2.3", "@folio/stripes-final-form": "^8.0.0", "@folio/stripes-form": "^9.0.0", "@folio/stripes-logger": "^1.0.0", diff --git a/yarn.lock b/yarn.lock index f5cf665dc..64a18164a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1684,13 +1684,13 @@ eslint-plugin-testing-library "^5.6.0" webpack "^5.80.0" -"@folio/stripes-cli@^3.0.0": - version "3.2.100000410" - resolved "https://repository.folio.org/repository/npm-folioci/@folio/stripes-cli/-/stripes-cli-3.2.100000410.tgz#ee492f4125f17b6155b3d9fa3fa6330c7e2e1320" - integrity sha512-EnxMb7FPEXUzmpHk9eJPhXNVJpC2dXcSLxxxN//gkMJYkZEIGTp4WhVUnHbvNcGEa+5AbYfMFXuycoDSmqO5uw== +"@folio/stripes-cli@^3.2.1": + version "3.3.10900000042" + resolved "https://repository.folio.org/repository/npm-folioci/@folio/stripes-cli/-/stripes-cli-3.3.10900000042.tgz#ac318215fa671c8ce809de7fb8b7e533e2b85938" + integrity sha512-HUYMPwte//7dd6mC4WkybVxhNWwUX4XXvYcQsM954Cs1XlMjPwMGE5EYCz7txiEj6Bhgd9gNZsDU24MbE+mgbQ== dependencies: "@folio/stripes-testing" "^3.0.0" - "@folio/stripes-webpack" "^5.0.0" + "@folio/stripes-webpack" "^5.2.0" "@formatjs/cli" "^6.1.3" "@formatjs/cli-lib" "^6.1.3" "@octokit/rest" "^19.0.7" @@ -1704,6 +1704,7 @@ fs-extra "^11.1.1" get-stdin "^6.0.0" global-dirs "^0.1.1" + http-proxy-middleware "^3.0.0" import-lazy "^3.1.0" inquirer "^8.2.0" is-installed-globally "^0.4.0" @@ -1779,10 +1780,10 @@ redux "^4.2.1" uuid "^9.0.0" -"@folio/stripes-core@^10.0.0": - version "10.2.1000002124" - resolved "https://repository.folio.org/repository/npm-folioci/@folio/stripes-core/-/stripes-core-10.2.1000002124.tgz#645ed3739edebeea730671829c222aa4751a0cc6" - integrity sha512-fD9v7fGeYp8kBhWhTh4Sac0geycgibcmbBFtz+jCbwNinoHs91lpwngngcMLfGX9jzXR7ZRX7SNy1qXGzsnNNw== +"@folio/stripes-core@^10.2.3": + version "10.3.109900000000430" + resolved "https://repository.folio.org/repository/npm-folioci/@folio/stripes-core/-/stripes-core-10.3.109900000000430.tgz#b26470163e083da6390ed4b5088fbb6a75c7774e" + integrity sha512-cIcHbKqgpe1AhgXuiMh/vIRIumeYO7mygSZBYxodGYok5D576aiPOdOHbt4ZcswkW68w9O9nWqaieTmkgsLvrg== dependencies: "@apollo/client" "^3.2.1" classnames "^2.2.5" @@ -1791,11 +1792,13 @@ graphql "^16.0.0" history "^4.6.3" hoist-non-react-statics "^3.3.0" + inactivity-timer "^1.0.0" jwt-decode "^3.1.2" ky "^0.23.0" localforage "^1.5.6" lodash "^4.17.21" moment-timezone "^0.5.14" + ms "^2.1.3" prop-types "^15.5.10" query-string "^7.1.2" react-cookie "^4.0.3" @@ -1887,7 +1890,7 @@ lodash "^4.17.4" query-string "^7.1.2" -"@folio/stripes-webpack@5.2.100000625", "@folio/stripes-webpack@^5.0.0": +"@folio/stripes-webpack@^5.0.0": version "5.2.100000625" resolved "https://repository.folio.org/repository/npm-folioci/@folio/stripes-webpack/-/stripes-webpack-5.2.100000625.tgz#c849d77041e557514986a1b1fc2cd94b1f2a9255" integrity sha512-HKcrWmLvqTc7ntC8RqGKi/h0W8844/EcZ1Cm7k6IEDfai0UOXUepe4cKjK8G898i0q0+tnAA7q1T0LOZE/YKHA== @@ -1955,6 +1958,74 @@ webpack-remove-empty-scripts "^1.0.1" webpack-virtual-modules "^0.4.3" +"@folio/stripes-webpack@^5.2.0": + version "5.3.10900000028" + resolved "https://repository.folio.org/repository/npm-folioci/@folio/stripes-webpack/-/stripes-webpack-5.3.10900000028.tgz#b5b62c76c96ccc9120a07379216b8c7261a84099" + integrity sha512-fjwUxompJNUQdQVN4ys29saZoilA25FNbZ4FOWT06efnHaT5MYD3AQdw/I/4CXYAproPf8wwePbntq73j0+gVQ== + dependencies: + "@babel/core" "^7.9.0" + "@babel/plugin-proposal-decorators" "^7.0.0" + "@babel/plugin-proposal-function-sent" "^7.0.0" + "@babel/plugin-proposal-throw-expressions" "^7.0.0" + "@babel/plugin-syntax-import-meta" "^7.0.0" + "@babel/plugin-transform-class-properties" "^7.0.0" + "@babel/plugin-transform-export-namespace-from" "^7.0.0" + "@babel/plugin-transform-numeric-separator" "^7.0.0" + "@babel/plugin-transform-private-methods" "^7.18.6" + "@babel/plugin-transform-private-property-in-object" "^7.21.0" + "@babel/preset-env" "^7.0.0" + "@babel/preset-flow" "^7.7.4" + "@babel/preset-react" "^7.9.0" + "@babel/preset-typescript" "^7.7.7" + "@babel/register" "^7.0.0" + "@cerner/duplicate-package-checker-webpack-plugin" "~2.1.0" + "@csstools/postcss-global-data" "^2.1.1" + "@csstools/postcss-relative-color-syntax" "^2.0.7" + "@pmmmwh/react-refresh-webpack-plugin" "^0.5.4" + "@svgr/webpack" "^8.1.0" + add-asset-html-webpack-plugin "^6.0.0" + autoprefixer "^10.4.13" + babel-loader "^9.1.3" + babel-plugin-remove-jsx-attributes "^0.0.2" + buffer "^6.0.3" + commander "^2.9.0" + connect-history-api-fallback "^1.3.0" + core-js "^3.6.1" + crypto-browserify "^3.12.0" + css-loader "^6.4.0" + csv-loader "^3.0.3" + debug "^4.0.1" + esbuild-loader "~3.0.1" + express "^4.14.0" + favicons "7.1.4" + favicons-webpack-plugin "^6.0.0" + handlebars "^4.7.7" + handlebars-loader "^1.7.1" + html-webpack-plugin "^5.3.2" + lodash "^4.17.21" + mini-css-extract-plugin "^2.7.6" + node-object-hash "^1.2.0" + postcss "^8.4.2" + postcss-custom-media "^9.0.1" + postcss-import "^15.0.1" + postcss-loader "^7.2.4" + process "^0.11.10" + react-refresh "^0.11.0" + regenerator-runtime "^0.13.3" + semver "^7.1.3" + serialize-javascript "^5.0.0" + source-map-loader "^4.0.0" + stream-browserify "^3.0.0" + style-loader "^3.3.0" + tapable "^1.0.0" + ts-loader "^9.4.1" + typescript "^5.3.3" + util-ex "^0.3.15" + webpack-dev-middleware "^5.2.1" + webpack-hot-middleware "^2.25.1" + webpack-remove-empty-scripts "^1.0.1" + webpack-virtual-modules "^0.4.3" + "@formatjs/cli-lib@^6.1.3": version "6.3.8" resolved "https://registry.yarnpkg.com/@formatjs/cli-lib/-/cli-lib-6.3.8.tgz#10b685cf833c870d342f24de0f324acd7b02d31b" @@ -2662,6 +2733,13 @@ resolved "https://registry.yarnpkg.com/@types/http-cache-semantics/-/http-cache-semantics-4.0.4.tgz#b979ebad3919799c979b17c72621c0bc0a31c6c4" integrity sha512-1m0bIFVc7eJWyve9S0RnuRgcQqF/Xd5QsUZAZeQFr1Q3/p9JWoQQEqmVy+DPTNpGXwhgIetAoYF8JSc33q29QA== +"@types/http-proxy@^1.17.15": + version "1.17.15" + resolved "https://registry.yarnpkg.com/@types/http-proxy/-/http-proxy-1.17.15.tgz#12118141ce9775a6499ecb4c01d02f90fc839d36" + integrity sha512-25g5atgiVNTIv0LBDTg1H74Hvayx0ajtJPLLcYE3whFv75J0pWNtOBzaXJQgDTmrX1bx5U9YC2w/n65BN1HwRQ== + dependencies: + "@types/node" "*" + "@types/json-schema@*", "@types/json-schema@^7.0.12", "@types/json-schema@^7.0.8", "@types/json-schema@^7.0.9": version "7.0.15" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" @@ -3757,6 +3835,13 @@ braces@^3.0.2, braces@~3.0.2: dependencies: fill-range "^7.0.1" +braces@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" + integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA== + dependencies: + fill-range "^7.1.1" + broadcast-channel@^3.4.1: version "3.7.0" resolved "https://registry.yarnpkg.com/broadcast-channel/-/broadcast-channel-3.7.0.tgz#2dfa5c7b4289547ac3f6705f9c00af8723889937" @@ -4901,6 +4986,13 @@ debug@^3.1.0, debug@^3.2.7: dependencies: ms "^2.1.1" +debug@^4.3.6: + version "4.3.7" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52" + integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ== + dependencies: + ms "^2.1.3" + decamelize@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" @@ -6373,6 +6465,13 @@ fill-range@^7.0.1: dependencies: to-regex-range "^5.0.1" +fill-range@^7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" + integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg== + dependencies: + to-regex-range "^5.0.1" + filter-obj@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/filter-obj/-/filter-obj-1.1.0.tgz#9b311112bc6c6127a16e016c6c5d7f19e0805c5b" @@ -7232,6 +7331,18 @@ http-errors@2.0.0: statuses "2.0.1" toidentifier "1.0.1" +http-proxy-middleware@^3.0.0: + version "3.0.3" + resolved "https://registry.yarnpkg.com/http-proxy-middleware/-/http-proxy-middleware-3.0.3.tgz#dc1313c75bd00d81e103823802551ee30130ebd1" + integrity sha512-usY0HG5nyDUwtqpiZdETNbmKtw3QQ1jwYFZ9wi5iHzX2BcILwQKtYDJPo7XHTsu5Z0B2Hj3W9NNnbd+AjFWjqg== + dependencies: + "@types/http-proxy" "^1.17.15" + debug "^4.3.6" + http-proxy "^1.18.1" + is-glob "^4.0.3" + is-plain-object "^5.0.0" + micromatch "^4.0.8" + http-proxy@^1.18.1: version "1.18.1" resolved "https://registry.yarnpkg.com/http-proxy/-/http-proxy-1.18.1.tgz#401541f0534884bbf95260334e72f88ee3976549" @@ -7354,6 +7465,13 @@ imurmurhash@^0.1.4: resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" integrity sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA== +inactivity-timer@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/inactivity-timer/-/inactivity-timer-1.0.0.tgz#054bf48274efea5c82713cb051b945fb42ec59bb" + integrity sha512-kxWME4cNy0TKfy9wwJ2L3oCV1JDFQTPGtYdw3Zvpiv5GbZwfnCwfESJgM1MQaYcrzLYOziiU3YEAgWOafL7Kdw== + dependencies: + ms "^2.1.1" + indent-string@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-4.0.0.tgz#624f8f4497d619b2d9768531d58f4122854d7251" @@ -8646,6 +8764,14 @@ micromatch@^4.0.0, micromatch@^4.0.4, micromatch@^4.0.5: braces "^3.0.2" picomatch "^2.3.1" +micromatch@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.8.tgz#d66fa18f3a47076789320b9b1af32bd86d9fa202" + integrity sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA== + dependencies: + braces "^3.0.3" + picomatch "^2.3.1" + microseconds@0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/microseconds/-/microseconds-0.2.0.tgz#233b25f50c62a65d861f978a4a4f8ec18797dc39" @@ -8922,7 +9048,7 @@ ms@2.1.2: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -ms@2.1.3, ms@^2.1.1: +ms@2.1.3, ms@^2.1.1, ms@^2.1.3: version "2.1.3" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==