Advertisement
Guest User

Untitled

a guest
Jan 18th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { XrmMockGenerator, ItemCollectionMock, StringControlMock, BooleanControlMock, LookupControlMock,  } from 'xrm-mock';
  2.  
  3. export const initForm = () => {
  4.     const page = <Form.xcode_kreator_umowy_energii_elektrycznej.Main.Informacje>Xrm.Page;
  5.  
  6.     page.ui.tabs.forEach(x => {
  7.         const sections = []
  8.         debugger
  9.         x.sections.forEach(section => {
  10.             sections.push(XrmMockGenerator.Section.createSection(section.getName(), section.getLabel(), section.getVisible(), null, new ItemCollectionMock()))
  11.         })
  12.         XrmMockGenerator.Tab.createTab(x.getName(), x.getLabel(), x.getVisible(), x.getDisplayState(), null, sections);
  13.     })
  14.  
  15.     page.ui.controls.forEach(x => {
  16.         if (x instanceof StringControlMock) {
  17.             XrmMockGenerator.Attribute.createString(x.getName(), null);
  18.         }
  19.         if (x instanceof BooleanControlMock) {
  20.             XrmMockGenerator.Attribute.createBoolean(x.getName(), false);
  21.         }
  22.         if (x instanceof LookupControlMock) {
  23.             XrmMockGenerator.Attribute.createLookup(x.getName(), null);
  24.         }
  25.     })
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement