Author: pbr
Date: 2007-10-30 06:46:08 -0700 (Tue, 30 Oct 2007)
New Revision: 7047

Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/views/LzText.lzs
   openlaszlo/trunk/test/lztest/lztest-text.lzx
Log:
Change 20071029-Philip-8 by [EMAIL PROTECTED] on 2007-10-29 20:31:58 EDT
     in /cygdrive/f/laszlo/svn/src/svn/openlaszlo/trunk
     for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Make LzText.setMaxLength() consistent across runtimes

New Features:

Bugs Fixed: LPP-4775

Technical Reviewer: Andr?\195?\169 Bargull
QA Reviewer: jcrowley
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details:
http://www.openlaszlo.org/jira/browse/LPP-2208
fixed setMaxLength in all but one case.

LzText.lzs: If you call setMaxLength() after you set the text for LzText or 
LzInputText, the string isn't clipped to the specified length. I modified 
setMaxLength() to call setText to handle the clipping (and sending the 
necessary events if the text is changed).

lztest-text.lzx: Added a test to verify that the text is truncated after 
setMaxLength is called.


Tests:
http://localhost:8080/trunk/test/lztest/lztest-text.lzx 
in swf/dhtml. No setMaxLength() errors should be reported.

See LPP-4775 for an additional test. The unit test covers this case.

I tested with FF and IE7 swf/dhtml.

Files:
M      test/lztest/lztest-text.lzx
M      WEB-INF/lps/lfc/views/LzText.lzs

Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20071029-Philip-8.tar



Modified: openlaszlo/trunk/WEB-INF/lps/lfc/views/LzText.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/views/LzText.lzs   2007-10-30 03:35:02 UTC 
(rev 7046)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/views/LzText.lzs   2007-10-30 13:46:08 UTC 
(rev 7047)
@@ -437,6 +437,10 @@
     this.sprite.setMaxLength(val);
     this.maxlength = val;
     if (this.onmaxlength.ready) this.onmaxlength.sendEvent(val);
+
+    if(this.text && this.text.length > this.maxlength){
+        this.setText (this.text, true);
+    }
 }
 
 /**

Modified: openlaszlo/trunk/test/lztest/lztest-text.lzx
===================================================================
--- openlaszlo/trunk/test/lztest/lztest-text.lzx        2007-10-30 03:35:02 UTC 
(rev 7046)
+++ openlaszlo/trunk/test/lztest/lztest-text.lzx        2007-10-30 13:46:08 UTC 
(rev 7047)
@@ -124,6 +124,11 @@
   text1.setText('12345678901234567890');
   LzTestManager.assertEquals ("1234567890", text1.getText(), "LPP-2208: text1 
maxlength not working");  
 
+  // Now change the maxLength and try again
+  text1.setMaxLength (8);
+  LzTestManager.assertEquals (8, text1.maxlength, "text1.maxlength failure");
+  LzTestManager.assertEquals ("12345678", text1.getText(), "LPP-4775: text1 
maxlength not working");  
+
   // Use invalid characters (not in the pattern)
   text1.setText('1abc23def4');
   LzTestManager.assertEquals ("abcdef", text1.getText(), "LPP-2209: text1 
pattern not working");  


_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins

Reply via email to