From b3a4b60f1dfd9fd6f0b6f3ac01ad1a586bb77b5e Mon Sep 17 00:00:00 2001 From: Neil McErlean Date: Mon, 6 Apr 2009 12:12:36 +0000 Subject: [PATCH] Added date testing in JS tests. taken from 3.1 branch git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13849 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../org/alfresco/repo/forms/script/test_formService.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/source/java/org/alfresco/repo/forms/script/test_formService.js b/source/java/org/alfresco/repo/forms/script/test_formService.js index f5af87ca9d..99044bcb2d 100644 --- a/source/java/org/alfresco/repo/forms/script/test_formService.js +++ b/source/java/org/alfresco/repo/forms/script/test_formService.js @@ -115,11 +115,10 @@ function testGetFormForContentNode() test.assertEquals("harry@example.com", addresseesArr[0]); test.assertEquals("jane@example.com", addresseesArr[1]); - //TODO Fix up the date-testing here. - //Old comment: Might add the equivalent of the VALUE_SENT_DATE testing here. - // In the meantime I'll use JavaScript's own Date object to assert that it is a valid date. - // var sentDate = fieldData["prop:cm:sentdate"].value; - // test.assertFalse(isNaN(Date.parse(sentDate)), "sentDate was not a legal date."); + var sentDate = fieldData["prop:cm:sentdate"].getValue(); + test.assertTrue((typeof sentDate === "object"), "Expecting sentData to be an object"); + var month = sentDate.getMonth(); + test.assertTrue((month >= 0 && month < 12), "Expecting valid month"); var targets = fieldData["assoc:cm:references"].value;