Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How I can mock Form.FormType = 2 (update) with JS test #26

Closed
phuocle opened this issue Aug 6, 2018 · 3 comments
Closed

How I can mock Form.FormType = 2 (update) with JS test #26

phuocle opened this issue Aug 6, 2018 · 3 comments
Labels

Comments

@phuocle
Copy link
Contributor

phuocle commented Aug 6, 2018

Our team use js test with this framework.

But we don't know how to mock the formType = 2 to check the form.

Please help me the example code.

Thanks.

@daryllabar
Copy link
Collaborator

Can you try this as a work around?

(XrmMockGenerator.formContext.ui.formSelector.getCurrentItem() as FormItemMock).formType = XrmEnum.FormType.Update;

We'll need to think if there is a better way to do this @camelCaseDave, like maybe just adding a property to the IXrmGeneratorComponents, that get's passed to the createFormContext, and then to the ```Ui.createUi()```` call

@phuocle
Copy link
Contributor Author

phuocle commented Aug 7, 2018

I can set this mock:

Xrm.Page.ui.formSelector.items.itemCollection[0].formType = 2;

After that, call: Xrm.Page.ui.getFormType() return 2

Thanks.

@phuocle phuocle closed this as completed Aug 7, 2018
@skfd
Copy link

skfd commented Oct 10, 2019

thank you for workaround, but it would be cooler to have special method. I'd try to contribute sometime, but need some API suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants