Commit cf45715a authored by Daniele Berardo's avatar Daniele Berardo

Merge branch 'widget-sdk/fix-classname-problem' into 'development'

Classnames will properly be appended

See merge request !35
parents b0288a12 df5cc2eb
Pipeline #189532435 passed with stages
in 6 minutes and 28 seconds
{
"name": "@tecnojest/widget-base",
"version": "1.4.32",
"version": "1.4.37",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
......
{
"name": "@tecnojest/widget-base",
"author": "Tecnojest srl https://www.invidea.it",
"version": "1.4.32",
"version": "1.4.37",
"publishConfig": {
"registry": "https://npm.invidea.it"
},
......
......@@ -75,7 +75,7 @@ export default class EmbeddableWidget {
static packageJson: PackageJson = require('../package.json');
private static setClassName({ props }: { props: Props }): void {
const { className } = props.options;
const { className } = props;
EmbeddableWidget.options.className = parseClassName(className);
}
......@@ -185,8 +185,8 @@ export default class EmbeddableWidget {
const options: Options = {
...EmbeddableWidget.INITIAL_OPTIONS,
...EmbeddableWidget.options,
...defaultOptionsFromProps,
...EmbeddableWidget.options,
...this.Widget.options,
...newOptions,
};
......
......@@ -42,7 +42,6 @@ describe('React rendering', () => {
static options = {
appendFooter: false,
appendTooltip: false,
className: 'custom',
};
render() {
......@@ -52,11 +51,7 @@ describe('React rendering', () => {
render(Widget, UID);
const widget = document.getElementById('widget');
expect(widget.parentElement.className).toEqual('custom');
expect(document.querySelector('footer')).toBeFalsy();
expect(document.querySelector('#widget-base-tooltip__container')).toBeFalsy();
expect(document.querySelector('.widget-base-tooltip__container')).toBeFalsy();
});
});
......@@ -14,7 +14,7 @@ function render(Widget, uid) {
EmbeddableWidget.Engine = {
createElement: (props) => {
return <Widget {...props} />;
return <Widget {...props} className={process.env.WIDGET_MAIN_CSS_CLASS} />;
},
render: (component, el) => ReactDOM.render(component, el),
unmountComponentAtNode: (node) => ReactDOM.unmountComponentAtNode(node),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment