@@ -231,6 +231,15 @@ describe("usePresentationInstanceFilteringProps", () => {
231
231
label : "ConcreteField2" ,
232
232
category,
233
233
} ) ;
234
+ const mergedPropertiesField = createTestPropertiesContentField ( {
235
+ properties : [
236
+ { property : { classInfo : concreteClass1 , name : "mergedProp" , type : "string" } } ,
237
+ { property : { classInfo : concreteClass2 , name : "mergedProp" , type : "string" } } ,
238
+ ] ,
239
+ name : "mergedField" ,
240
+ label : "MergedField" ,
241
+ category,
242
+ } ) ;
234
243
const derivedPropertiesField = createTestPropertiesContentField ( {
235
244
properties : [ { property : { classInfo : derivedClass , name : "derivedProp" , type : "string" } } ] ,
236
245
name : "derivedField" ,
@@ -243,7 +252,7 @@ describe("usePresentationInstanceFilteringProps", () => {
243
252
{ selectClassInfo : concreteClass2 , isSelectPolymorphic : false } ,
244
253
] ,
245
254
categories : [ category ] ,
246
- fields : [ basePropertiesField , concretePropertiesField1 , concretePropertiesField2 , derivedPropertiesField ] ,
255
+ fields : [ basePropertiesField , concretePropertiesField1 , concretePropertiesField2 , mergedPropertiesField , derivedPropertiesField ] ,
247
256
} ) ;
248
257
249
258
const onCloseEvent = new BeEvent < ( ) => void > ( ) ;
@@ -350,7 +359,7 @@ describe("usePresentationInstanceFilteringProps", () => {
350
359
act ( ( ) => {
351
360
result . current . onSelectedClassesChanged ( [ concreteClass2 . id ] ) ;
352
361
} ) ;
353
- await waitFor ( ( ) => expect ( result . current . properties ) . to . have . lengthOf ( 2 ) ) ;
362
+ await waitFor ( ( ) => expect ( result . current . properties ) . to . have . lengthOf ( 3 ) ) ;
354
363
} ) ;
355
364
356
365
it ( "return all properties when selected class contains all available properties" , async ( ) => {
@@ -414,6 +423,17 @@ describe("usePresentationInstanceFilteringProps", () => {
414
423
await waitFor ( ( ) => expect ( result . current . selectedClasses ) . to . have . lengthOf ( 2 ) . and . containSubset ( [ concreteClass1 , concreteClass2 ] ) ) ;
415
424
} ) ;
416
425
426
+ it ( "selects all classes that have selected property" , async ( ) => {
427
+ const { result } = renderHook ( ( props : HookProps ) => usePresentationInstanceFilteringProps ( props . descriptor , props . imodel ) , { initialProps } ) ;
428
+
429
+ const property = result . current . properties . find ( ( prop ) => prop . displayLabel === mergedPropertiesField . label ) as PropertyDescription ;
430
+
431
+ act ( ( ) => {
432
+ result . current . onRulePropertySelected ( property ) ;
433
+ } ) ;
434
+ await waitFor ( ( ) => expect ( result . current . selectedClasses ) . to . have . lengthOf ( 2 ) . and . containSubset ( [ concreteClass1 , concreteClass2 ] ) ) ;
435
+ } ) ;
436
+
417
437
it ( "does not change selected classes when selected property class is already selected" , async ( ) => {
418
438
const { result } = renderHook ( ( props : HookProps ) => usePresentationInstanceFilteringProps ( props . descriptor , props . imodel ) , { initialProps } ) ;
419
439
0 commit comments