Revision: 762
http://jwebunit.svn.sourceforge.net/jwebunit/?rev=762&view=rev
Author: jevonwright
Date: 2008-11-10 01:20:13 +0000 (Mon, 10 Nov 2008)
Log Message:
-----------
checking if a labeled field is empty will no longer fail if no "value"
attribute is specified
Modified Paths:
--------------
trunk/jwebunit-commons-tests/src/main/java/net/sourceforge/jwebunit/tests/FormAssertionsTest.java
trunk/jwebunit-commons-tests/src/main/resources/testcases/FormAssertionsTest/testPage.html
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/junit/WebTester.java
Modified:
trunk/jwebunit-commons-tests/src/main/java/net/sourceforge/jwebunit/tests/FormAssertionsTest.java
===================================================================
---
trunk/jwebunit-commons-tests/src/main/java/net/sourceforge/jwebunit/tests/FormAssertionsTest.java
2008-11-04 11:21:23 UTC (rev 761)
+++
trunk/jwebunit-commons-tests/src/main/java/net/sourceforge/jwebunit/tests/FormAssertionsTest.java
2008-11-10 01:20:13 UTC (rev 762)
@@ -325,5 +325,15 @@
assertEquals(getElementById("field1_id").getAttribute("value"), "four");
}
+
+ /**
+ * Even though the element has no value set (i.e. getAttribute("value") ==
null),
+ * it should still qualify as equal to an empty string.
+ */
+ public void testLabeledEmptyElement() {
+ beginAt("/testPage.html");
+ assertLabeledFieldEquals("label9", "");
+ }
+
}
Modified:
trunk/jwebunit-commons-tests/src/main/resources/testcases/FormAssertionsTest/testPage.html
===================================================================
---
trunk/jwebunit-commons-tests/src/main/resources/testcases/FormAssertionsTest/testPage.html
2008-11-04 11:21:23 UTC (rev 761)
+++
trunk/jwebunit-commons-tests/src/main/resources/testcases/FormAssertionsTest/testPage.html
2008-11-10 01:20:13 UTC (rev 762)
@@ -97,6 +97,10 @@
</label>
<label id="label8" for="input8">Label 8</label>
<input id="input8" type="text" value="eight" />
+ <label id="label9">
+ Field 9:
+ <input name="label9_field1" /><!-- no "value" attribute
-->
+ </label>
</td>
</tr>
</table>
Modified:
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/junit/WebTester.java
===================================================================
---
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/junit/WebTester.java
2008-11-04 11:21:23 UTC (rev 761)
+++
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/junit/WebTester.java
2008-11-10 01:20:13 UTC (rev 762)
@@ -2693,7 +2693,7 @@
}
}
- Assert.assertEquals("value of field for label [" + identifier + "]
should be [" + fieldText + "]", fieldText, value);
+ Assert.assertEquals("value of field for label [" + identifier + "]
should be [" + fieldText + "]", fieldText, value == null ? "" : value);
}
/**
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
JWebUnit-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-development