Skip to content

Commit 716b6c7

Browse files
authored
Fix #3682 request to printUrl (#3683)
* Fix #3682 request to printUrl * add test for printingEnabled False * clean up main.js code
1 parent 19ddd55 commit 716b6c7

3 files changed

Lines changed: 20 additions & 5 deletions

File tree

web/client/components/misc/toolbar/ToolbarButton.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
const React = require('react');
99
const {compose} = require('recompose');
1010
const Message = require('../../I18N/Message');
11+
const { omit } = require('lodash');
1112

1213
const {Button, Glyphicon} = require('react-bootstrap');
1314
const Loader = require('../Loader');
@@ -28,7 +29,7 @@ const popover = require('../enhancers/popover');
2829
*/
2930

3031
module.exports = compose(tooltip, popover)(({ glyph, loading, text = "", textId, glyphClassName="", loaderProps = {}, ...props} = {}) =>
31-
<Button {...props}>
32+
<Button {...omit(props, ["pullRight"])}>
3233
{glyph && !loading ? <Glyphicon glyph={glyph} className={glyphClassName}/> : null}
3334
{textId ? <Message msgId={textId} /> : text}
3435
{loading ? <Loader className={`ms-loader${props.bsStyle && ' ms-loader-' + props.bsStyle || ''}${props.bsSize && ' ms-loader-' + props.bsSize || ''}`} {...loaderProps}/> : null}

web/client/product/__tests__/main-test.jsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const expect = require('expect');
1212
const assign = require('object-assign');
1313
const ConfigUtils = require('../../utils/ConfigUtils');
1414

15-
class AppComnponent extends React.Component {
15+
class AppComponent extends React.Component {
1616
render() {
1717
return <div>TEST</div>;
1818
}
@@ -39,10 +39,11 @@ describe('standard application runner', () => {
3939
it('allows overriding appConfig', (done) => {
4040
const overrideCfg = (config) => {
4141
return assign({}, config, {
42-
appComponent: AppComnponent,
42+
appComponent: AppComponent,
4343
onStoreInit: () => {
4444
setTimeout(() => {
4545
expect(document.body.innerHTML).toContain("TEST");
46+
expect(config.printingEnabled).toBe(true);
4647
done();
4748
}, 0);
4849
}
@@ -51,4 +52,17 @@ describe('standard application runner', () => {
5152
mainApp({}, {plugins: {}}, overrideCfg);
5253
});
5354

55+
it('check printingEnabled set to false', (done) => {
56+
const overrideCfg = (config) => {
57+
return assign({}, config, {
58+
onStoreInit: () => {
59+
setTimeout(() => {
60+
expect(config.printingEnabled).toBe(false);
61+
done();
62+
}, 0);
63+
}
64+
});
65+
};
66+
mainApp({printingEnabled: false}, {plugins: {}}, overrideCfg);
67+
});
5468
});

web/client/product/main.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module.exports = (config, pluginsDef, overrideConfig = cfg => cfg) => {
2020
const {loadAfterThemeSelector} = require('../selectors/config');
2121
const StandardApp = require('../components/app/StandardApp');
2222

23-
const {pages, initialState, storeOpts, appEpics = {}, themeCfg} = config;
23+
const {pages, initialState, storeOpts, appEpics = {}, themeCfg, printingEnabled = true} = config;
2424

2525
const StandardRouter = connect((state) => ({
2626
locale: state.locale || {},
@@ -52,7 +52,7 @@ module.exports = (config, pluginsDef, overrideConfig = cfg => cfg) => {
5252
pluginsDef,
5353
initialActions,
5454
appComponent: StandardRouter,
55-
printingEnabled: true,
55+
printingEnabled,
5656
themeCfg
5757
});
5858

0 commit comments

Comments
 (0)