| Index: third_party/closure_compiler/runner/test/com/google/javascript/jscomp/ChromePassTest.java
|
| diff --git a/third_party/closure_compiler/runner/test/com/google/javascript/jscomp/ChromePassTest.java b/third_party/closure_compiler/runner/test/com/google/javascript/jscomp/ChromePassTest.java
|
| index 4156eb93a65f9d027ec3d164618f1ec183bed083..20665439617704f47a26184cf0418d5122f01902 100644
|
| --- a/third_party/closure_compiler/runner/test/com/google/javascript/jscomp/ChromePassTest.java
|
| +++ b/third_party/closure_compiler/runner/test/com/google/javascript/jscomp/ChromePassTest.java
|
| @@ -184,4 +184,46 @@ public class ChromePassTest extends CompilerTestCase {
|
| null, ChromePass.CR_DEFINE_INVALID_RETURN_IN_FUNCTION);
|
| }
|
|
|
| + public void testObjectDefinePropertyDefinesUnquotedProperty() throws Exception {
|
| + test(
|
| + "Object.defineProperty(a.b, 'c', {});",
|
| + "Object.defineProperty(a.b, 'c', {});\n" +
|
| + "/** @type {*} */\n" +
|
| + "a.b.c;");
|
| + }
|
| +
|
| + public void testCrDefinePropertyDefinesUnquotedPropertyWithStringTypeForPropertyKindAttr()
|
| + throws Exception {
|
| + test(
|
| + "cr.defineProperty(a.b, 'c', cr.PropertyKind.ATTR);",
|
| + "cr.defineProperty(a.b, 'c', cr.PropertyKind.ATTR);\n" +
|
| + "/** @type {string} */\n" +
|
| + "a.b.c;");
|
| + }
|
| +
|
| + public void testCrDefinePropertyDefinesUnquotedPropertyWithBooleanTypeForPropertyKindBoolAttr()
|
| + throws Exception {
|
| + test(
|
| + "cr.defineProperty(a.b, 'c', cr.PropertyKind.BOOL_ATTR);",
|
| + "cr.defineProperty(a.b, 'c', cr.PropertyKind.BOOL_ATTR);\n" +
|
| + "/** @type {boolean} */\n" +
|
| + "a.b.c;");
|
| + }
|
| +
|
| + public void testCrDefinePropertyDefinesUnquotedPropertyWithAnyTypeForPropertyKindJs()
|
| + throws Exception {
|
| + test(
|
| + "cr.defineProperty(a.b, 'c', cr.PropertyKind.JS);",
|
| + "cr.defineProperty(a.b, 'c', cr.PropertyKind.JS);\n" +
|
| + "/** @type {*} */\n" +
|
| + "a.b.c;");
|
| + }
|
| +
|
| + public void testCrDefinePropertyInvalidPropertyKind()
|
| + throws Exception {
|
| + test(
|
| + "cr.defineProperty(a.b, 'c', cr.PropertyKind.INEXISTENT_KIND);",
|
| + null, ChromePass.CR_DEFINE_PROPERTY_INVALID_PROPERTY_KIND);
|
| + }
|
| +
|
| }
|
|
|