Skip to content
This repository was archived by the owner on Apr 7, 2022. It is now read-only.

Commit c8549cb

Browse files
committed
[1747033] assertCheckbox[Not]Present now works if HTML type attribute value is not lowercase (e.g.: type="CHECKBOX").
1 parent 4a9c257 commit c8549cb

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

jwebunit-commons-tests/src/main/resources/testcases/FormSubmissionTest/SingleNamedButtonForm.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<form method="get" action="../params.jsp">
55
<input type="text" name="color" />
66
<input type="hidden" name="checkBox"/>
7-
<input type="checkbox" name="checkBox" />
7+
<input type="CHECKBOX" name="checkBox" />
88
<input type="submit" name="button" value="click me">
99
<input type="hidden" name="myReferer" value="FormSubmissionTest/SingleNamedButtonForm.html">
1010
</form>

jwebunit-core/src/main/java/net/sourceforge/jwebunit/junit/WebTester.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ public void assertCheckboxPresent(String checkboxName) {
731731
assertFormPresent();
732732
Assert.assertTrue("Did not find form checkbox with name ["
733733
+ checkboxName + "].", getTestingEngine().hasElementByXPath(
734-
"//input[@type='checkbox' and @name='" + checkboxName + "']"));
734+
"//input[lower-case(@type)='checkbox' and @name='" + checkboxName + "']"));
735735
}
736736

737737
/**
@@ -745,7 +745,7 @@ public void assertCheckboxPresent(String checkboxName, String checkboxValue) {
745745
Assert.assertTrue("Did not find form checkbox with name ["
746746
+ checkboxName + "] and value [" + checkboxValue + "].",
747747
getTestingEngine().hasElementByXPath(
748-
"//input[@type='checkbox' and @name='" + checkboxName
748+
"//input[lower-case(@type)='checkbox' and @name='" + checkboxName
749749
+ "' and @value='" + checkboxValue + "']"));
750750
}
751751

@@ -758,7 +758,7 @@ public void assertCheckboxNotPresent(String checkboxName) {
758758
assertFormPresent();
759759
Assert.assertFalse("Found form checkbox with name [" + checkboxName
760760
+ "] when not expected.", getTestingEngine().hasElementByXPath(
761-
"//input[@type='checkbox' and @name='" + checkboxName + "']"));
761+
"//input[lower-case(@type)='checkbox' and @name='" + checkboxName + "']"));
762762
}
763763

764764
/**
@@ -773,7 +773,7 @@ public void assertCheckboxNotPresent(String checkboxName,
773773
Assert.assertFalse("Found form checkbox with name [" + checkboxName
774774
+ "] and value [" + checkboxValue + "] when not expected.",
775775
getTestingEngine().hasElementByXPath(
776-
"//input[@type='checkbox' and @name='" + checkboxName
776+
"//input[lower-case(@type)='checkbox' and @name='" + checkboxName
777777
+ "' and @value='" + checkboxValue + "']"));
778778
}
779779

src/changes/changes.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
</author>
88
</properties>
99
<body>
10-
<release version="1.5" date="UNKNOW">
10+
<release version="1.5" date="UNKNOW" description="The latest major release before Java 1.5 migration">
11+
<action type="fix" dev="henryju" issue="1747033" due-to="Carlo Possati">
12+
assertCheckbox[Not]Present now works if HTML type attribute value is not lowercase (e.g.: type="CHECKBOX").
13+
</action>
1114
<action type="update" dev="henryju">
1215
Update to HtmlUnit 1.14.
1316
</action>

0 commit comments

Comments
 (0)