@@ -5,13 +5,15 @@ import {
5
5
PopupModel ,
6
6
IAction ,
7
7
QuestionMatrixDynamicModel ,
8
- _setIsTouch
8
+ _setIsTouch ,
9
+ QuestionTextModel
9
10
} from "survey-core" ;
10
11
import { PropertyGridViewModel } from "../../src/property-grid/property-grid-view-model" ;
11
12
export { PropertyGridEditorMatrix } from "../../src/property-grid/matrices" ;
12
13
import { CreatorTester } from "../creator-tester" ;
13
14
import { ObjectSelectorModel } from "../../src/property-grid/object-selector" ;
14
15
import { settings } from "../../src/creator-settings" ;
16
+ import { TabDesignerPlugin } from "../../src/components/tabs/designer-plugin" ;
15
17
16
18
test ( "Generate and update title correctly" , ( ) => {
17
19
const creator = new CreatorTester ( ) ;
@@ -191,4 +193,26 @@ test("Create the property grid survey on request", () => {
191
193
const model = new PropertyGridViewModel ( propertyGrid , creator ) ;
192
194
expect ( model . getPropertyValue ( "survey" ) ) . toBeFalsy ( ) ;
193
195
expect ( model . survey ) . toBeTruthy ( ) ;
194
- } ) ;
196
+ } ) ;
197
+
198
+ test ( "Object selector's title should be leaved unchanged when changing question's name - Bug#6699" , ( ) => {
199
+ const creator = new CreatorTester ( ) ;
200
+ creator . JSON = {
201
+ elements : [
202
+ {
203
+ type : "text" ,
204
+ name : "question1"
205
+ }
206
+ ]
207
+ } ;
208
+ const question = creator . survey . getQuestionByName ( "question1" ) ;
209
+ creator . showOneCategoryInPropertyGrid = true ;
210
+ const propertyGridViewModel = ( creator . getPlugin ( "designer" ) as TabDesignerPlugin ) . propertyGridViewModel ;
211
+ const selectorBarItem = propertyGridViewModel . objectSelectionAction ;
212
+ creator . selectElement ( question ) ;
213
+ expect ( selectorBarItem . title ) . toBe ( "General" ) ;
214
+ expect ( selectorBarItem . tooltip ) . toBe ( "question1" ) ;
215
+ question . name = "question2" ;
216
+ expect ( selectorBarItem . title ) . toBe ( "General" ) ;
217
+ expect ( selectorBarItem . tooltip ) . toBe ( "question2" ) ;
218
+ } ) ;
0 commit comments