import { ItemCollectionMock } from "../../collection/itemcollection/itemcollection.mock" ; import { UiCanGetVisibleElementMock } from "../uicangetvisibleelement/uicangetvisibleelement.mock" ; import { UiLabelElementMock } from "../uilabelelement/uilabelelement.mock" ; import { UiStandardElementMock } from "../uistandardelement/uistandardelement.mock" ; export class SectionMock implements Xrm . Controls . Section { public controls : Xrm . Collection . ItemCollection < Xrm . Controls . Control > ; public parent : Xrm . Controls . Tab ; private name : string ; private uiStandardElement : Xrm . Controls . UiStandardElement ; constructor ( name , parent ? , uiStandardElement ? , controls ? ) { this . name = name ; this . parent = parent ; if ( this . parent && this . parent . sections . get ( name ) == null ) { const sections = this . parent . sections as ItemCollectionMock < Xrm . Controls . Section > ; if ( sections ) { sections . push ( this ) ; } } this . uiStandardElement = uiStandardElement || new UiStandardElementMock ( new UiLabelElementMock ( name ) , new UiCanGetVisibleElementMock ( true ) ) ; this . controls = controls || new ItemCollectionMock ( ) ; } public getName ( ) { return this . name ; } public getParent ( ) { return this . parent ; } public setVisible ( visible ) { this . uiStandardElement . setVisible ( visible ) ; } public getVisible ( ) { return this . uiStandardElement . getVisible ( ) ; } public getLabel ( ) { return this . uiStandardElement . getLabel ( ) ; } public setLabel ( label ) { this . uiStandardElement . setLabel ( label ) ; } }