diff --git a/js/renovation/preact-wrapper/component.js b/js/renovation/preact-wrapper/component.js index 52a8b784f50a..9a92b700cc14 100644 --- a/js/renovation/preact-wrapper/component.js +++ b/js/renovation/preact-wrapper/component.js @@ -2,6 +2,7 @@ import DOMComponent from '../../core/dom_component'; import * as Preact from 'preact'; import { extend } from '../../core/utils/extend'; import { getInnerActionName } from './utils'; +import { isEmpty } from '../../core/utils/string'; export default class PreactWrapper extends DOMComponent { getInstance() { @@ -30,6 +31,7 @@ export default class PreactWrapper extends DOMComponent { getProps(isFirstRender) { const options = extend({}, this.option()); const attributes = this.$element()[0].attributes; + const { width, height } = this.$element()[0].style; if(isFirstRender) { options.elementAttr = extend(Object.keys(attributes).reduce((a, key) => { @@ -50,6 +52,12 @@ export default class PreactWrapper extends DOMComponent { .filter(name => name.indexOf('dx-') < 0); } } + if(!isEmpty(width)) { + options.width = width; + } + if(!isEmpty(height)) { + options.height = height; + } return options; } diff --git a/testing/tests/Renovation/button.tests.js b/testing/tests/Renovation/button.tests.js index 523a476e61dc..a18ff4d50a60 100644 --- a/testing/tests/Renovation/button.tests.js +++ b/testing/tests/Renovation/button.tests.js @@ -416,8 +416,7 @@ QUnit.module('widget sizing render', {}, () => { const instance = $element.Button('instance'); assert.strictEqual(instance.option('width'), undefined); - // TODO - // assert.strictEqual($element.outerWidth(), 300, 'outer width of the element must be equal to custom width'); + assert.strictEqual($element.outerWidth(), 300, 'outer width of the element must be equal to custom width'); }); QUnit.test('change width', function(assert) {