You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2016/07/01 14:56:09 UTC
svn commit: r1750949 [1/2] - in
/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src: main/webapp/
main/webapp/WEB-INF/ main/webapp/content/20-component/010-input/10-in/
main/webapp/content/20-component/010-input/20-suggest/ main/webapp/content...
Author: lofwyr
Date: Fri Jul 1 14:56:09 2016
New Revision: 1750949
URL: http://svn.apache.org/viewvc?rev=1750949&view=rev
Log:
TOBAGO-1473: Remove selenium legacy dependency
* Progress with tests
[developed by hnoeth]
Added:
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/10-selectBooleanCheckbox/selectBooleanCheckbox.test.js
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/20-selectOneChoice/selectOneChoice.test.js
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/30-selectOneRadio/selectOneRadio.test.js
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/40-selectOneListbox/selectOneListbox.test.js
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/50-selectManyCheckbox/selectManyCheckbox.test.js
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/08-form/10-required/form-required.test.js
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/08-form/20-ajax/form-ajax.test.js
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/08-form/form.test.js
Removed:
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/20-suggest/suggest.test.js
Modified:
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/10-in/in.test.js
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/10-in/in.xhtml
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/40-date/date.test.js
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/40-date/date.xhtml
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/10-selectBooleanCheckbox/selectBooleanCheckbox.xhtml
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/20-selectOneChoice/selectOneChoice.xhtml
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/30-selectOneRadio/selectOneRadio.xhtml
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/40-selectOneListbox/selectOneListbox.xhtml
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/50-selectManyCheckbox/selectManyCheckbox.xhtml
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/08-form/10-required/form-required.xhtml
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/08-form/20-ajax/form-ajax.xhtml
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/08-form/form.xhtml
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/1040-date/date.test.js
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/1040-date/date.xhtml
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/50000-java/10-rendererBase-getCurrentValue/rendererBase-getCurrentValue.test.js
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/50000-java/20-ajax-execute/ajax-execute.test.js
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/main.xhtml
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/test/java/org/apache/myfaces/tobago/example/demo/QUnitTests.java
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml?rev=1750949&r1=1750948&r2=1750949&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml Fri Jul 1 14:56:09 2016
@@ -45,7 +45,7 @@
<prevent-frame-attacks>false</prevent-frame-attacks>
<!-- XXX for the jQuery tests we need 'report-only' here -->
- <content-security-policy mode="report-only">
+ <content-security-policy mode="off">
<!-- XXX With CSP Tobago 3.0.x is currently not working 100% see TOBAGO-1534,
XXX because of JSF-AJAX we need 'unsafe-eval' -->
<directive>script-src 'self' 'unsafe-eval'</directive>
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/10-in/in.test.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/10-in/in.test.js?rev=1750949&r1=1750948&r2=1750949&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/10-in/in.test.js (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/10-in/in.test.js Fri Jul 1 14:56:09 2016
@@ -20,8 +20,8 @@ function jQueryFrame(expression) {
}
QUnit.test("inputfield with label", function (assert) {
- var $label = jQueryFrame("#page\\:inormal > label");
- var $inputField = jQueryFrame("#page\\:inormal\\:\\:field");
+ var $label = jQueryFrame("#page\\:mainForm\\:iNormal > label");
+ var $inputField = jQueryFrame("#page\\:mainForm\\:iNormal\\:\\:field");
assert.equal($label.text(), "Input");
assert.equal($inputField.val(), "Some Text");
@@ -31,8 +31,11 @@ QUnit.test("inputfield with label", func
});
QUnit.test("ajax change event", function (assert) {
- var $inputField = jQueryFrame("#page\\:iajax\\:\\:field");
- var $outputField = jQueryFrame("#page\\:oajax > span:first");
+ assert.expect(4);
+ var done = assert.async();
+
+ var $inputField = jQueryFrame("#page\\:mainForm\\:inputAjax\\:\\:field");
+ var $outputField = jQueryFrame("#page\\:mainForm\\:outputAjax > span:first");
assert.equal($inputField.val(), "");
assert.equal($outputField.text(), "");
@@ -40,9 +43,11 @@ QUnit.test("ajax change event", function
$inputField.val("qwe").trigger("change");
assert.equal($inputField.val(), "qwe");
- var done = assert.async();
- setTimeout(function () {
- assert.equal(jQueryFrame("#page\\:oajax > span:first").text(), "qwe");
+ $.ajax({
+ type: 'GET',
+ url: 'content/20-component/010-input/10-in/in.xhtml'
+ }).done(function () {
+ assert.equal(jQueryFrame("#page\\:mainForm\\:outputAjax > span:first").text(), "qwe");
done();
- }, 500);
+ });
});
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/10-in/in.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/10-in/in.xhtml?rev=1750949&r1=1750948&r2=1750949&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/10-in/in.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/10-in/in.xhtml Fri Jul 1 14:56:09 2016
@@ -29,7 +29,7 @@
<p>In most cases, a label should be placed in front of every inputfield. Use the attribute
<code>label</code>.</p>
<pre><code class="language-markup"><tc:in label="Input" value="Some Text"/></code></pre>
- <tc:in id="inormal" label="Input" value="Some Text"/>
+ <tc:in id="iNormal" label="Input" value="Some Text"/>
<tc:in id="ireadonly" label="Read Only" readonly="true" value="Some Text"/>
<tc:in id="i3" label="Disabled" disabled="true" value="Some Text"/>
<tc:in id="i4" value="Input without a label"/>
@@ -67,16 +67,16 @@
<tc:section label="Ajax">
<p>The outputfield in this example, displays the given value on the server.
- With <code class="language-markup"><f:ajax render="outputfield" listener="\#{inController.update}"/></code>,
+ With <code class="language-markup"><f:ajax render="outputAjax" listener="\#{inController.update}"/></code>,
the outputfield will be rerendered, after the value has been changed.
- This is because <code>outputfield</code> is the id of the <code><tc:out/></code> tag.
+ This is because <code>outputAjax</code> is the id of the <code><tc:out/></code> tag.
and the default event for <code class="language-markup"><tc:in/></code> is <code>change</code>.
Additional, the <code>listener</code> attribute is set. The given method is called after the inputfield
loose focus.</p>
- <tc:in id="iajax" label="On Change" value="#{inController.changeValue}">
- <f:ajax render="oajax" listener="#{inController.update}"/>
+ <tc:in id="inputAjax" label="On Change" value="#{inController.changeValue}">
+ <f:ajax render="outputAjax" listener="#{inController.update}"/>
</tc:in>
- <tc:out id="oajax" label="On Server" value="#{inController.changeValue}"/>
+ <tc:out id="outputAjax" label="On Server" value="#{inController.changeValue}"/>
</tc:section>
</ui:composition>
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/40-date/date.test.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/40-date/date.test.js?rev=1750949&r1=1750948&r2=1750949&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/40-date/date.test.js (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/40-date/date.test.js Fri Jul 1 14:56:09 2016
@@ -1,5 +1,18 @@
-/**
- * Created by henning on 15.06.16.
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
function jQueryFrame(expression) {
@@ -21,9 +34,9 @@ function getToday() {
}
QUnit.test("date with label", function (assert) {
- var $label = jQueryFrame("#page\\:dnormal > label");
- var $dateField = jQueryFrame("#page\\:dnormal\\:\\:field");
- var $dateButton = jQueryFrame("#page\\:dnormal button");
+ var $label = jQueryFrame("#page\\:mainForm\\:dNormal > label");
+ var $dateField = jQueryFrame("#page\\:mainForm\\:dNormal\\:\\:field");
+ var $dateButton = jQueryFrame("#page\\:mainForm\\:dNormal button");
var today = getToday();
assert.equal($label.text(), "Date");
@@ -36,10 +49,13 @@ QUnit.test("date with label", function (
});
QUnit.test("submit", function (assert) {
- var $dateField = jQueryFrame("#page\\:fsbmt\\:sbmtinput\\:\\:field");
- var $dateButton = jQueryFrame("#page\\:fsbmt\\:sbmtinput button");
- var $outField = jQueryFrame("#page\\:fsbmt\\:sbmtoutput span");
- var $submitButton = jQueryFrame("#page\\:fsbmt\\:sbmtbutton");
+ assert.expect(5);
+ var done = assert.async();
+
+ var $dateField = jQueryFrame("#page\\:mainForm\\:formSubmit\\:input\\:\\:field");
+ var $dateButton = jQueryFrame("#page\\:mainForm\\:formSubmit\\:input button");
+ var $outField = jQueryFrame("#page\\:mainForm\\:formSubmit\\:output span");
+ var $submitButton = jQueryFrame("#page\\:mainForm\\:formSubmit\\:button");
assert.equal($dateField.val(), "22.05.2016");
assert.equal($outField.text(), "22.05.2016");
@@ -51,18 +67,20 @@ QUnit.test("submit", function (assert) {
assert.equal($dateField.val(), "01.06.2016");
$submitButton.click();
- var done = assert.async();
- setTimeout(function () {
- $outField = jQueryFrame("#page\\:fsbmt\\:sbmtoutput span");
+ jQuery("#page\\:testframe").load(function () {
+ $outField = jQueryFrame("#page\\:mainForm\\:formSubmit\\:output span");
assert.equal($outField.text(), "01.06.2016");
done();
- }, 500);
+ });
});
QUnit.test("ajax", function (assert) {
- var $dateField = jQueryFrame("#page\\:ajaxinput\\:\\:field");
- var $dateButton = jQueryFrame("#page\\:ajaxinput button");
- var $outField = jQueryFrame("#page\\:outputfield span");
+ assert.expect(5);
+ var done = assert.async();
+
+ var $dateField = jQueryFrame("#page\\:mainForm\\:ajaxinput\\:\\:field");
+ var $dateButton = jQueryFrame("#page\\:mainForm\\:ajaxinput button");
+ var $outField = jQueryFrame("#page\\:mainForm\\:outputfield span");
var today = getToday();
assert.equal($dateField.val(), "");
@@ -73,10 +91,12 @@ QUnit.test("ajax", function (assert) {
assert.ok(jQueryFrame(".bootstrap-datetimepicker-widget").get(0));
assert.equal($dateField.val(), today);
- var done = assert.async();
- setTimeout(function () {
- $outField = jQueryFrame("#page\\:outputfield span");
+ $.ajax({
+ type: 'GET',
+ url: 'content/20-component/010-input/40-date/date.xhtml'
+ }).done(function () {
+ $outField = jQueryFrame("#page\\:mainForm\\:outputfield span");
assert.equal($outField.text(), today);
done();
- }, 500);
+ });
});
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/40-date/date.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/40-date/date.xhtml?rev=1750949&r1=1750948&r2=1750949&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/40-date/date.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/40-date/date.xhtml Fri Jul 1 14:56:09 2016
@@ -42,10 +42,10 @@
<pre><code class="language-markup"><tc:date label="Date" value=\#{dateController.now}">
<f:convertDateTime pattern="dd.MM.yyyy"/>
</tc:date></code></pre>
- <tc:date id="dnormal" label="Date" value="#{dateController.now}">
+ <tc:date id="dNormal" label="Date" value="#{dateController.now}">
<f:convertDateTime pattern="dd.MM.yyyy"/>
</tc:date>
- <tc:date id="dreadonly" label="Read Only" readonly="true" value="#{dateController.now}">
+ <tc:date id="dReadonly" label="Read Only" readonly="true" value="#{dateController.now}">
<f:convertDateTime pattern="dd.MM.yyyy"/>
</tc:date>
<tc:date id="d3" label="Disabled" disabled="true" value="#{dateController.now}">
@@ -168,16 +168,16 @@
</tc:date>
</tc:section>
<tc:section label="Submit">
- <tc:form id="fsbmt">
+ <tc:form id="formSubmit">
<p>Press the button to submit the date to the server. The output field show the current value.
The date can be changed with the datepicker or by entering a valid date in the textfield.</p>
- <tc:date id="sbmtinput" label="Input" value="#{dateController.submitDate}">
+ <tc:date id="input" label="Input" value="#{dateController.submitDate}">
<f:convertDateTime pattern="dd.MM.yyyy"/>
</tc:date>
- <tc:out id="sbmtoutput" label="Output" value="#{dateController.submitDate}">
+ <tc:out id="output" label="Output" value="#{dateController.submitDate}">
<f:convertDateTime pattern="dd.MM.yyyy"/>
</tc:out>
- <tc:button id="sbmtbutton" label="Submit"/>
+ <tc:button id="button" label="Submit"/>
</tc:form>
</tc:section>
<tc:section label="Ajax">
Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/10-selectBooleanCheckbox/selectBooleanCheckbox.test.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/10-selectBooleanCheckbox/selectBooleanCheckbox.test.js?rev=1750949&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/10-selectBooleanCheckbox/selectBooleanCheckbox.test.js (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/10-selectBooleanCheckbox/selectBooleanCheckbox.test.js Fri Jul 1 14:56:09 2016
@@ -0,0 +1,156 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+function jQueryFrame(expression) {
+ return document.getElementById("page:testframe").contentWindow.jQuery(expression);
+}
+
+QUnit.test("submit: select A", function (assert) {
+ assert.expect(1);
+ var done = assert.async();
+ var $selectA = jQueryFrame("#page\\:mainForm\\:selectA input");
+ var $selectB = jQueryFrame("#page\\:mainForm\\:selectB input");
+ var $selectC = jQueryFrame("#page\\:mainForm\\:selectC input");
+ var $submit = jQueryFrame("#page\\:mainForm\\:submit");
+
+ $selectA.attr("checked", "checked");
+ $selectB.removeAttr("checked");
+ $selectC.removeAttr("checked");
+ $submit.click();
+
+ jQuery("#page\\:testframe").load(function () {
+ var $output = jQueryFrame("#page\\:mainForm\\:submitOutput span");
+ assert.equal($output.text(), "A ");
+ done();
+ });
+});
+
+QUnit.test("submit: select B and C", function (assert) {
+ assert.expect(1);
+ var done = assert.async();
+ var $selectA = jQueryFrame("#page\\:mainForm\\:selectA input");
+ var $selectB = jQueryFrame("#page\\:mainForm\\:selectB input");
+ var $selectC = jQueryFrame("#page\\:mainForm\\:selectC input");
+ var $submit = jQueryFrame("#page\\:mainForm\\:submit");
+
+ $selectA.removeAttr("checked");
+ $selectB.attr("checked", "checked");
+ $selectC.attr("checked", "checked");
+ $submit.click();
+
+ jQuery("#page\\:testframe").load(function () {
+ var $output = jQueryFrame("#page\\:mainForm\\:submitOutput span");
+ assert.equal($output.text(), "B C ");
+ done();
+ });
+});
+
+QUnit.test("ajax: select D", function (assert) {
+ assert.expect(1);
+ var done = assert.async();
+ var $selectD = jQueryFrame("#page\\:mainForm\\:selectD input");
+ $selectD.attr("checked", "checked").trigger("change");
+
+ $.ajax({
+ type: 'GET',
+ url: 'content/20-component/030-select/10-selectBooleanCheckbox/selectBooleanCheckbox.xhtml'
+ }).done(function () {
+ var $outputD = jQueryFrame("#page\\:mainForm\\:outputD span");
+ assert.equal($outputD.text(), "true");
+ done();
+ });
+});
+
+QUnit.test("ajax: deselect D", function (assert) {
+ assert.expect(1);
+ var done = assert.async();
+ var $selectD = jQueryFrame("#page\\:mainForm\\:selectD input");
+ $selectD.removeAttr("checked").trigger("change");
+
+ $.ajax({
+ type: 'GET',
+ url: 'content/20-component/030-select/10-selectBooleanCheckbox/selectBooleanCheckbox.xhtml'
+ }).done(function () {
+ var $outputD = jQueryFrame("#page\\:mainForm\\:outputD span");
+ assert.equal($outputD.text(), "false");
+ done();
+ });
+});
+
+QUnit.test("ajax: select E", function (assert) {
+ assert.expect(1);
+ var done = assert.async();
+ var $selectE = jQueryFrame("#page\\:mainForm\\:selectE input");
+ $selectE.attr("checked", "checked").trigger("change");
+
+ $.ajax({
+ type: 'GET',
+ url: 'content/20-component/030-select/10-selectBooleanCheckbox/selectBooleanCheckbox.xhtml'
+ }).done(function () {
+ var $outputE = jQueryFrame("#page\\:mainForm\\:outputE span");
+ assert.equal($outputE.text(), "true");
+ done();
+ });
+});
+
+QUnit.test("ajax: deselect E", function (assert) {
+ assert.expect(1);
+ var done = assert.async();
+ var $selectE = jQueryFrame("#page\\:mainForm\\:selectE input");
+ $selectE.removeAttr("checked").trigger("change");
+
+ $.ajax({
+ type: 'GET',
+ url: 'content/20-component/030-select/10-selectBooleanCheckbox/selectBooleanCheckbox.xhtml'
+ }).done(function () {
+ var $outputE = jQueryFrame("#page\\:mainForm\\:outputE span");
+ assert.equal($outputE.text(), "false");
+ done();
+ });
+});
+
+QUnit.test("ajax: select F", function (assert) {
+ assert.expect(1);
+ var done = assert.async();
+ var $selectF = jQueryFrame("#page\\:mainForm\\:selectF input");
+ $selectF.attr("checked", "checked").trigger("change");
+
+ $.ajax({
+ type: 'GET',
+ url: 'content/20-component/030-select/10-selectBooleanCheckbox/selectBooleanCheckbox.xhtml'
+ }).done(function () {
+ var $outputF = jQueryFrame("#page\\:mainForm\\:outputF span");
+ assert.equal($outputF.text(), "true");
+ done();
+ });
+});
+
+QUnit.test("ajax: deselect F", function (assert) {
+ assert.expect(1);
+ var done = assert.async();
+ var $selectF = jQueryFrame("#page\\:mainForm\\:selectF input");
+ $selectF.removeAttr("checked").trigger("change");
+
+ $.ajax({
+ type: 'GET',
+ url: 'content/20-component/030-select/10-selectBooleanCheckbox/selectBooleanCheckbox.xhtml'
+ }).done(function () {
+ var $outputF = jQueryFrame("#page\\:mainForm\\:outputF span");
+ assert.equal($outputF.text(), "false");
+ done();
+ });
+});
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/10-selectBooleanCheckbox/selectBooleanCheckbox.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/10-selectBooleanCheckbox/selectBooleanCheckbox.xhtml?rev=1750949&r1=1750948&r2=1750949&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/10-selectBooleanCheckbox/selectBooleanCheckbox.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/10-selectBooleanCheckbox/selectBooleanCheckbox.xhtml Fri Jul 1 14:56:09 2016
@@ -38,11 +38,11 @@
<p>In this example, the selected items are displayed in an outputfield after the submit-button is pressed.</p>
<pre><code class="language-markup"><tc:selectBooleanCheckbox label="A" value="\#{selectBooleanCheckboxController.a}"/>
<tc:out label="Selected items: " value="\#{selectBooleanCheckboxController.selectedItems}"/></code></pre>
- <tc:selectBooleanCheckbox id="s4" label="A" value="#{selectBooleanCheckboxController.a}"/>
- <tc:selectBooleanCheckbox id="s5" label="B" value="#{selectBooleanCheckboxController.b}"/>
- <tc:selectBooleanCheckbox id="s6" label="C" value="#{selectBooleanCheckboxController.c}"/>
- <tc:out id="o1" label="Selected items: " value="#{selectBooleanCheckboxController.selectedItems}"/>
- <tc:button id="b1" label="Submit"/>
+ <tc:selectBooleanCheckbox id="selectA" label="A" value="#{selectBooleanCheckboxController.a}"/>
+ <tc:selectBooleanCheckbox id="selectB" label="B" value="#{selectBooleanCheckboxController.b}"/>
+ <tc:selectBooleanCheckbox id="selectC" label="C" value="#{selectBooleanCheckboxController.c}"/>
+ <tc:out id="submitOutput" label="Selected items: " value="#{selectBooleanCheckboxController.selectedItems}"/>
+ <tc:button id="submit" label="Submit"/>
</tc:section>
<tc:section label="Ajax">
@@ -52,15 +52,15 @@
<code class="language-markup"><tc:selectBooleanCheckbox label="Character" value="#{selectBooleanCheckboxController.d}"/></code>.
The ID of the outputfield and the value in the <code>render</code> attribute of the ajax tag
has to be the same.</p>
- <tc:selectBooleanCheckbox id="s7" label="D" value="#{selectBooleanCheckboxController.d}">
+ <tc:selectBooleanCheckbox id="selectD" label="D" value="#{selectBooleanCheckboxController.d}">
<f:ajax render="outputD"/>
</tc:selectBooleanCheckbox>
<tc:out id="outputD" label="Value is" value="#{selectBooleanCheckboxController.d}"/>
- <tc:selectBooleanCheckbox id="s8" label="E" value="#{selectBooleanCheckboxController.e}">
+ <tc:selectBooleanCheckbox id="selectE" label="E" value="#{selectBooleanCheckboxController.e}">
<f:ajax render="outputE"/>
</tc:selectBooleanCheckbox>
<tc:out id="outputE" label="Value is" value="#{selectBooleanCheckboxController.e}"/>
- <tc:selectBooleanCheckbox id="s9" label="F" value="#{selectBooleanCheckboxController.f}">
+ <tc:selectBooleanCheckbox id="selectF" label="F" value="#{selectBooleanCheckboxController.f}">
<f:ajax render="outputF"/>
</tc:selectBooleanCheckbox>
<tc:out id="outputF" label="Value is" value="#{selectBooleanCheckboxController.f}"/>
Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/20-selectOneChoice/selectOneChoice.test.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/20-selectOneChoice/selectOneChoice.test.js?rev=1750949&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/20-selectOneChoice/selectOneChoice.test.js (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/20-selectOneChoice/selectOneChoice.test.js Fri Jul 1 14:56:09 2016
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+function jQueryFrame(expression) {
+ return document.getElementById("page:testframe").contentWindow.jQuery(expression);
+}
+
+QUnit.test("submit: Alice", function (assert) {
+ assert.expect(1);
+ var done = assert.async();
+ var $alice = jQueryFrame("#page\\:mainForm\\:selectPerson\\:\\:field option:contains('Alice')");
+ var $bob = jQueryFrame("#page\\:mainForm\\:selectPerson\\:\\:field option:contains('Bob')");
+ var $submit = jQueryFrame("#page\\:mainForm\\:submit");
+
+ $alice.attr("selected", "selected");
+ $bob.removeAttr("selected");
+ $submit.click();
+
+ jQuery("#page\\:testframe").load(function () {
+ var $output = jQueryFrame("#page\\:mainForm\\:outputPerson span");
+ assert.equal($output.text(), "Alice Anderson");
+ done();
+ });
+});
+
+QUnit.test("submit: Bob", function (assert) {
+ assert.expect(1);
+ var done = assert.async();
+ var $alice = jQueryFrame("#page\\:mainForm\\:selectPerson\\:\\:field option:contains('Alice')");
+ var $bob = jQueryFrame("#page\\:mainForm\\:selectPerson\\:\\:field option:contains('Bob')");
+ var $submit = jQueryFrame("#page\\:mainForm\\:submit");
+
+ $alice.removeAttr("selected");
+ $bob.attr("selected", "selected");
+ $submit.click();
+
+ jQuery("#page\\:testframe").load(function () {
+ var $output = jQueryFrame("#page\\:mainForm\\:outputPerson span");
+ assert.equal($output.text(), "Bob Brunch");
+ done();
+ });
+});
+
+QUnit.test("ajax: select Mars", function (assert) {
+ assert.expect(2);
+ var done = assert.async();
+ var $mars = jQueryFrame("#page\\:mainForm\\:selectPlanet\\:\\:field option:contains('Mars')");
+ var $jupiter = jQueryFrame("#page\\:mainForm\\:selectPlanet\\:\\:field option:contains('Jupiter')");
+
+ $jupiter.removeAttr("selected");
+ $mars.attr("selected", "selected").trigger("change");
+
+ $.ajax({
+ type: 'GET',
+ url: 'content/20-component/030-select/20-selectOneChoice/selectOneChoice.xhtml'
+ }).done(function () {
+ var $moons = jQueryFrame("#page\\:mainForm\\:moonbox\\:\\:field option");
+ assert.equal($moons.eq(0).text(), "Phobos");
+ assert.equal($moons.eq(1).text(), "Deimos");
+ done();
+ });
+});
+
+QUnit.test("ajax: select Jupiter", function (assert) {
+ assert.expect(4);
+ var done = assert.async();
+ var $mars = jQueryFrame("#page\\:mainForm\\:selectPlanet\\:\\:field option:contains('Mars')");
+ var $jupiter = jQueryFrame("#page\\:mainForm\\:selectPlanet\\:\\:field option:contains('Jupiter')");
+
+ $mars.removeAttr("selected");
+ $jupiter.attr("selected", "selected").trigger("change");
+
+ $.ajax({
+ type: 'GET',
+ url: 'content/20-component/030-select/20-selectOneChoice/selectOneChoice.xhtml'
+ }).done(function () {
+ var $moons = jQueryFrame("#page\\:mainForm\\:moonbox\\:\\:field option");
+ assert.equal($moons.eq(0).text(), "Europa");
+ assert.equal($moons.eq(1).text(), "Ganymed");
+ assert.equal($moons.eq(2).text(), "Io");
+ assert.equal($moons.eq(3).text(), "Kallisto");
+ done();
+ });
+});
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/20-selectOneChoice/selectOneChoice.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/20-selectOneChoice/selectOneChoice.xhtml?rev=1750949&r1=1750948&r2=1750949&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/20-selectOneChoice/selectOneChoice.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/20-selectOneChoice/selectOneChoice.xhtml Fri Jul 1 14:56:09 2016
@@ -25,7 +25,7 @@
<ui:param name="title" value="#{overviewBundle.selectOneChoice} <tc:selectOneChoice>"/>
<p>The tag <code class="language-markup"><tc:selectOneChoice/></code> create a dropdownbox,
which contain<br/>
- <code class="language-markup"><tc:selectItem/></code> for static entries or<br/>
+ <code class="language-markup"><tc:selectItem/></code> for static entries or<br/>
<code class="language-markup"><tc:selectItems value="\#{controller.list}"/></code> for entries from
a controller.</p>
<p>Tag Library Documentation:
@@ -61,12 +61,12 @@
After submitting, the value of the item is shown in the outputfield.
So, if 'Alice' is selected, the text in the outputfield is 'Alice Anderson'.</p>
<pre><code class="language-markup"><tc:selectItem itemLabel="Alice" itemValue="Alice Anderson"/></code></pre>
- <tc:selectOneChoice id="s4" label="Person" value="#{selectOneChoiceController.person}">
+ <tc:selectOneChoice id="selectPerson" label="Person" value="#{selectOneChoiceController.person}">
<tc:selectItem itemLabel="Alice" itemValue="Alice Anderson"/>
<tc:selectItem itemLabel="Bob" itemValue="Bob Brunch"/>
</tc:selectOneChoice>
- <tc:out id="o1" label="Selected Person" value="#{selectOneChoiceController.person}"/>
- <tc:button id="b1" label="Submit"/>
+ <tc:out id="outputPerson" label="Selected Person" value="#{selectOneChoiceController.person}"/>
+ <tc:button id="submit" label="Submit"/>
</tc:section>
<tc:section label="Ajax">
@@ -81,7 +81,7 @@
<tc:selectOneChoice id="moonbox" label="Moon">
<f:selectItems value="\#{selectOneChoiceController.moons}"/>
</tc:selectOneChoice></code></pre>
- <tc:selectOneChoice id="s5" label="Planet" value="#{selectOneChoiceController.planet}">
+ <tc:selectOneChoice id="selectPlanet" label="Planet" value="#{selectOneChoiceController.planet}">
<f:selectItems value="#{selectOneChoiceController.planets}"/>
<f:ajax render="moonbox"/>
</tc:selectOneChoice>
Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/30-selectOneRadio/selectOneRadio.test.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/30-selectOneRadio/selectOneRadio.test.js?rev=1750949&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/30-selectOneRadio/selectOneRadio.test.js (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/30-selectOneRadio/selectOneRadio.test.js Fri Jul 1 14:56:09 2016
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+function jQueryFrame(expression) {
+ return document.getElementById("page:testframe").contentWindow.jQuery(expression);
+}
+
+QUnit.test("submit: Addition (2 + 4)", function (assert) {
+ assert.expect(1);
+ var done = assert.async();
+ var $number1 = jQueryFrame("#page\\:mainForm\\:selectNum1 input");
+ var $number2 = jQueryFrame("#page\\:mainForm\\:selectNum2 input");
+ var $submitAdd = jQueryFrame("#page\\:mainForm\\:submitAdd");
+
+ $number1.eq(0).removeAttr("checked");
+ $number1.eq(1).attr("checked", "checked"); // Select 2
+ $number1.eq(2).removeAttr("checked");
+ $number2.eq(0).removeAttr("checked");
+ $number2.eq(1).removeAttr("checked");
+ $number2.eq(2).attr("checked", "checked"); // Select 4
+ $submitAdd.click();
+
+ jQuery("#page\\:testframe").load(function () {
+ var $output = jQueryFrame("#page\\:mainForm\\:resultOutput span");
+ assert.equal($output.text(), "6");
+ done();
+ });
+});
+
+QUnit.test("submit: Subtraction (4 - 1)", function (assert) {
+ assert.expect(1);
+ var done = assert.async();
+ var $number1 = jQueryFrame("#page\\:mainForm\\:selectNum1 input");
+ var $number2 = jQueryFrame("#page\\:mainForm\\:selectNum2 input");
+ var $submitSub = jQueryFrame("#page\\:mainForm\\:submitSub");
+
+ $number1.eq(0).removeAttr("checked");
+ $number1.eq(1).removeAttr("checked");
+ $number1.eq(2).attr("checked", "checked"); // Select 4
+ $number2.eq(0).attr("checked", "checked"); // Select 1
+ $number2.eq(1).removeAttr("checked");
+ $number2.eq(2).removeAttr("checked");
+ $submitSub.click();
+
+ jQuery("#page\\:testframe").load(function () {
+ var $output = jQueryFrame("#page\\:mainForm\\:resultOutput span");
+ assert.equal($output.text(), "3");
+ done();
+ });
+});
+
+QUnit.test("ajax: select Mars", function (assert) {
+ assert.expect(2);
+ var done = assert.async();
+ var $planet = jQueryFrame("#page\\:mainForm\\:selectPlanet input");
+
+ $planet.eq(0).removeAttr("checked");
+ $planet.eq(2).removeAttr("checked");
+ $planet.eq(1).attr("checked", "checked").trigger("change"); // Mars.
+
+ $.ajax({
+ type: 'GET',
+ url: 'content/20-component/030-select/30-selectOneRadio/selectOneRadio.xhtml'
+ }).done(function () {
+ var $moons = jQueryFrame("#page\\:mainForm\\:moonradio li label");
+ assert.equal($moons.eq(0).text(), "Phobos");
+ assert.equal($moons.eq(1).text(), "Deimos");
+ done();
+ });
+});
+
+QUnit.test("ajax: select Jupiter", function (assert) {
+ assert.expect(4);
+ var done = assert.async();
+ var $planet = jQueryFrame("#page\\:mainForm\\:selectPlanet input");
+
+ $planet.eq(0).removeAttr("checked");
+ $planet.eq(1).removeAttr("checked");
+ $planet.eq(2).attr("checked", "checked").trigger("change"); // Jupiter.
+
+ $.ajax({
+ type: 'GET',
+ url: 'content/20-component/030-select/30-selectOneRadio/selectOneRadio.xhtml'
+ }).done(function () {
+ var $moons = jQueryFrame("#page\\:mainForm\\:moonradio li label");
+ assert.equal($moons.eq(0).text(), "Europa");
+ assert.equal($moons.eq(1).text(), "Ganymed");
+ assert.equal($moons.eq(2).text(), "Io");
+ assert.equal($moons.eq(3).text(), "Kallisto");
+ done();
+ });
+});
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/30-selectOneRadio/selectOneRadio.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/30-selectOneRadio/selectOneRadio.xhtml?rev=1750949&r1=1750948&r2=1750949&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/30-selectOneRadio/selectOneRadio.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/30-selectOneRadio/selectOneRadio.xhtml Fri Jul 1 14:56:09 2016
@@ -68,21 +68,23 @@
<code class="language-markup"><tc:button label="Addition" action="\#{selectOneRadioController.add}"/></code>
</p>
<tc:segmentLayout large="6;6">
- <tc:selectOneRadio id="s4" label="Number 1" labelLayout="top" value="#{selectOneRadioController.numberOne}">
+ <tc:selectOneRadio id="selectNum1" label="Number 1" labelLayout="top"
+ value="#{selectOneRadioController.numberOne}">
<tc:selectItem itemLabel="1" itemValue="1"/>
<tc:selectItem itemLabel="2" itemValue="2"/>
<tc:selectItem itemLabel="4" itemValue="4"/>
</tc:selectOneRadio>
- <tc:selectOneRadio id="s5" label="Number 2" labelLayout="top" value="#{selectOneRadioController.numberTwo}">
+ <tc:selectOneRadio id="selectNum2" label="Number 2" labelLayout="top"
+ value="#{selectOneRadioController.numberTwo}">
<tc:selectItem itemLabel="1" itemValue="1"/>
<tc:selectItem itemLabel="2" itemValue="2"/>
<tc:selectItem itemLabel="4" itemValue="4"/>
</tc:selectOneRadio>
</tc:segmentLayout>
- <tc:out id="o1" label="Result" value="#{selectOneRadioController.result}"/>
+ <tc:out id="resultOutput" label="Result" value="#{selectOneRadioController.result}"/>
<tc:flowLayout>
- <tc:button id="b1" label="Addition" action="#{selectOneRadioController.add}"/>
- <tc:button id="b2" label="Subtraction" action="#{selectOneRadioController.subtract}"/>
+ <tc:button id="submitAdd" label="Addition" action="#{selectOneRadioController.add}"/>
+ <tc:button id="submitSub" label="Subtraction" action="#{selectOneRadioController.subtract}"/>
</tc:flowLayout>
</tc:section>
@@ -95,7 +97,7 @@
which allows to rerender the radiogroup with the ID 'moonradio' every time, the value changed in the
planet-radiogroup.</p>
<tc:segmentLayout large="6;6">
- <tc:selectOneRadio id="s6" label="Planet" labelLayout="top" value="#{selectOneRadioController.planet}">
+ <tc:selectOneRadio id="selectPlanet" label="Planet" labelLayout="top" value="#{selectOneRadioController.planet}">
<f:selectItems value="#{selectOneRadioController.planets}"/>
<f:ajax render="moonradio"/>
</tc:selectOneRadio>
Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/40-selectOneListbox/selectOneListbox.test.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/40-selectOneListbox/selectOneListbox.test.js?rev=1750949&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/40-selectOneListbox/selectOneListbox.test.js (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/40-selectOneListbox/selectOneListbox.test.js Fri Jul 1 14:56:09 2016
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+function jQueryFrame(expression) {
+ return document.getElementById("page:testframe").contentWindow.jQuery(expression);
+}
+
+QUnit.test("submit: select 'Nile'", function (assert) {
+ assert.expect(1);
+ var done = assert.async();
+ var $rivers = jQueryFrame("#page\\:mainForm\\:riverList option");
+ var $submit = jQueryFrame("#page\\:mainForm\\:riverSubmit");
+
+ $rivers.eq(0).attr("selected", "selected"); // Nile
+ $rivers.eq(1).removeAttr("selected"); // Amazon
+ $rivers.eq(2).removeAttr("selected"); // Yangtze
+ $rivers.eq(3).removeAttr("selected"); // Yellow River
+ $rivers.eq(4).removeAttr("selected"); // ParanĂ¡ River
+ $submit.click();
+
+ jQuery("#page\\:testframe").load(function () {
+ var $output = jQueryFrame("#page\\:mainForm\\:riverOutput span");
+ assert.equal($output.text(), "6853 km");
+ done();
+ });
+});
+
+QUnit.test("submit: select 'Yangtze'", function (assert) {
+ assert.expect(1);
+ var done = assert.async();
+ var $rivers = jQueryFrame("#page\\:mainForm\\:riverList option");
+ var $submit = jQueryFrame("#page\\:mainForm\\:riverSubmit");
+
+ $rivers.eq(0).removeAttr("selected"); // Nile
+ $rivers.eq(1).removeAttr("selected"); // Amazon
+ $rivers.eq(2).attr("selected", "selected"); // Yangtze
+ $rivers.eq(3).removeAttr("selected"); // Yellow River
+ $rivers.eq(4).removeAttr("selected"); // ParanĂ¡ River
+ $submit.click();
+
+ jQuery("#page\\:testframe").load(function () {
+ var $output = jQueryFrame("#page\\:mainForm\\:riverOutput span");
+ assert.equal($output.text(), "6300 km");
+ done();
+ });
+});
+
+QUnit.test("ajax: select Everest", function (assert) {
+ assert.expect(1);
+ var done = assert.async();
+ var $mountains = jQueryFrame("#page\\:mainForm\\:mountainList option");
+
+ $mountains.eq(1).removeAttr("selected");
+ $mountains.eq(2).removeAttr("selected");
+ $mountains.eq(3).removeAttr("selected");
+ $mountains.eq(4).removeAttr("selected");
+ $mountains.eq(0).attr("selected", "selected").trigger("change"); // Everest
+
+ $.ajax({
+ type: 'GET',
+ url: 'content/20-component/030-select/40-selectOneListbox/selectOneListbox.xhtml'
+ }).done(function () {
+ var $output = jQueryFrame("#page\\:mainForm\\:selectedMountain span");
+ assert.equal($output.text(), "8848 m");
+ done();
+ });
+});
+
+QUnit.test("ajax: select Makalu", function (assert) {
+ assert.expect(1);
+ var done = assert.async();
+ var $mountains = jQueryFrame("#page\\:mainForm\\:mountainList option");
+
+ $mountains.eq(0).removeAttr("selected");
+ $mountains.eq(1).removeAttr("selected");
+ $mountains.eq(2).removeAttr("selected");
+ $mountains.eq(3).removeAttr("selected");
+ $mountains.eq(4).attr("selected", "selected").trigger("change"); // Everest
+
+ $.ajax({
+ type: 'GET',
+ url: 'content/20-component/030-select/40-selectOneListbox/selectOneListbox.xhtml'
+ }).done(function () {
+ var $output = jQueryFrame("#page\\:mainForm\\:selectedMountain span");
+ assert.equal($output.text(), "8481 m");
+ done();
+ });
+});
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/40-selectOneListbox/selectOneListbox.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/40-selectOneListbox/selectOneListbox.xhtml?rev=1750949&r1=1750948&r2=1750949&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/40-selectOneListbox/selectOneListbox.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/40-selectOneListbox/selectOneListbox.xhtml Fri Jul 1 14:56:09 2016
@@ -69,15 +69,15 @@
outputfield.</p>
<p>Items are added with
<code class="language-markup"><tc:selectItem itemLabel="Nile" itemValue="6853 km"/></code>.</p>
- <tc:selectOneListbox id="s4" label="River" value="#{selectOneListboxController.river}">
+ <tc:selectOneListbox id="riverList" label="River" value="#{selectOneListboxController.river}">
<tc:selectItem itemLabel="Nile" itemValue="6853 km"/>
<tc:selectItem itemLabel="Amazon" itemValue="6437 km"/>
<tc:selectItem itemLabel="Yangtze" itemValue="6300 km"/>
<tc:selectItem itemLabel="Yellow River" itemValue="5464 km"/>
<tc:selectItem itemLabel="ParanĂ¡ River" itemValue="4880 km"/>
</tc:selectOneListbox>
- <tc:out id="o1" label="Length" value="#{selectOneListboxController.river}"/>
- <tc:button id="b1" label="Submit"/>
+ <tc:out id="riverOutput" label="Length" value="#{selectOneListboxController.river}"/>
+ <tc:button id="riverSubmit" label="Submit"/>
</tc:section>
<tc:section label="Ajax">
@@ -85,7 +85,7 @@
<code class="language-markup"><tc:out id="selectedMountain" .../></code>. The
<code class="language-markup"><tc:selectOneListbox/></code> contain a
<code class="language-markup"><f:ajax render="selectedMountain"/></code>, which rerender the outputfield.</p>
- <tc:selectOneListbox id="s5" label="Mountains" value="#{selectOneListboxController.mountain}">
+ <tc:selectOneListbox id="mountainList" label="Mountains" value="#{selectOneListboxController.mountain}">
<tc:selectItems value="#{selectOneListboxController.mountains}" var="mountain"
itemLabel="#{mountain.label}" itemValue="#{mountain.value}"/>
<f:ajax render="selectedMountain"/>
Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/50-selectManyCheckbox/selectManyCheckbox.test.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/50-selectManyCheckbox/selectManyCheckbox.test.js?rev=1750949&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/50-selectManyCheckbox/selectManyCheckbox.test.js (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/50-selectManyCheckbox/selectManyCheckbox.test.js Fri Jul 1 14:56:09 2016
@@ -0,0 +1,136 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+function jQueryFrame(expression) {
+ return document.getElementById("page:testframe").contentWindow.jQuery(expression);
+}
+
+QUnit.test("submit: select cat", function (assert) {
+ assert.expect(1);
+ var done = assert.async();
+ var $animals = jQueryFrame("#page\\:mainForm\\:animals input");
+ var $submit = jQueryFrame("#page\\:mainForm\\:submit");
+
+ $animals.eq(0).attr("checked", "checked");
+ $animals.eq(1).removeAttr("checked");
+ $animals.eq(2).removeAttr("checked");
+ $animals.eq(3).removeAttr("checked");
+ $submit.click();
+
+ jQuery("#page\\:testframe").load(function () {
+ var $output = jQueryFrame("#page\\:mainForm\\:animalsOutput span");
+ assert.equal($output.text(), "Cat ");
+ done();
+ });
+});
+
+QUnit.test("submit: select fox and rabbit", function (assert) {
+ assert.expect(1);
+ var done = assert.async();
+ var $animals = jQueryFrame("#page\\:mainForm\\:animals input");
+ var $submit = jQueryFrame("#page\\:mainForm\\:submit");
+
+ $animals.eq(0).removeAttr("checked");
+ $animals.eq(1).removeAttr("checked");
+ $animals.eq(2).attr("checked", "checked");
+ $animals.eq(3).attr("checked", "checked");
+ $submit.click();
+
+ jQuery("#page\\:testframe").load(function () {
+ var $output = jQueryFrame("#page\\:mainForm\\:animalsOutput span");
+ assert.equal($output.text(), "Fox Rabbit ");
+ done();
+ });
+});
+
+QUnit.test("ajax: click 'Two'", function (assert) {
+ assert.expect(1);
+ var done = assert.async();
+ var $number2 = jQueryFrame("#page\\:mainForm\\:numbers\\:\\:1");
+ var $output = jQueryFrame("#page\\:mainForm\\:resultOutput span");
+
+ var newOutputValue;
+
+ if ($number2.attr("checked") === "checked") {
+ $number2.removeAttr("checked").trigger("change");
+ newOutputValue = parseInt($output.text()) - 2;
+ } else {
+ $number2.attr("checked", "checked").trigger("change");
+ newOutputValue = parseInt($output.text()) + 2;
+ }
+
+ $.ajax({
+ type: 'GET',
+ url: 'content/20-component/030-select/50-selectManyCheckbox/selectManyCheckbox.xhtml'
+ }).done(function () {
+ $output = jQueryFrame($output.selector);
+ assert.equal($output.text(), newOutputValue);
+ done();
+ });
+});
+
+QUnit.test("ajax: click 'Three'", function (assert) {
+ assert.expect(1);
+ var done = assert.async();
+ var $number3 = jQueryFrame("#page\\:mainForm\\:numbers\\:\\:2");
+ var $output = jQueryFrame("#page\\:mainForm\\:resultOutput span");
+
+ var newOutputValue;
+
+ if ($number3.attr("checked") === "checked") {
+ $number3.removeAttr("checked").trigger("change");
+ newOutputValue = parseInt($output.text()) - 3;
+ } else {
+ $number3.attr("checked", "checked").trigger("change");
+ newOutputValue = parseInt($output.text()) + 3;
+ }
+
+ $.ajax({
+ type: 'GET',
+ url: 'content/20-component/030-select/50-selectManyCheckbox/selectManyCheckbox.xhtml'
+ }).done(function () {
+ $output = jQueryFrame($output.selector);
+ assert.equal($output.text(), newOutputValue);
+ done();
+ });
+});
+
+QUnit.test("ajax: click 'Two'", function (assert) {
+ assert.expect(1);
+ var done = assert.async();
+ var $number2 = jQueryFrame("#page\\:mainForm\\:numbers\\:\\:1");
+ var $output = jQueryFrame("#page\\:mainForm\\:resultOutput span");
+
+ var newOutputValue;
+
+ if ($number2.attr("checked") === "checked") {
+ $number2.removeAttr("checked").trigger("change");
+ newOutputValue = parseInt($output.text()) - 2;
+ } else {
+ $number2.attr("checked", "checked").trigger("change");
+ newOutputValue = parseInt($output.text()) + 2;
+ }
+
+ $.ajax({
+ type: 'GET',
+ url: 'content/20-component/030-select/50-selectManyCheckbox/selectManyCheckbox.xhtml'
+ }).done(function () {
+ $output = jQueryFrame($output.selector);
+ assert.equal($output.text(), newOutputValue);
+ done();
+ });
+});
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/50-selectManyCheckbox/selectManyCheckbox.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/50-selectManyCheckbox/selectManyCheckbox.xhtml?rev=1750949&r1=1750948&r2=1750949&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/50-selectManyCheckbox/selectManyCheckbox.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/50-selectManyCheckbox/selectManyCheckbox.xhtml Fri Jul 1 14:56:09 2016
@@ -63,14 +63,14 @@
The
<code class="language-markup"><tc:out ... value="\#{selectManyCheckboxController.animal}"/></code>
get the value from the controller.</p>
- <tc:selectManyCheckbox label="Checkbox Group" value="#{selectManyCheckboxController.animals}">
+ <tc:selectManyCheckbox id="animals" label="Checkbox Group" value="#{selectManyCheckboxController.animals}">
<tc:selectItem itemLabel="Cat" itemValue="Cat"/>
<tc:selectItem itemLabel="Dog" itemValue="Dog"/>
<tc:selectItem itemLabel="Fox" itemValue="Fox"/>
<tc:selectItem itemLabel="Rabbit" itemValue="Rabbit"/>
</tc:selectManyCheckbox>
- <tc:out id="o1" label="Selected Animals" value="#{selectManyCheckboxController.animal}"/>
- <tc:button id="b1" label="Submit"/>
+ <tc:out id="animalsOutput" label="Selected Animals" value="#{selectManyCheckboxController.animal}"/>
+ <tc:button id="submit" label="Submit"/>
</tc:section>
<tc:section label="Ajax">
@@ -79,7 +79,7 @@
<code class="language-markup"><tc:selectManyCheckbox .../></code> contain a
<code class="language-markup"><f:ajax render="resultOutput"/></code>, which rerenders the outputfield after
check/uncheck a checkbox.</p>
- <tc:selectManyCheckbox label="Checkbox Group" value="#{selectManyCheckboxController.numbers}">
+ <tc:selectManyCheckbox id="numbers" label="Checkbox Group" value="#{selectManyCheckboxController.numbers}">
<tc:selectItem itemLabel="One" itemValue="1"/>
<tc:selectItem itemLabel="Two" itemValue="2"/>
<tc:selectItem itemLabel="Three" itemValue="3"/>
Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/08-form/10-required/form-required.test.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/08-form/10-required/form-required.test.js?rev=1750949&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/08-form/10-required/form-required.test.js (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/08-form/10-required/form-required.test.js Fri Jul 1 14:56:09 2016
@@ -0,0 +1,225 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+function jQueryFrame(expression) {
+ return document.getElementById("page:testframe").contentWindow.jQuery(expression);
+}
+
+QUnit.test("submit inner form 1 without violations", function (assert) {
+ assert.expect(3);
+ var done = assert.async();
+ var $form1InputField = jQueryFrame("#page\\:mainForm\\:outerForm\\:innerForm1\\:in\\:\\:field");
+ var $form1SubmitButton = jQueryFrame("#page\\:mainForm\\:outerForm\\:innerForm1\\:submit");
+
+ $form1InputField.val("Alice");
+ $form1SubmitButton.click();
+
+ jQuery("#page\\:testframe").load(function () {
+ $form1InputField = jQueryFrame("#page\\:mainForm\\:outerForm\\:innerForm1\\:in\\:\\:field");
+ var $form1OutputField = jQueryFrame("#page\\:mainForm\\:outerForm\\:innerForm1\\:out span");
+ var $alert = jQueryFrame("#page\\:messages .alert-danger label");
+
+ assert.equal($form1InputField.val(), "Alice");
+ assert.equal($form1OutputField.text(), "Alice");
+ assert.equal($alert.length, "0");
+
+ done();
+ });
+});
+
+QUnit.test("submit inner form 2, violate required field", function (assert) {
+ assert.expect(4);
+ var done = assert.async();
+ var $form2InputField = jQueryFrame("#page\\:mainForm\\:outerForm\\:innerForm2\\:in\\:\\:field");
+ var $form2SubmitButton = jQueryFrame("#page\\:mainForm\\:outerForm\\:innerForm2\\:submit");
+
+ var form2OutputFieldValue = jQueryFrame("#page\\:mainForm\\:outerForm\\:innerForm2\\:out span").text();
+
+ $form2InputField.val("");
+ assert.equal($form2InputField.val(), "");
+ $form2SubmitButton.click();
+
+ jQuery("#page\\:testframe").load(function () {
+ $form2InputField = jQueryFrame("#page\\:mainForm\\:outerForm\\:innerForm2\\:in\\:\\:field");
+ var $form2OutputField = jQueryFrame("#page\\:mainForm\\:outerForm\\:innerForm2\\:out span");
+ var $alert = jQueryFrame("#page\\:messages .alert-danger label");
+
+ assert.equal($form2InputField.val(), "");
+ assert.equal($form2OutputField.text(), form2OutputFieldValue);
+ assert.equal($alert.length, "1");
+
+ done();
+ });
+});
+
+QUnit.test("submit inner form 2 without violations", function (assert) {
+ assert.expect(4);
+ var done = assert.async();
+ var $form2InputField = jQueryFrame("#page\\:mainForm\\:outerForm\\:innerForm2\\:in\\:\\:field");
+ var $form2SubmitButton = jQueryFrame("#page\\:mainForm\\:outerForm\\:innerForm2\\:submit");
+
+ $form2InputField.val("Bob");
+ assert.equal($form2InputField.val(), "Bob");
+ $form2SubmitButton.click();
+
+ jQuery("#page\\:testframe").load(function () {
+ $form2InputField = jQueryFrame("#page\\:mainForm\\:outerForm\\:innerForm2\\:in\\:\\:field");
+ var $form2OutputField = jQueryFrame("#page\\:mainForm\\:outerForm\\:innerForm2\\:out span");
+ var $alert = jQueryFrame("#page\\:messages .alert-danger label");
+
+ assert.equal($form2InputField.val(), "Bob");
+ assert.equal($form2OutputField.text(), "Bob");
+ assert.equal($alert.length, "0");
+
+ done();
+ });
+});
+
+QUnit.test("submit outer form, violate both required fields", function (assert) {
+ assert.expect(5);
+ var done = assert.async();
+ var $form2InputField = jQueryFrame("#page\\:mainForm\\:outerForm\\:innerForm2\\:in\\:\\:field");
+ var $outerFormInputField = jQueryFrame("#page\\:mainForm\\:outerForm\\:in\\:\\:field");
+ var $outerFormSubmitButton = jQueryFrame("#page\\:mainForm\\:outerForm\\:submit");
+
+ var form2OutputFieldValue = jQueryFrame("#page\\:mainForm\\:outerForm\\:innerForm2\\:out span").text();
+ var outerFormOutputFieldValue = jQueryFrame("#page\\:mainForm\\:outerForm\\:out span").text();
+
+ $form2InputField.val("");
+ $outerFormInputField.val("");
+ $outerFormSubmitButton.click();
+
+ jQuery("#page\\:testframe").load(function () {
+ $form2InputField = jQueryFrame("#page\\:mainForm\\:outerForm\\:innerForm2\\:in\\:\\:field");
+ var $form2OutputField = jQueryFrame("#page\\:mainForm\\:outerForm\\:innerForm2\\:out span");
+ $outerFormInputField = jQueryFrame("#page\\:mainForm\\:outerForm\\:in\\:\\:field");
+ var $outerFormOutputField = jQueryFrame("#page\\:mainForm\\:outerForm\\:out span");
+
+ var $alert = jQueryFrame("#page\\:messages .alert-danger label");
+
+ assert.equal($form2InputField.val(), "");
+ assert.equal($form2OutputField.text(), form2OutputFieldValue);
+ assert.equal($outerFormInputField.val(), "");
+ assert.equal($outerFormOutputField.text(), outerFormOutputFieldValue);
+
+ assert.equal($alert.length, "2");
+
+ done();
+ });
+});
+
+QUnit.test("submit outer form, violate required field in form 2", function (assert) {
+ assert.expect(5);
+ var done = assert.async();
+ var $form2InputField = jQueryFrame("#page\\:mainForm\\:outerForm\\:innerForm2\\:in\\:\\:field");
+ var $outerFormInputField = jQueryFrame("#page\\:mainForm\\:outerForm\\:in\\:\\:field");
+ var $outerFormSubmitButton = jQueryFrame("#page\\:mainForm\\:outerForm\\:submit");
+
+ var form2OutputFieldValue = jQueryFrame("#page\\:mainForm\\:outerForm\\:innerForm2\\:out span").text();
+ var outerFormOutputFieldValue = jQueryFrame("#page\\:mainForm\\:outerForm\\:out span").text();
+
+ $form2InputField.val("");
+ $outerFormInputField.val("Charlie");
+ $outerFormSubmitButton.click();
+
+ jQuery("#page\\:testframe").load(function () {
+ $form2InputField = jQueryFrame("#page\\:mainForm\\:outerForm\\:innerForm2\\:in\\:\\:field");
+ var $form2OutputField = jQueryFrame("#page\\:mainForm\\:outerForm\\:innerForm2\\:out span");
+ $outerFormInputField = jQueryFrame("#page\\:mainForm\\:outerForm\\:in\\:\\:field");
+ var $outerFormOutputField = jQueryFrame("#page\\:mainForm\\:outerForm\\:out span");
+
+ var $alert = jQueryFrame("#page\\:messages .alert-danger label");
+
+ assert.equal($form2InputField.val(), "");
+ assert.equal($form2OutputField.text(), form2OutputFieldValue);
+ assert.equal($outerFormInputField.val(), "Charlie");
+ assert.equal($outerFormOutputField.text(), outerFormOutputFieldValue);
+
+ assert.equal($alert.length, "1");
+
+ done();
+ });
+});
+
+QUnit.test("submit outer form, violate required field in outer form", function (assert) {
+ assert.expect(5);
+ var done = assert.async();
+ var $form2InputField = jQueryFrame("#page\\:mainForm\\:outerForm\\:innerForm2\\:in\\:\\:field");
+ var $outerFormInputField = jQueryFrame("#page\\:mainForm\\:outerForm\\:in\\:\\:field");
+ var $outerFormSubmitButton = jQueryFrame("#page\\:mainForm\\:outerForm\\:submit");
+
+ var form2OutputFieldValue = jQueryFrame("#page\\:mainForm\\:outerForm\\:innerForm2\\:out span").text();
+ var outerFormOutputFieldValue = jQueryFrame("#page\\:mainForm\\:outerForm\\:out span").text();
+
+ $form2InputField.val("Dave");
+ $outerFormInputField.val("");
+ $outerFormSubmitButton.click();
+
+ jQuery("#page\\:testframe").load(function () {
+ $form2InputField = jQueryFrame("#page\\:mainForm\\:outerForm\\:innerForm2\\:in\\:\\:field");
+ var $form2OutputField = jQueryFrame("#page\\:mainForm\\:outerForm\\:innerForm2\\:out span");
+ $outerFormInputField = jQueryFrame("#page\\:mainForm\\:outerForm\\:in\\:\\:field");
+ var $outerFormOutputField = jQueryFrame("#page\\:mainForm\\:outerForm\\:out span");
+
+ var $alert = jQueryFrame("#page\\:messages .alert-danger label");
+
+ assert.equal($form2InputField.val(), "Dave");
+ assert.equal($form2OutputField.text(), form2OutputFieldValue);
+ assert.equal($outerFormInputField.val(), "");
+ assert.equal($outerFormOutputField.text(), outerFormOutputFieldValue);
+
+ assert.equal($alert.length, "1");
+
+ done();
+ });
+});
+
+QUnit.test("submit outer form without violations", function (assert) {
+ assert.expect(7);
+ var done = assert.async();
+ var $form1InputField = jQueryFrame("#page\\:mainForm\\:outerForm\\:innerForm1\\:in\\:\\:field");
+ var $form2InputField = jQueryFrame("#page\\:mainForm\\:outerForm\\:innerForm2\\:in\\:\\:field");
+ var $outerFormInputField = jQueryFrame("#page\\:mainForm\\:outerForm\\:in\\:\\:field");
+ var $outerFormSubmitButton = jQueryFrame("#page\\:mainForm\\:outerForm\\:submit");
+
+ $form1InputField.val("Eve");
+ $form2InputField.val("Frank");
+ $outerFormInputField.val("Grace");
+ $outerFormSubmitButton.click();
+
+ jQuery("#page\\:testframe").load(function () {
+ $form1InputField = jQueryFrame("#page\\:mainForm\\:outerForm\\:innerForm1\\:in\\:\\:field");
+ var $form1OutputField = jQueryFrame("#page\\:mainForm\\:outerForm\\:innerForm1\\:out span");
+ $form2InputField = jQueryFrame("#page\\:mainForm\\:outerForm\\:innerForm2\\:in\\:\\:field");
+ var $form2OutputField = jQueryFrame("#page\\:mainForm\\:outerForm\\:innerForm2\\:out span");
+ $outerFormInputField = jQueryFrame("#page\\:mainForm\\:outerForm\\:in\\:\\:field");
+ var $outerFormOutputField = jQueryFrame("#page\\:mainForm\\:outerForm\\:out span");
+
+ var $alert = jQueryFrame("#page\\:messages .alert-danger label");
+
+ assert.equal($form1InputField.val(), "Eve");
+ assert.equal($form1OutputField.text(), "Eve");
+ assert.equal($form2InputField.val(), "Frank");
+ assert.equal($form2OutputField.text(), "Frank");
+ assert.equal($outerFormInputField.val(), "Grace");
+ assert.equal($outerFormOutputField.text(), "Grace");
+
+ assert.equal($alert.length, "0");
+
+ done();
+ });
+});
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/08-form/10-required/form-required.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/08-form/10-required/form-required.xhtml?rev=1750949&r1=1750948&r2=1750949&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/08-form/10-required/form-required.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/08-form/10-required/form-required.xhtml Fri Jul 1 14:56:09 2016
@@ -24,6 +24,7 @@
<ui:param name="title" value="#{overviewBundle.form_required} <tc:form>"/>
<p>If the validation of a form is activated and the actual value of this form is only stored temporarily,
the validation is deactivated until the value is definitely stored into the model.</p>
+ <p>For example, if only the value in 'Inner Form 1' is set, the validation of the other forms are turned off.</p>
<tc:link label="Tag Library Documentation" image="image/feather-leaf.png"
link="#{overviewBundle.tagDocUrl}/form.html"/>
@@ -37,8 +38,8 @@
<tc:form>
<tc:box label="Inner Form 1">
<tc:form>
- <tc:in label="Inner Value 1" value="#{formRequiredController.innerValue1}"/>
- <tc:out label="Inner Value 1 in Model" value="#{formRequiredController.innerValue1}"/>
+ <tc:in label="Inner Value 1"/>
+ <tc:out label="Inner Value 1 in Model"/>
<tc:button label="Submit"/>
</tc:form>
</tc:box>
@@ -46,33 +47,33 @@
...
</tc:box>
<tc:separator/>
- <tc:in label="Outer Value" required="true" value="#{formRequiredController.outerValue}"/>
- <tc:out label="Outer Value in Model" value="#{formRequiredController.outerValue}"/>
+ <tc:in label="Outer Value" required="true"/>
+ <tc:out label="Outer Value in Model"/>
<tc:button label="Submit"/>
</tc:form>
</tc:box></code></pre>
<tc:box label="Outer Form">
- <tc:form id="outer">
+ <tc:form id="outerForm">
<tc:box label="Inner Form 1">
- <tc:form id="inner1">
- <tc:in id="innervalue1in" label="Inner Value 1" value="#{formRequiredController.innerValue1}"/>
- <tc:out id="innervalue1out" label="Inner Value 1 in Model" value="#{formRequiredController.innerValue1}"/>
- <tc:button label="Submit"/>
+ <tc:form id="innerForm1">
+ <tc:in id="in" label="Inner Value 1" value="#{formRequiredController.innerValue1}"/>
+ <tc:out id="out" label="Value in Model" value="#{formRequiredController.innerValue1}"/>
+ <tc:button id="submit" label="Submit"/>
</tc:form>
</tc:box>
<tc:box label="Inner Form 2">
- <tc:form id="inner2">
- <tc:in id="innervalue2in" label="Inner Value 2" required="true"
+ <tc:form id="innerForm2">
+ <tc:in id="in" label="Inner Value 2" required="true"
value="#{formRequiredController.innerValue2}"/>
- <tc:out id="innervalue2out" label="Inner Value 2 in Model" value="#{formRequiredController.innerValue2}"/>
- <tc:button label="Submit"/>
+ <tc:out id="out" label="Value in Model" value="#{formRequiredController.innerValue2}"/>
+ <tc:button id="submit" label="Submit"/>
</tc:form>
</tc:box>
<tc:separator/>
- <tc:in id="outervaluein" label="Outer Value" required="true" value="#{formRequiredController.outerValue}"/>
- <tc:out id="outervalueout" label="Outer Value in Model" value="#{formRequiredController.outerValue}"/>
- <tc:button label="Submit"/>
+ <tc:in id="in" label="Outer Value" required="true" value="#{formRequiredController.outerValue}"/>
+ <tc:out id="out" label="Value in Model" value="#{formRequiredController.outerValue}"/>
+ <tc:button id="submit" label="Submit"/>
</tc:form>
</tc:box>
</tc:section>