From 230e8e905d7876bfee0aa5956cf9109bb6cf40b3 Mon Sep 17 00:00:00 2001 From: Tyler Hallada Date: Wed, 9 May 2018 18:16:50 -0400 Subject: [PATCH] fix(paragon): upgrade to paragon 3.0.5 Fix broken models. --- package-lock.json | 39 +------------ package.json | 7 ++- src/SFE.scss | 58 +++++++++++++++++++ src/components/AssetsDropZone/index.jsx | 5 +- src/components/AssetsTable/AssetsTable.scss | 15 ----- .../AssetsTable/AssetsTable.test.jsx | 15 ++++- src/components/AssetsTable/index.jsx | 52 ++++++++--------- .../EditImageModal/EditImageModal.scss | 13 ----- .../EditImageModal/EditImageModal.test.jsx | 16 ++++- .../EditImageModal/displayMessages.jsx | 5 ++ src/components/EditImageModal/index.jsx | 10 +++- src/data/i18n/default/transifex_input.json | 1 + src/utils/i18n/enzymeHelper.jsx | 7 ++- src/utils/mockModalPortal.js | 30 ++++++++++ src/utils/mockQuerySelector.js | 21 +++++++ 15 files changed, 192 insertions(+), 102 deletions(-) create mode 100644 src/utils/mockModalPortal.js create mode 100644 src/utils/mockQuerySelector.js diff --git a/package-lock.json b/package-lock.json index 5b2e2c69..076c2c85 100644 --- a/package-lock.json +++ b/package-lock.json @@ -232,9 +232,9 @@ } }, "@edx/paragon": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/@edx/paragon/-/paragon-2.7.0.tgz", - "integrity": "sha512-YbZpn8/84ddsAsh/vWP63Zi9uRTXrvDLVP4ZJqLuQjJhts6OVetXvfWFHON/3fHK4Yvp090xaAWzbpxwJJ88Uw==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@edx/paragon/-/paragon-3.0.5.tgz", + "integrity": "sha512-iuwNYgpjmzYxIuN78LSCZyBRUZw1jHKvV+daQGxbMWQfEBi/GIGevvD31yb72mai+DUw1AudnxP1/cWcrcWsUw==", "requires": { "@edx/edx-bootstrap": "1.0.0", "babel-polyfill": "6.26.0", @@ -10044,16 +10044,6 @@ "integrity": "sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=", "dev": true }, - "lodash.isfunction": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/lodash.isfunction/-/lodash.isfunction-3.0.9.tgz", - "integrity": "sha512-AirXNj15uRIMMPihnkInB4i3NHeb4iBtNg9WRWuK2o31S+ePwwNmDPaTL3o7dTJ+VXNZim7rFs4rxN4YU1oUJw==" - }, - "lodash.isobject": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/lodash.isobject/-/lodash.isobject-3.0.2.tgz", - "integrity": "sha1-PI+41bW/S/kK4G4U8qUwpO2TXh0=" - }, "lodash.isplainobject": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", @@ -10145,11 +10135,6 @@ "integrity": "sha1-JMS/zWsvuji/0FlNsRedjptlZWE=", "dev": true }, - "lodash.tonumber": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/lodash.tonumber/-/lodash.tonumber-4.0.3.tgz", - "integrity": "sha1-C5azGzVnJ5Prf1pj7nkfG56QJdk=" - }, "lodash.topairs": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/lodash.topairs/-/lodash.topairs-4.3.0.tgz", @@ -14846,24 +14831,6 @@ "integrity": "sha512-HH2N/b5tRxh7ypIgCRsiBl/CTxRkTEPf9DhIstaM6hne4WiwM5/bBbWuvVlRZc/i3FdqZED3pZ//6n4mtxma4w==", "dev": true }, - "reactstrap": { - "version": "4.8.0", - "resolved": "https://registry.npmjs.org/reactstrap/-/reactstrap-4.8.0.tgz", - "integrity": "sha1-6zUGQqYoLHnH4b2Nb3XGJxMaQvY=", - "requires": { - "classnames": "2.2.5", - "lodash.isfunction": "3.0.9", - "lodash.isobject": "3.0.2", - "lodash.tonumber": "4.0.3", - "prop-types": "15.6.1", - "reactstrap-tether": "1.3.4" - } - }, - "reactstrap-tether": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/reactstrap-tether/-/reactstrap-tether-1.3.4.tgz", - "integrity": "sha1-htlNMCFv+jTOssYm9LmRLA0ZOJQ=" - }, "read-chunk": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/read-chunk/-/read-chunk-2.1.0.tgz", diff --git a/package.json b/package.json index 6a04d2fc..3ca0406d 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "license": "AGPL-3.0", "dependencies": { "@edx/edx-bootstrap": "^1.0.0", - "@edx/paragon": "2.7.0", + "@edx/paragon": "3.0.5", "babel-polyfill": "^6.26.0", "classnames": "^2.2.5", "copy-to-clipboard": "^3.0.8", @@ -32,7 +32,6 @@ "react-paginate": "^5.0.0", "react-redux": "^5.0.6", "react-transition-group": "^2.2.1", - "reactstrap": "^4.8.0", "redux": "^3.7.2", "redux-devtools-extension": "^2.13.2", "redux-thunk": "^2.2.0", @@ -108,7 +107,9 @@ "/src/components/BackendStatusBanner/", "/src/.*/container.jsx", "/src/data/i18n/locales/", - "/src/utils/matches-prefixer.js" + "/src/utils/matches-prefixer.js", + "/src/utils/mockPortals.js", + "/src/utils/mockQuerySelector.js" ], "transformIgnorePatterns": [ "/node_modules/(?!(@edx/paragon)/).*/" diff --git a/src/SFE.scss b/src/SFE.scss index 63fd90be..3153aca9 100644 --- a/src/SFE.scss +++ b/src/SFE.scss @@ -79,3 +79,61 @@ input[type="search"] { .list { margin-left: $spacer * 2; } + +.modal.show { + position: fixed; + background-color: transparent; + max-height: 100%; + width: 100%; + + &:focus { + .modal-dialog { + box-shadow: $btn-focus-box-shadow; + } + } +} + +.modal.is-ie11 { + // fix browser that likes to do things its own way + overflow-y: scroll; + height: auto; + + .modal-dialog { + height: auto; + max-height: none; + } +} + +.modal.modal-backdrop { + background-color: rgba(0,0,0,0.3); + + // Fade for backdrop + &.fade { opacity: 0; } + &.show { opacity: 1; } +} + +.modal-dialog { + height: 100%; + margin: auto; + padding: $spacer / 2; + + @media(min-width: map-get($grid-breakpoints, 'sm')) { + padding: $spacer; + } +} + +.modal-content { + max-height: 100%; +} + +.modal-header { + flex: 0 0 auto; +} + +.modal-body { + overflow: auto; +} + +.modal-footer { + flex: 0 0 auto; +} diff --git a/src/components/AssetsDropZone/index.jsx b/src/components/AssetsDropZone/index.jsx index 066cdc5a..3aa88a9d 100644 --- a/src/components/AssetsDropZone/index.jsx +++ b/src/components/AssetsDropZone/index.jsx @@ -49,7 +49,10 @@ export default class AssetsDropZone extends React.Component { asset.externa let wrapper; describe('', () => { + beforeEach(() => { + mockQuerySelector.init(); + }); + afterEach(() => { + mockQuerySelector.reset(); + }); describe('renders', () => { beforeEach(() => { wrapper = mountWithIntl( @@ -301,7 +308,7 @@ describe('', () => { trashButtons.at(0).simulate('click'); modal = wrapper.find('[role="dialog"]'); - expect(modal.hasClass('modal-open')).toEqual(true); + expect(modal.hasClass('show')).toEqual(true); expect(wrapper.state('modalOpen')).toEqual(true); }); it('closes when Cancel button clicked; modalOpen state is false', () => { @@ -463,6 +470,8 @@ describe('Lock Asset', () => { const getLockingButtons = () => wrapper.find('button > .fa-spinner'); beforeEach(() => { + mockQuerySelector.init(); + wrapper = mountWithIntl( { ); }); + afterEach(() => { + mockQuerySelector.reset(); + }); + it('renders icons and buttons', () => { const lockedButtons = getLockedButtons(); expect(lockedButtons).toHaveLength(1); diff --git a/src/components/AssetsTable/index.jsx b/src/components/AssetsTable/index.jsx index 021ce95c..a25cab31 100644 --- a/src/components/AssetsTable/index.jsx +++ b/src/components/AssetsTable/index.jsx @@ -11,6 +11,7 @@ import WrappedMessage from '../../utils/i18n/formattedMessageWrapper'; import messages from './displayMessages'; const isIE11 = !!window.MSInputMethodContext && !!document.documentMode; +const modalWrapperID = 'modalWrapper'; export default class AssetsTable extends React.Component { constructor(props) { @@ -355,33 +356,30 @@ export default class AssetsTable extends React.Component { renderModal() { return ( - - { - displayText => ( - )} - body={this.renderModalBody()} - closeText={displayText} - onClose={this.closeModal} - buttons={[ -