@@ -77,6 +77,7 @@ const OVERLAY_CONTENT_CLASS = 'dx-overlay-content';
7777const CLEAR_BUTTON_AREA = 'dx-clear-button-area' ;
7878const SCROLLVIEW_CONTENT_CLASS = 'dx-scrollview-content' ;
7979const LIST_ITEMS_CLASS = 'dx-list-items' ;
80+ const DROP_DOWN_EDITOR_FIELD_TEMPLATE_WRAPPER = 'dx-dropdowneditor-field-template-wrapper' ;
8081
8182const KEY_DOWN = 'ArrowDown' ;
8283const KEY_ENTER = 'Enter' ;
@@ -4418,6 +4419,49 @@ QUnit.module('Async tests', {}, () => {
44184419
44194420 clock . restore ( ) ;
44204421 } ) ;
4422+
4423+ QUnit . test ( 'component with async fieldTemplate render only one value on re-render (T1262587)' , function ( assert ) {
4424+ const clock = sinon . useFakeTimers ( ) ;
4425+
4426+ const $selectBox = $ ( '#selectBox' ) . dxSelectBox ( {
4427+ items : [ 1 , 2 , 3 ] ,
4428+ fieldTemplate : 'custom' ,
4429+ templatesRenderAsynchronously : true ,
4430+ integrationOptions : {
4431+ templates : {
4432+ custom : {
4433+ render : function ( args ) {
4434+ const result = $ ( '<div>' ) ;
4435+ setTimeout ( ( ) => {
4436+ result . dxTextBox ( {
4437+ value : args . model ? args . model . text : '' ,
4438+ } ) ;
4439+
4440+ result . appendTo ( args . container ) ;
4441+ args . onRendered ( ) ;
4442+ } , TIME_TO_WAIT ) ;
4443+
4444+ return result ;
4445+ }
4446+ }
4447+ }
4448+ } ,
4449+ } ) ;
4450+
4451+ const instance = $selectBox . dxSelectBox ( 'instance' ) ;
4452+
4453+ instance . option ( { value : 1 } ) ;
4454+ instance . option ( { value : null } ) ;
4455+
4456+ clock . tick ( TIME_TO_WAIT ) ;
4457+
4458+ const $wrapper = $selectBox . find ( toSelector ( DROP_DOWN_EDITOR_FIELD_TEMPLATE_WRAPPER ) ) ;
4459+ const $input = $selectBox . find ( toSelector ( TEXTEDITOR_INPUT_CLASS ) ) ;
4460+ assert . strictEqual ( $wrapper . children ( ) . length , 1 , 'only 1 element is rendered' ) ;
4461+ assert . strictEqual ( $input . val ( ) , '' , 'last value is applied' ) ;
4462+
4463+ clock . restore ( ) ;
4464+ } ) ;
44214465} ) ;
44224466
44234467QUnit . module ( 'regressions' , moduleSetup , ( ) => {
0 commit comments