Skip to content

Commit b6b79a3

Browse files
committed
Fix
1 parent 07dcde2 commit b6b79a3

File tree

2 files changed

+33
-10
lines changed

2 files changed

+33
-10
lines changed

packages/devextreme/js/__internal/ui/stepper/stepper.ts

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ import type {
1717
ItemRenderInfo,
1818
PostprocessRenderItemInfo,
1919
} from '@ts/ui/collection/collection_widget.base';
20+
import type { CollectionWidgetEditProperties } from '@ts/ui/collection/collection_widget.edit';
21+
import type { ConnectorProperties } from '@ts/ui/stepper/connector';
2022
import Connector from '@ts/ui/stepper/connector';
2123
import StepperItem, {
2224
STEP_COMPLETED_CLASS,
2325
STEP_INVALID_ICON,
2426
STEP_VALID_ICON,
2527
} from '@ts/ui/stepper/stepper_item';
2628

27-
import type { CollectionWidgetEditProperties } from '../collection/collection_widget.edit';
28-
2929
export const STEPPER_CLASS = 'dx-stepper';
3030
export const STEP_LIST_CLASS = 'dx-step-list';
3131
export const STEP_CLASS = 'dx-step';
@@ -260,18 +260,27 @@ class Stepper extends CollectionWidgetAsync<StepperProperties> {
260260
super._initMarkup();
261261
}
262262

263-
_renderConnector(): void {
264-
if (this._connector) {
265-
return;
266-
}
267-
263+
_getConnectorOptions(): ConnectorProperties {
268264
const { orientation } = this.option();
269265

270-
this._connector = this._createComponent($('<div>'), Connector, {
266+
return {
271267
orientation,
272268
size: this._getConnectorSize(),
273269
value: this._getConnectorValue(),
274-
});
270+
};
271+
}
272+
273+
_renderConnector(): void {
274+
if (this._connector) {
275+
this._connector.option(this._getConnectorOptions());
276+
return;
277+
}
278+
279+
this._connector = this._createComponent(
280+
$('<div>'),
281+
Connector,
282+
this._getConnectorOptions(),
283+
);
275284

276285
$(this.element())
277286
.prepend(this._connector.$element());

packages/devextreme/testing/tests/DevExpress.ui.widgets/stepper.tests.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ QUnit.module('Navigation', moduleConfig, () => {
9797
items: [{}, {}, {}, {}],
9898
selectedIndex: 1,
9999
linear,
100-
onSelectionChanged: function(e) {
100+
onSelectionChanged: function() {
101101
count += 1;
102102
},
103103
});
@@ -310,6 +310,20 @@ QUnit.module('Connector integration', moduleConfig, () => {
310310
assert.deepEqual(this.getConnector().$element().children().length, 1, 'content is not duplicated');
311311
});
312312
});
313+
314+
QUnit.test('connector should update its size if stepper repaint was called (T1312793)', function(assert) {
315+
const items = [{}, {}];
316+
this.reinit({ items });
317+
318+
const sizeBefore = this.getConnector().option('size');
319+
320+
items.push({});
321+
this.instance.repaint();
322+
323+
const sizeAfter = this.getConnector().option('size');
324+
325+
assert.strictEqual(sizeAfter > sizeBefore, true, 'connector size is updated after repaint');
326+
});
313327
});
314328

315329
QUnit.module('Focus', moduleConfig, () => {

0 commit comments

Comments
 (0)