diff --git a/src/components/menu-bar/menu-bar.jsx b/src/components/menu-bar/menu-bar.jsx index bc138db9164a02ca1bd8f605c529383201c0b6b9..87af1e683916e3a26d886a5bf14f6a2c9d0cb279 100644 --- a/src/components/menu-bar/menu-bar.jsx +++ b/src/components/menu-bar/menu-bar.jsx @@ -338,37 +338,25 @@ class MenuBar extends React.Component { place={this.props.isRtl ? 'left' : 'right'} onRequestClose={this.props.onRequestCloseFile} > - <MenuItem - isRtl={this.props.isRtl} - onClick={this.handleClickNew} - > - {newProjectMessage} - </MenuItem> + <MenuSection> + <MenuItem + isRtl={this.props.isRtl} + onClick={this.handleClickNew} + > + {newProjectMessage} + </MenuItem> + </MenuSection> <MenuSection> {this.props.canSave ? ( <MenuItem onClick={this.handleClickSave}> {saveNowMessage} </MenuItem> - ) : (this.props.showComingSoon ? ( - <MenuItemTooltip - id="save" - isRtl={this.props.isRtl} - > - <MenuItem>{saveNowMessage}</MenuItem> - </MenuItemTooltip> - ) : [])} + ) : []} {this.props.canCreateCopy ? ( <MenuItem onClick={this.handleClickSaveAsCopy}> {createCopyMessage} </MenuItem> - ) : (this.props.showComingSoon ? ( - <MenuItemTooltip - id="copy" - isRtl={this.props.isRtl} - > - <MenuItem>{createCopyMessage}</MenuItem> - </MenuItemTooltip> - ) : [])} + ) : []} {this.props.canRemix ? ( <MenuItem onClick={this.handleClickRemix}> {remixMessage} @@ -377,8 +365,9 @@ class MenuBar extends React.Component { </MenuSection> <MenuSection> <SBFileUploader onUpdateProjectTitle={this.props.onUpdateProjectTitle}> - {(renderFileInput, loadProject) => ( + {(className, renderFileInput, loadProject) => ( <MenuItem + className={className} onClick={loadProject} > <FormattedMessage @@ -392,8 +381,9 @@ class MenuBar extends React.Component { </MenuItem> )} </SBFileUploader> - <SB3Downloader>{downloadProject => ( + <SB3Downloader>{(className, downloadProject) => ( <MenuItem + className={className} onClick={this.handleCloseFileMenuAndThen(downloadProject)} > <FormattedMessage diff --git a/src/components/menu/menu.jsx b/src/components/menu/menu.jsx index 4e6a6b229170d5d8f0a7844c3fa58ff3425972bc..e69068052cb4e3b3027c3550bada15c1f0812e80 100644 --- a/src/components/menu/menu.jsx +++ b/src/components/menu/menu.jsx @@ -55,9 +55,10 @@ MenuItem.propTypes = { const addDividerClassToFirstChild = (child, id) => ( React.cloneElement(child, { - className: classNames(child.className, { - [styles.menuSection]: id === 0 - }), + className: classNames( + child.className, + {[styles.menuSection]: id === 0} + ), key: id }) ); diff --git a/src/containers/sb-file-uploader.jsx b/src/containers/sb-file-uploader.jsx index ffa4e0122b8cd12265a573cb60050c2f8eaef973..f7bacfd7391db72a85483840f977bfe12c507c6a 100644 --- a/src/containers/sb-file-uploader.jsx +++ b/src/containers/sb-file-uploader.jsx @@ -107,13 +107,14 @@ class SBFileUploader extends React.Component { ); } render () { - return this.props.children(this.renderFileInput, this.handleClick); + return this.props.children(this.props.className, this.renderFileInput, this.handleClick); } } SBFileUploader.propTypes = { canSave: PropTypes.bool, // eslint-disable-line react/no-unused-prop-types children: PropTypes.func, + className: PropTypes.string, intl: intlShape.isRequired, loadingState: PropTypes.oneOf(LoadingStates), onLoadingFinished: PropTypes.func, @@ -123,6 +124,9 @@ SBFileUploader.propTypes = { loadProject: PropTypes.func }) }; +SBFileUploader.defaultProps = { + className: '' +}; const mapStateToProps = state => ({ loadingState: state.scratchGui.projectState.loadingState, vm: state.scratchGui.vm diff --git a/src/containers/sb3-downloader.jsx b/src/containers/sb3-downloader.jsx index 703674c62398a0a71a2424118d9155e556583c01..47df7bacaebe341abc571d3c9ca7e22e2d024e34 100644 --- a/src/containers/sb3-downloader.jsx +++ b/src/containers/sb3-downloader.jsx @@ -52,6 +52,7 @@ class SB3Downloader extends React.Component { children } = this.props; return children( + this.props.className, this.downloadProject ); } @@ -67,10 +68,14 @@ const getProjectFilename = (curTitle, defaultTitle) => { SB3Downloader.propTypes = { children: PropTypes.func, + className: PropTypes.string, onSaveFinished: PropTypes.func, projectFilename: PropTypes.string, saveProjectSb3: PropTypes.func }; +SB3Downloader.defaultProps = { + className: '' +}; const mapStateToProps = state => ({ saveProjectSb3: state.scratchGui.vm.saveProjectSb3.bind(state.scratchGui.vm), diff --git a/test/integration/menu-bar.test.js b/test/integration/menu-bar.test.js index a5c4ede2b7e2b2d8d932d34bb1f257013bdf38b6..ca1a4308b7a97c72a1f824e559b00a1e64859722 100644 --- a/test/integration/menu-bar.test.js +++ b/test/integration/menu-bar.test.js @@ -31,25 +31,24 @@ describe('Menu bar settings', () => { await findByXpath('//*[li[span[text()="New"]] and not(@data-tip="tooltip")]'); }); - test('File->Save now should NOT be enabled', async () => { + test('File->Upload should be enabled', async () => { await loadUri(uri); await clickXpath('//button[@title="Try It"]'); await clickXpath( '//div[contains(@class, "menu-bar_menu-bar-item") and ' + 'contains(@class, "menu-bar_hoverable")][span[text()="File"]]' ); - await findByXpath('//*[li[span[text()="Save now"]] and @data-tip="tooltip"]'); + await findByXpath('//*[li[span[text()="Upload from your computer"]] and not(@data-tip="tooltip")]'); }); - - test('File->Save as a copy should NOT be enabled', async () => { + test('File->Download should be enabled', async () => { await loadUri(uri); await clickXpath('//button[@title="Try It"]'); await clickXpath( '//div[contains(@class, "menu-bar_menu-bar-item") and ' + 'contains(@class, "menu-bar_hoverable")][span[text()="File"]]' ); - await findByXpath('//*[li[span[text()="Save as a copy"]] and @data-tip="tooltip"]'); + await findByXpath('//*[li[span[text()="Download to your computer"]] and not(@data-tip="tooltip")]'); }); test('Share button should NOT be enabled', async () => {