@@ -2,6 +2,7 @@ import $ from 'jquery';
22import keyboardMock from '../../../helpers/keyboardMock.js' ;
33import { isRenderer } from 'core/utils/type' ;
44import config from 'core/config' ;
5+ import messageLocalization from 'common/core/localization/message' ;
56
67import ChatTextArea , {
78 CHAT_TEXT_AREA_ATTACH_BUTTON ,
@@ -845,6 +846,50 @@ QUnit.module('ChatTextArea', moduleConfig, () => {
845846
846847 assert . strictEqual ( this . sendButton . option ( 'disabled' ) , true , 'send button is disabled after file removal' ) ;
847848 } ) ;
849+
850+ QUnit . module ( 'Localization' , {
851+ beforeEach : function ( ) {
852+ this . defaultMessage = messageLocalization . format ( 'dxChat-fileLimitReachedWarning' ) ;
853+ this . customMessage = 'Custom file limit message' ;
854+ } ,
855+ afterEach : function ( ) {
856+ messageLocalization . load ( { en : { 'dxChat-fileLimitReachedWarning' : this . defaultMessage } } ) ;
857+ }
858+ } , ( ) => {
859+ QUnit . test ( 'informer should show custom localization message loaded before component initialization' , function ( assert ) {
860+ messageLocalization . load ( { en : { 'dxChat-fileLimitReachedWarning' : this . customMessage } } ) ;
861+
862+ this . reinit ( {
863+ fileUploaderOptions : {
864+ uploadFile : ( ) => { } ,
865+ }
866+ } ) ;
867+
868+ const fileUploader = this . getFileUploader ( ) ;
869+ fileUploader . option ( 'onFileLimitReached' ) ( ) ;
870+
871+ const $informerText = this . $element . find ( `.${ INFORMER_TEXT_CLASS } ` ) ;
872+
873+ assert . strictEqual ( $informerText . text ( ) , this . customMessage , 'custom localization message is shown' ) ;
874+ } ) ;
875+
876+ QUnit . test ( 'informer should show custom localization message loaded after component initialization' , function ( assert ) {
877+ this . reinit ( {
878+ fileUploaderOptions : {
879+ uploadFile : ( ) => { } ,
880+ }
881+ } ) ;
882+
883+ messageLocalization . load ( { en : { 'dxChat-fileLimitReachedWarning' : this . customMessage } } ) ;
884+
885+ const fileUploader = this . getFileUploader ( ) ;
886+ fileUploader . option ( 'onFileLimitReached' ) ( ) ;
887+
888+ const $informerText = this . $element . find ( `.${ INFORMER_TEXT_CLASS } ` ) ;
889+
890+ assert . strictEqual ( $informerText . text ( ) , this . customMessage , 'custom localization message is shown after runtime load' ) ;
891+ } ) ;
892+ } ) ;
848893 } ) ;
849894
850895 QUnit . module ( 'Integration with text option' , ( ) => {
0 commit comments