Modifying the unit test to fix errors

Modify the unit test to set the string variables which are used for
calls to attribute.setSubmitMode and attribute.setRequiredLevel to use
const strings as strings declared as var or let fail.

This is by design for string union types in TypeScript - see:
https://github.com/Microsoft/TypeScript/issues/9489
This commit is contained in:
clownwilleatme
2017-02-07 17:08:22 +11:00
parent ff6194f493
commit 892bc67f32

View File

@@ -124,15 +124,15 @@ Xrm.Page.ui.setFormNotification("Test", level, "uniqueId");
/// Demonstrate Requirement Level and Submit Mode both via string parameters and String Literal Types
let requirementLevel: Xrm.Page.RequirementLevel = "none";
let requirementLevelString = "none";
const requirementLevelString = "none";
let submitMode: Xrm.Page.SubmitMode = "always";
let submitModeString = "always";
const submitModeString = "always";
let attribute = Xrm.Page.getAttribute<Xrm.Page.LookupAttribute>("customerid");
attribute.setSubmitMode(submitMode);
attribute.setSubmitMode(submitMode);
attribute.setSubmitMode(submitModeString); // Works if the string is a const
attribute.setRequiredLevel(requirementLevel);
attribute.setRequiredLevel(requirementLevelString);
attribute.setRequiredLevel(requirementLevelString); // Works if the string is a const
/// Demonstrate v8 AutoComplete