myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r1753532 - in /myfaces/tobago/trunk/tobago-example/tobago-example-demo/src: main/webapp/content/20-component/060-popup/ main/webapp/content/30-concept/06-validation/00/ main/webapp/content/30-concept/06-validation/01/ main/webapp/content/30...
Date Wed, 20 Jul 2016 15:03:51 GMT
Author: deki
Date: Wed Jul 20 15:03:51 2016
New Revision: 1753532

URL: http://svn.apache.org/viewvc?rev=1753532&view=rev
Log:
TOBAGO 1473:
- add tests for collapsible concept
- add tests for for-each
- add tests for validation
[developed by hnoeth]

Added:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/060-popup/popup.test.js
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/06-validation/00/content-validation.test.js
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/06-validation/01/validation-jsr303.test.js
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/51-for-each/for-each.test.js
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/00-collapsible-box/collapsible-box.test.js
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/10-collapsible-popup/collapsible-popup.test.js
Modified:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/test/java/org/apache/myfaces/tobago/example/demo/QUnitTests.java

Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/060-popup/popup.test.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/060-popup/popup.test.js?rev=1753532&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/060-popup/popup.test.js (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/060-popup/popup.test.js Wed Jul 20 15:03:51 2016
@@ -0,0 +1,375 @@
+/*
+ * 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("Open 'Simple Popup' and press 'Cancel'.", function (assert) {
+  assert.expect(3);
+  var done = assert.async(2);
+  var step = 1;
+
+  var $popup = jQueryFrame("#page\\:mainForm\\:form1\\:popup input");
+  var $openButton = jQueryFrame("#page\\:mainForm\\:form1\\:openPopup");
+  var $cancelButton = jQueryFrame("#page\\:mainForm\\:form1\\:popup\\:cancel");
+
+  assert.equal($popup.attr("value"), "true");
+  $openButton.click();
+
+  jQuery("#page\\:testframe").load(function () {
+    if (step == 1) {
+      $popup = jQueryFrame($popup.selector);
+      assert.equal($popup.attr("value"), "false");
+
+      $cancelButton = jQueryFrame($cancelButton.selector);
+      $cancelButton.click();
+
+      done();
+    } else if (step == 2) {
+      $popup = jQueryFrame($popup.selector);
+      assert.equal($popup.attr("value"), "true");
+
+      done();
+    }
+    step++;
+  });
+});
+
+QUnit.test("Open 'Simple Popup', press 'Submit' while field is empty. Press 'Cancel'.", function (assert) {
+  assert.expect(5);
+  var done = assert.async(3);
+  var step = 1;
+
+  var $popup = jQueryFrame("#page\\:mainForm\\:form1\\:popup input");
+  var $openButton = jQueryFrame("#page\\:mainForm\\:form1\\:openPopup");
+  var $output = jQueryFrame("#page\\:mainForm\\:form1\\:output span");
+  var outputValue = $output.text();
+  var $inputField = jQueryFrame("#page\\:mainForm\\:form1\\:popup\\:in\\:\\:field");
+  var $submitButton = jQueryFrame("#page\\:mainForm\\:form1\\:popup\\:submit");
+  var $cancelButton = jQueryFrame("#page\\:mainForm\\:form1\\:popup\\:cancel");
+
+  assert.equal($popup.attr("value"), "true");
+  $openButton.click();
+
+  jQuery("#page\\:testframe").load(function () {
+    if (step == 1) {
+      $popup = jQueryFrame($popup.selector);
+      $inputField = jQueryFrame($inputField.selector);
+      $submitButton = jQueryFrame($submitButton.selector);
+
+      assert.equal($popup.attr("value"), "false");
+      $inputField.val("");
+      $submitButton.click();
+
+      done();
+    } else if (step == 2) {
+      $popup = jQueryFrame($popup.selector);
+      $cancelButton = jQueryFrame($cancelButton.selector);
+
+      assert.equal($popup.attr("value"), "false");
+      $cancelButton.click();
+
+      done();
+    } else if (step == 3) {
+      $popup = jQueryFrame($popup.selector);
+      $output = jQueryFrame($output.selector);
+
+      assert.equal($popup.attr("value"), "true");
+      assert.equal($output.text(), outputValue);
+
+      done();
+    }
+    step++;
+  });
+});
+
+QUnit.test("Open 'Simple Popup', press 'Submit' while field has content. Press 'Cancel'.", function (assert) {
+  assert.expect(5);
+  var done = assert.async(3);
+  var step = 1;
+
+  var $popup = jQueryFrame("#page\\:mainForm\\:form1\\:popup input");
+  var $openButton = jQueryFrame("#page\\:mainForm\\:form1\\:openPopup");
+  var $output = jQueryFrame("#page\\:mainForm\\:form1\\:output span");
+  var $inputField = jQueryFrame("#page\\:mainForm\\:form1\\:popup\\:in\\:\\:field");
+  var $submitButton = jQueryFrame("#page\\:mainForm\\:form1\\:popup\\:submit");
+  var $cancelButton = jQueryFrame("#page\\:mainForm\\:form1\\:popup\\:cancel");
+
+  assert.equal($popup.attr("value"), "true");
+  $openButton.click();
+
+  jQuery("#page\\:testframe").load(function () {
+    if (step == 1) {
+      $popup = jQueryFrame($popup.selector);
+      $inputField = jQueryFrame($inputField.selector);
+      $submitButton = jQueryFrame($submitButton.selector);
+
+      assert.equal($popup.attr("value"), "false");
+      $inputField.val("Hello Popup!");
+      $submitButton.click();
+
+      done();
+    } else if (step == 2) {
+      $popup = jQueryFrame($popup.selector);
+      $cancelButton = jQueryFrame($cancelButton.selector);
+
+      assert.equal($popup.attr("value"), "false");
+      $cancelButton.click();
+
+      done();
+    } else if (step == 3) {
+      $popup = jQueryFrame($popup.selector);
+      $output = jQueryFrame($output.selector);
+
+      assert.equal($popup.attr("value"), "true");
+      assert.equal($output.text(), "Hello Popup!");
+
+      done();
+    }
+    step++;
+  });
+});
+
+QUnit.test("Open 'Simple Popup', press 'Submit & Close' while field is empty. Press 'Cancel'.", function (assert) {
+  assert.expect(5);
+  var done = assert.async(3);
+  var step = 1;
+
+  var $popup = jQueryFrame("#page\\:mainForm\\:form1\\:popup input");
+  var $openButton = jQueryFrame("#page\\:mainForm\\:form1\\:openPopup");
+  var $output = jQueryFrame("#page\\:mainForm\\:form1\\:output span");
+  var outputValue = $output.text();
+  var $inputField = jQueryFrame("#page\\:mainForm\\:form1\\:popup\\:in\\:\\:field");
+  var $submitCloseButton = jQueryFrame("#page\\:mainForm\\:form1\\:popup\\:submitClose");
+  var $cancelButton = jQueryFrame("#page\\:mainForm\\:form1\\:popup\\:cancel");
+
+  assert.equal($popup.attr("value"), "true");
+  $openButton.click();
+
+  jQuery("#page\\:testframe").load(function () {
+    if (step == 1) {
+      $popup = jQueryFrame($popup.selector);
+      $inputField = jQueryFrame($inputField.selector);
+      $submitCloseButton = jQueryFrame($submitCloseButton.selector);
+
+      assert.equal($popup.attr("value"), "false");
+      $inputField.val("");
+      $submitCloseButton.click();
+
+      done();
+    } else if (step == 2) {
+      $popup = jQueryFrame($popup.selector);
+      $cancelButton = jQueryFrame($cancelButton.selector);
+
+      assert.equal($popup.attr("value"), "false");
+      $cancelButton.click();
+
+      done();
+    } else if (step == 3) {
+      $popup = jQueryFrame($popup.selector);
+      $output = jQueryFrame($output.selector);
+
+      assert.equal($popup.attr("value"), "true");
+      assert.equal($output.text(), outputValue);
+
+      done();
+    }
+    step++;
+  });
+});
+
+QUnit.test("Open 'Simple Popup', press 'Submit & Close' while field has content.", function (assert) {
+  assert.expect(4);
+  var done = assert.async(2);
+  var step = 1;
+
+  var $popup = jQueryFrame("#page\\:mainForm\\:form1\\:popup input");
+  var $openButton = jQueryFrame("#page\\:mainForm\\:form1\\:openPopup");
+  var $output = jQueryFrame("#page\\:mainForm\\:form1\\:output span");
+  var $inputField = jQueryFrame("#page\\:mainForm\\:form1\\:popup\\:in\\:\\:field");
+  var $submitCloseButton = jQueryFrame("#page\\:mainForm\\:form1\\:popup\\:submitClose");
+  var $cancelButton = jQueryFrame("#page\\:mainForm\\:form1\\:popup\\:cancel");
+
+  assert.equal($popup.attr("value"), "true");
+  $openButton.click();
+
+  jQuery("#page\\:testframe").load(function () {
+    if (step == 1) {
+      $popup = jQueryFrame($popup.selector);
+      $inputField = jQueryFrame($inputField.selector);
+      $submitCloseButton = jQueryFrame($submitCloseButton.selector);
+
+      assert.equal($popup.attr("value"), "false");
+      $inputField.val("press submit and close test");
+      $submitCloseButton.click();
+
+      done();
+    } else if (step == 2) {
+      $popup = jQueryFrame($popup.selector);
+      $output = jQueryFrame($output.selector);
+
+      assert.equal($popup.attr("value"), "true");
+      assert.equal($output.text(), "press submit and close test");
+
+      done();
+    }
+    step++;
+  });
+});
+
+QUnit.test("Open 'Client Popup' and press 'Cancel'.", function (assert) {
+  assert.expect(3);
+  // var done = assert.async(2);
+  var step = 1;
+
+  var $popup = jQueryFrame("#page\\:mainForm\\:form2\\:clientPopup input");
+  var $openButton = jQueryFrame("#page\\:mainForm\\:form2\\:open");
+  var $cancelButton = jQueryFrame("#page\\:mainForm\\:form2\\:clientPopup\\:cancel");
+
+  assert.equal($popup.attr("value"), "true");
+  $openButton.click();
+  assert.equal($popup.attr("value"), "false");
+  $cancelButton.click();
+  assert.equal($popup.attr("value"), "true");
+});
+
+QUnit.test("Open 'Client Popup', press 'Submit' while field is empty. Press 'Cancel'.", function (assert) {
+  assert.expect(5);
+  var done = assert.async(1);
+
+  var $popup = jQueryFrame("#page\\:mainForm\\:form2\\:clientPopup input");
+  var $openButton = jQueryFrame("#page\\:mainForm\\:form2\\:open");
+  var $output = jQueryFrame("#page\\:mainForm\\:form2\\:output span");
+  var outputValue = $output.text();
+  var $messages = jQueryFrame("#page\\:mainForm\\:form2\\:clientPopup\\:messages");
+  var $inputField = jQueryFrame("#page\\:mainForm\\:form2\\:clientPopup\\:in\\:\\:field");
+  var $submitButton = jQueryFrame("#page\\:mainForm\\:form2\\:clientPopup\\:submit");
+  var $cancelButton = jQueryFrame("#page\\:mainForm\\:form2\\:clientPopup\\:cancel");
+
+  assert.equal($popup.attr("value"), "true");
+  $openButton.click();
+  assert.equal($popup.attr("value"), "false");
+  $inputField.val("");
+  $submitButton.click();
+
+  $.ajax({
+    type: 'GET',
+    url: 'content/20-component/060-popup/popup.xhtml'
+  }).done(function () {
+    $output = jQueryFrame($output.selector);
+    $messages = jQueryFrame($messages.selector);
+    $cancelButton = jQueryFrame($cancelButton.selector);
+
+    assert.equal($messages.length, 1);
+    $cancelButton.click();
+    assert.equal($popup.attr("value"), "true");
+    assert.equal($output.text(), outputValue);
+
+    done();
+  });
+});
+
+QUnit.test("Open 'Client Popup', press 'Submit' while field has content. Press 'Cancel'.", function (assert) {
+  assert.expect(5);
+  var done = assert.async(1);
+
+  var $popup = jQueryFrame("#page\\:mainForm\\:form2\\:clientPopup input");
+  var $openButton = jQueryFrame("#page\\:mainForm\\:form2\\:open");
+  var $output = jQueryFrame("#page\\:mainForm\\:form2\\:out span");
+  var $messages = jQueryFrame("#page\\:mainForm\\:form2\\:clientPopup\\:messages");
+  var $inputField = jQueryFrame("#page\\:mainForm\\:form2\\:clientPopup\\:in\\:\\:field");
+  var $submitButton = jQueryFrame("#page\\:mainForm\\:form2\\:clientPopup\\:submit");
+  var $cancelButton = jQueryFrame("#page\\:mainForm\\:form2\\:clientPopup\\:cancel");
+
+  assert.equal($popup.attr("value"), "true");
+  $openButton.click();
+  assert.equal($popup.attr("value"), "false");
+  $inputField.val("test client popup - submit button");
+  $submitButton.click();
+
+  $.ajax({
+    type: 'GET',
+    url: 'content/20-component/060-popup/popup.xhtml'
+  }).done(function () {
+    $output = jQueryFrame($output.selector);
+    $messages = jQueryFrame($messages.selector);
+    $cancelButton = jQueryFrame($cancelButton.selector);
+
+    assert.equal($messages.length, 0);
+    $cancelButton.click();
+    assert.equal($popup.attr("value"), "true");
+    assert.equal($output.text(), "test client popup - submit button");
+
+    done();
+  });
+});
+
+QUnit.test("Open 'Client Popup', press 'Submit & Close' while field is empty.", function (assert) {
+  assert.expect(4);
+  var done = assert.async(1);
+
+  var $popup = jQueryFrame("#page\\:mainForm\\:form2\\:clientPopup input");
+  var $openButton = jQueryFrame("#page\\:mainForm\\:form2\\:open");
+  var $output = jQueryFrame("#page\\:mainForm\\:form2\\:output span");
+  var outputValue = $output.text();
+  var $inputField = jQueryFrame("#page\\:mainForm\\:form2\\:clientPopup\\:in\\:\\:field");
+  var $submitCloseButton = jQueryFrame("#page\\:mainForm\\:form2\\:clientPopup\\:submitClose");
+
+  assert.equal($popup.attr("value"), "true");
+  $openButton.click();
+  assert.equal($popup.attr("value"), "false");
+  $inputField.val("");
+  $submitCloseButton.click();
+
+  jQuery("#page\\:testframe").load(function () {
+    $popup = jQueryFrame($popup.selector);
+    $output = jQueryFrame($output.selector);
+
+    assert.equal($popup.attr("value"), "true");
+    assert.equal($output.text(), outputValue);
+
+    done();
+  });
+});
+
+QUnit.test("Open 'Simple Popup', press 'Submit & Close' while field has content.", function (assert) {
+  assert.expect(4);
+  var done = assert.async(1);
+
+  var $popup = jQueryFrame("#page\\:mainForm\\:form2\\:clientPopup input");
+  var $openButton = jQueryFrame("#page\\:mainForm\\:form2\\:open");
+  var $output = jQueryFrame("#page\\:mainForm\\:form2\\:out span");
+  var $inputField = jQueryFrame("#page\\:mainForm\\:form2\\:clientPopup\\:in\\:\\:field");
+  var $submitCloseButton = jQueryFrame("#page\\:mainForm\\:form2\\:clientPopup\\:submitClose");
+
+  assert.equal($popup.attr("value"), "true");
+  $openButton.click();
+  assert.equal($popup.attr("value"), "false");
+  $inputField.val("test client popup - submit and close button");
+  $submitCloseButton.click();
+
+  jQuery("#page\\:testframe").load(function () {
+    $popup = jQueryFrame($popup.selector);
+    $output = jQueryFrame($output.selector);
+
+    assert.equal($popup.attr("value"), "true");
+    assert.equal($output.text(), "test client popup - submit and close button");
+
+    done();
+  });
+});

Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/06-validation/00/content-validation.test.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/06-validation/00/content-validation.test.js?rev=1753532&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/06-validation/00/content-validation.test.js (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/06-validation/00/content-validation.test.js Wed Jul 20 15:03:51 2016
@@ -0,0 +1,258 @@
+/*
+ * 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("Required: Submit without content.", function (assert) {
+  assert.expect(2);
+  var done = assert.async();
+
+  var $messages = jQueryFrame("#page\\:messages .tobago-messages");
+  var $textarea = jQueryFrame("#page\\:mainForm\\:required\\:textarea\\:\\:field");
+  var textareaValue = $textarea.val();
+  var $submit = jQueryFrame("#page\\:mainForm\\:required\\:submit");
+
+  $textarea.val("");
+  $submit.click();
+
+  jQuery("#page\\:testframe").load(function () {
+    $messages = jQueryFrame($messages.selector);
+    assert.equal($messages.length, 1);
+    assert.equal($textarea.val(), textareaValue);
+    done();
+  });
+});
+
+QUnit.test("Required: Submit with content.", function (assert) {
+  assert.expect(2);
+  var done = assert.async();
+
+  var $messages = jQueryFrame("#page\\:messages .tobago-messages");
+  var $textarea = jQueryFrame("#page\\:mainForm\\:required\\:textarea\\:\\:field");
+  var $submit = jQueryFrame("#page\\:mainForm\\:required\\:submit");
+
+  $textarea.val("some content");
+  $submit.click();
+
+  jQuery("#page\\:testframe").load(function () {
+    $messages = jQueryFrame($messages.selector);
+    $textarea = jQueryFrame($textarea.selector);
+    assert.equal($messages.length, 0);
+    assert.equal($textarea.val(), "some content");
+    done();
+  });
+});
+
+QUnit.test("Validate Length: Submit single character.", function (assert) {
+  assert.expect(1);
+  var done = assert.async();
+
+  var $messages = jQueryFrame("#page\\:messages .tobago-messages");
+  var $in = jQueryFrame("#page\\:mainForm\\:validateLength\\:in\\:\\:field");
+  var $submit = jQueryFrame("#page\\:mainForm\\:validateLength\\:submit");
+
+  $in.val("a");
+  $submit.click();
+
+  jQuery("#page\\:testframe").load(function () {
+    $messages = jQueryFrame($messages.selector);
+    assert.equal($messages.length, 1);
+    done();
+  });
+});
+
+QUnit.test("Validate Length: Submit two character.", function (assert) {
+  assert.expect(1);
+  var done = assert.async();
+
+  var $messages = jQueryFrame("#page\\:messages .tobago-messages");
+  var $in = jQueryFrame("#page\\:mainForm\\:validateLength\\:in\\:\\:field");
+  var $submit = jQueryFrame("#page\\:mainForm\\:validateLength\\:submit");
+
+  $in.val("ab");
+  $submit.click();
+
+  jQuery("#page\\:testframe").load(function () {
+    $messages = jQueryFrame($messages.selector);
+    assert.equal($messages.length, 0);
+    done();
+  });
+});
+
+QUnit.test("Validate Range: Submit no number.", function (assert) {
+  assert.expect(1);
+  var done = assert.async();
+
+  var $messages = jQueryFrame("#page\\:messages .tobago-messages");
+  var $in = jQueryFrame("#page\\:mainForm\\:validateRange\\:in\\:\\:field");
+  var $submit = jQueryFrame("#page\\:mainForm\\:validateRange\\:submit");
+
+  $in.val("no number");
+  $submit.click();
+
+  jQuery("#page\\:testframe").load(function () {
+    $messages = jQueryFrame($messages.selector);
+    assert.equal($messages.length, 1);
+    done();
+  });
+});
+
+QUnit.test("Validate Range: Submit number '2' which is out of range.", function (assert) {
+  assert.expect(1);
+  var done = assert.async();
+
+  var $messages = jQueryFrame("#page\\:messages .tobago-messages");
+  var $in = jQueryFrame("#page\\:mainForm\\:validateRange\\:in\\:\\:field");
+  var $submit = jQueryFrame("#page\\:mainForm\\:validateRange\\:submit");
+
+  $in.val("2");
+  $submit.click();
+
+  jQuery("#page\\:testframe").load(function () {
+    $messages = jQueryFrame($messages.selector);
+    assert.equal($messages.length, 1);
+    done();
+  });
+});
+
+QUnit.test("Validate Range: Submit number '78' which is out of range.", function (assert) {
+  assert.expect(1);
+  var done = assert.async();
+
+  var $messages = jQueryFrame("#page\\:messages .tobago-messages");
+  var $in = jQueryFrame("#page\\:mainForm\\:validateRange\\:in\\:\\:field");
+  var $submit = jQueryFrame("#page\\:mainForm\\:validateRange\\:submit");
+
+  $in.val("78");
+  $submit.click();
+
+  jQuery("#page\\:testframe").load(function () {
+    $messages = jQueryFrame($messages.selector);
+    assert.equal($messages.length, 1);
+    done();
+  });
+});
+
+QUnit.test("Validate Range: Submit number '64' which is within the range.", function (assert) {
+  assert.expect(1);
+  var done = assert.async();
+
+  var $messages = jQueryFrame("#page\\:messages .tobago-messages");
+  var $in = jQueryFrame("#page\\:mainForm\\:validateRange\\:in\\:\\:field");
+  var $submit = jQueryFrame("#page\\:mainForm\\:validateRange\\:submit");
+
+  $in.val("64");
+  $submit.click();
+
+  jQuery("#page\\:testframe").load(function () {
+    $messages = jQueryFrame($messages.selector);
+    assert.equal($messages.length, 0);
+    done();
+  });
+});
+
+QUnit.test("Regex Validation: Submit 'T' which violates the pattern.", function (assert) {
+  assert.expect(1);
+  var done = assert.async();
+
+  var $messages = jQueryFrame("#page\\:messages .tobago-messages");
+  var $in = jQueryFrame("#page\\:mainForm\\:regexValidation\\:in\\:\\:field");
+  var $submit = jQueryFrame("#page\\:mainForm\\:regexValidation\\:submit");
+
+  $in.val("T");
+  $submit.click();
+
+  jQuery("#page\\:testframe").load(function () {
+    $messages = jQueryFrame($messages.selector);
+    assert.equal($messages.length, 1);
+    done();
+  });
+});
+
+QUnit.test("Regex Validation: Submit '3' which violates the pattern.", function (assert) {
+  assert.expect(1);
+  var done = assert.async();
+
+  var $messages = jQueryFrame("#page\\:messages .tobago-messages");
+  var $in = jQueryFrame("#page\\:mainForm\\:regexValidation\\:in\\:\\:field");
+  var $submit = jQueryFrame("#page\\:mainForm\\:regexValidation\\:submit");
+
+  $in.val("3");
+  $submit.click();
+
+  jQuery("#page\\:testframe").load(function () {
+    $messages = jQueryFrame($messages.selector);
+    assert.equal($messages.length, 1);
+    done();
+  });
+});
+
+QUnit.test("Regex Validation: Submit 'T3' which is accepted.", function (assert) {
+  assert.expect(1);
+  var done = assert.async();
+
+  var $messages = jQueryFrame("#page\\:messages .tobago-messages");
+  var $in = jQueryFrame("#page\\:mainForm\\:regexValidation\\:in\\:\\:field");
+  var $submit = jQueryFrame("#page\\:mainForm\\:regexValidation\\:submit");
+
+  $in.val("T3");
+  $submit.click();
+
+  jQuery("#page\\:testframe").load(function () {
+    $messages = jQueryFrame($messages.selector);
+    assert.equal($messages.length, 0);
+    done();
+  });
+});
+
+QUnit.test("Custom Validator: Submit rejected string.", function (assert) {
+  assert.expect(1);
+  var done = assert.async();
+
+  var $messages = jQueryFrame("#page\\:messages .tobago-messages");
+  var $in = jQueryFrame("#page\\:mainForm\\:customValidator\\:in\\:\\:field");
+  var $submit = jQueryFrame("#page\\:mainForm\\:customValidator\\:submit");
+
+  $in.val("java");
+  $submit.click();
+
+  jQuery("#page\\:testframe").load(function () {
+    $messages = jQueryFrame($messages.selector);
+    assert.equal($messages.length, 1);
+    done();
+  });
+});
+
+QUnit.test("Custom Validator: Submit accepted string.", function (assert) {
+  assert.expect(1);
+  var done = assert.async();
+
+  var $messages = jQueryFrame("#page\\:messages .tobago-messages");
+  var $in = jQueryFrame("#page\\:mainForm\\:customValidator\\:in\\:\\:field");
+  var $submit = jQueryFrame("#page\\:mainForm\\:customValidator\\:submit");
+
+  $in.val("tobago");
+  $submit.click();
+
+  jQuery("#page\\:testframe").load(function () {
+    $messages = jQueryFrame($messages.selector);
+    assert.equal($messages.length, 0);
+    done();
+  });
+});

Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/06-validation/01/validation-jsr303.test.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/06-validation/01/validation-jsr303.test.js?rev=1753532&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/06-validation/01/validation-jsr303.test.js (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/06-validation/01/validation-jsr303.test.js Wed Jul 20 15:03:51 2016
@@ -0,0 +1,110 @@
+/*
+ * 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("Required: Submit without content.", function (assert) {
+  assert.expect(1);
+  var done = assert.async();
+
+  var $messages = jQueryFrame("#page\\:messages .tobago-messages");
+  var $in = jQueryFrame("#page\\:mainForm\\:required\\:in\\:\\:field");
+  var $submit = jQueryFrame("#page\\:mainForm\\:required\\:submit");
+
+  $in.val("");
+  $submit.click();
+
+  jQuery("#page\\:testframe").load(function () {
+    $messages = jQueryFrame($messages.selector);
+    assert.equal($messages.length, 1);
+    done();
+  });
+});
+
+QUnit.test("Required: Submit with content.", function (assert) {
+  assert.expect(1);
+  var done = assert.async();
+
+  var $messages = jQueryFrame("#page\\:messages .tobago-messages");
+  var $in = jQueryFrame("#page\\:mainForm\\:required\\:in\\:\\:field");
+  var $submit = jQueryFrame("#page\\:mainForm\\:required\\:submit");
+
+  $in.val("some content");
+  $submit.click();
+
+  jQuery("#page\\:testframe").load(function () {
+    $messages = jQueryFrame($messages.selector);
+    assert.equal($messages.length, 0);
+    done();
+  });
+});
+
+QUnit.test("Length: Submit single character.", function (assert) {
+  assert.expect(1);
+  var done = assert.async();
+
+  var $messages = jQueryFrame("#page\\:messages .tobago-messages");
+  var $in = jQueryFrame("#page\\:mainForm\\:length\\:in\\:\\:field");
+  var $submit = jQueryFrame("#page\\:mainForm\\:length\\:submit");
+
+  $in.val("a");
+  $submit.click();
+
+  jQuery("#page\\:testframe").load(function () {
+    $messages = jQueryFrame($messages.selector);
+    assert.equal($messages.length, 1);
+    done();
+  });
+});
+
+QUnit.test("Length: Submit three characters.", function (assert) {
+  assert.expect(1);
+  var done = assert.async();
+
+  var $messages = jQueryFrame("#page\\:messages .tobago-messages");
+  var $in = jQueryFrame("#page\\:mainForm\\:length\\:in\\:\\:field");
+  var $submit = jQueryFrame("#page\\:mainForm\\:length\\:submit");
+
+  $in.val("abc");
+  $submit.click();
+
+  jQuery("#page\\:testframe").load(function () {
+    $messages = jQueryFrame($messages.selector);
+    assert.equal($messages.length, 0);
+    done();
+  });
+});
+
+QUnit.test("Length: Submit five characters.", function (assert) {
+  assert.expect(1);
+  var done = assert.async();
+
+  var $messages = jQueryFrame("#page\\:messages .tobago-messages");
+  var $in = jQueryFrame("#page\\:mainForm\\:length\\:in\\:\\:field");
+  var $submit = jQueryFrame("#page\\:mainForm\\:length\\:submit");
+
+  $in.val("abcde");
+  $submit.click();
+
+  jQuery("#page\\:testframe").load(function () {
+    $messages = jQueryFrame($messages.selector);
+    assert.equal($messages.length, 1);
+    done();
+  });
+});

Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/51-for-each/for-each.test.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/51-for-each/for-each.test.js?rev=1753532&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/51-for-each/for-each.test.js (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/51-for-each/for-each.test.js Wed Jul 20 15:03:51 2016
@@ -0,0 +1,77 @@
+/*
+ * 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("Add a river and reset.", function (assert) {
+  assert.expect(6);
+  var done = assert.async(3);
+  var step = 1;
+
+  var $name = jQueryFrame("#page\\:mainForm\\:add\\:inName\\:\\:field");
+  var $length = jQueryFrame("#page\\:mainForm\\:add\\:inLength\\:\\:field");
+  var $discharge = jQueryFrame("#page\\:mainForm\\:add\\:inDischarge\\:\\:field");
+  var $add = jQueryFrame("#page\\:mainForm\\:add\\:button");
+  var $reset = jQueryFrame("#page\\:mainForm\\:reset\\:button");
+  var $forEachBoxes = jQueryFrame("#page\\:mainForm\\:forEach .tobago-box");
+  var $uiRepeatSections = jQueryFrame("#page\\:mainForm\\:uiRepeat .tobago-section");
+
+  $reset.click();
+
+  jQuery("#page\\:testframe").load(function () {
+    if (step == 1) {
+      $name = jQueryFrame($name.selector);
+      $length = jQueryFrame($length.selector);
+      $discharge = jQueryFrame($discharge.selector);
+      $add = jQueryFrame($add.selector);
+      $forEachBoxes = jQueryFrame($forEachBoxes.selector);
+      $uiRepeatSections = jQueryFrame($uiRepeatSections.selector);
+
+      assert.equal($forEachBoxes.length, 3);
+      assert.equal($uiRepeatSections.length, 3);
+
+      $name.val("Mississippi");
+      $length.val("6275");
+      $discharge.val("16200");
+      $add.click();
+
+      done();
+    } else if (step == 2) {
+      $reset = jQueryFrame($reset.selector);
+      $forEachBoxes = jQueryFrame($forEachBoxes.selector);
+      $uiRepeatSections = jQueryFrame($uiRepeatSections.selector);
+
+      assert.equal($forEachBoxes.length, 4);
+      assert.equal($uiRepeatSections.length, 4);
+
+      $reset.click();
+
+      done();
+    } else if (step == 3) {
+      $forEachBoxes = jQueryFrame($forEachBoxes.selector);
+      $uiRepeatSections = jQueryFrame($uiRepeatSections.selector);
+
+      assert.equal($forEachBoxes.length, 3);
+      assert.equal($uiRepeatSections.length, 3);
+
+      done();
+    }
+    step++;
+  });
+});

Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/00-collapsible-box/collapsible-box.test.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/00-collapsible-box/collapsible-box.test.js?rev=1753532&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/00-collapsible-box/collapsible-box.test.js (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/00-collapsible-box/collapsible-box.test.js Wed Jul 20 15:03:51 2016
@@ -0,0 +1,393 @@
+/*
+ * 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("Simple Collapsible Box: show -> hide transition", function (assert) {
+  assert.expect(2);
+  var done = assert.async(2);
+  var step = 1;
+
+  $show = jQueryFrame("#page\\:mainForm\\:controller\\:show");
+  $hide = jQueryFrame("#page\\:mainForm\\:controller\\:hide");
+  $content = jQueryFrame("#page\\:mainForm\\:controller\\:content");
+
+  $show.click();
+
+  jQuery("#page\\:testframe").load(function () {
+    if (step == 1) {
+      $hide = jQueryFrame($hide.selector);
+      $content = jQueryFrame($content.selector);
+
+      assert.equal($content.length, 1);
+      $hide.click();
+
+      done();
+    } else if (step == 2) {
+      $content = jQueryFrame($content.selector);
+
+      assert.equal($content.length, 0);
+
+      done();
+    }
+    step++;
+  });
+});
+
+QUnit.test("Simple Collapsible Box: hide -> show transition", function (assert) {
+  assert.expect(2);
+  var done = assert.async(2);
+  var step = 1;
+
+  $show = jQueryFrame("#page\\:mainForm\\:controller\\:show");
+  $hide = jQueryFrame("#page\\:mainForm\\:controller\\:hide");
+  $content = jQueryFrame("#page\\:mainForm\\:controller\\:content");
+
+  $hide.click();
+
+  jQuery("#page\\:testframe").load(function () {
+    if (step == 1) {
+      $show = jQueryFrame($show.selector);
+      $content = jQueryFrame($content.selector);
+
+      assert.equal($content.length, 0);
+      $show.click();
+
+      done();
+    } else if (step == 2) {
+      $content = jQueryFrame($content.selector);
+
+      assert.equal($content.length, 1);
+
+      done();
+    }
+    step++;
+  });
+});
+
+QUnit.test("Full Server Request: open both boxes", function (assert) {
+  assert.expect(4);
+  var done = assert.async(2);
+  var step = 1;
+
+  $show1 = jQueryFrame("#page\\:mainForm\\:server\\:show1");
+  $show2 = jQueryFrame("#page\\:mainForm\\:server\\:show2");
+  $content1 = jQueryFrame("#page\\:mainForm\\:server\\:content1");
+  $content2 = jQueryFrame("#page\\:mainForm\\:server\\:content2");
+  content2Length = $content2.length;
+
+  $show1.click();
+
+  jQuery("#page\\:testframe").load(function () {
+    if (step == 1) {
+      $show2 = jQueryFrame($show2.selector);
+      $content1 = jQueryFrame($content1.selector);
+      $content2 = jQueryFrame($content2.selector);
+
+      assert.equal($content1.length, 1);
+      assert.equal($content2.length, content2Length);
+      $show2.click();
+
+      done();
+    } else if (step == 2) {
+      $content1 = jQueryFrame($content1.selector);
+      $content2 = jQueryFrame($content2.selector);
+
+      assert.equal($content1.length, 1);
+      assert.equal($content2.length, 1);
+
+      done();
+    }
+    step++;
+  });
+});
+
+QUnit.test("Full Server Request: open box 1, close box 2", function (assert) {
+  assert.expect(4);
+  var done = assert.async(2);
+  var step = 1;
+
+  $show1 = jQueryFrame("#page\\:mainForm\\:server\\:show1");
+  $hide2 = jQueryFrame("#page\\:mainForm\\:server\\:hide2");
+  $content1 = jQueryFrame("#page\\:mainForm\\:server\\:content1");
+  $content2 = jQueryFrame("#page\\:mainForm\\:server\\:content2");
+  content2Length = $content2.length;
+
+  $show1.click();
+
+  jQuery("#page\\:testframe").load(function () {
+    if (step == 1) {
+      $hide2 = jQueryFrame($hide2.selector);
+      $content1 = jQueryFrame($content1.selector);
+      $content2 = jQueryFrame($content2.selector);
+
+      assert.equal($content1.length, 1);
+      assert.equal($content2.length, content2Length);
+      $hide2.click();
+
+      done();
+    } else if (step == 2) {
+      $content1 = jQueryFrame($content1.selector);
+      $content2 = jQueryFrame($content2.selector);
+
+      assert.equal($content1.length, 1);
+      assert.equal($content2.length, 0);
+
+      done();
+    }
+    step++;
+  });
+});
+
+QUnit.test("Full Server Request: close box 1, open box 2", function (assert) {
+  assert.expect(4);
+  var done = assert.async(2);
+  var step = 1;
+
+  $hide1 = jQueryFrame("#page\\:mainForm\\:server\\:hide1");
+  $show2 = jQueryFrame("#page\\:mainForm\\:server\\:show2");
+  $content1 = jQueryFrame("#page\\:mainForm\\:server\\:content1");
+  $content2 = jQueryFrame("#page\\:mainForm\\:server\\:content2");
+  content2Length = $content2.length;
+
+  $hide1.click();
+
+  jQuery("#page\\:testframe").load(function () {
+    if (step == 1) {
+      $show2 = jQueryFrame($show2.selector);
+      $content1 = jQueryFrame($content1.selector);
+      $content2 = jQueryFrame($content2.selector);
+
+      assert.equal($content1.length, 0);
+      assert.equal($content2.length, content2Length);
+      $show2.click();
+
+      done();
+    } else if (step == 2) {
+      $content1 = jQueryFrame($content1.selector);
+      $content2 = jQueryFrame($content2.selector);
+
+      assert.equal($content1.length, 0);
+      assert.equal($content2.length, 1);
+
+      done();
+    }
+    step++;
+  });
+});
+
+QUnit.test("Full Server Request: close both boxes", function (assert) {
+  assert.expect(4);
+  var done = assert.async(2);
+  var step = 1;
+
+  $hide1 = jQueryFrame("#page\\:mainForm\\:server\\:hide1");
+  $hide2 = jQueryFrame("#page\\:mainForm\\:server\\:hide2");
+  $content1 = jQueryFrame("#page\\:mainForm\\:server\\:content1");
+  $content2 = jQueryFrame("#page\\:mainForm\\:server\\:content2");
+  content2Length = $content2.length;
+
+  $hide1.click();
+
+  jQuery("#page\\:testframe").load(function () {
+    if (step == 1) {
+      $hide2 = jQueryFrame($hide2.selector);
+      $content1 = jQueryFrame($content1.selector);
+      $content2 = jQueryFrame($content2.selector);
+
+      assert.equal($content1.length, 0);
+      assert.equal($content2.length, content2Length);
+      $hide2.click();
+
+      done();
+    } else if (step == 2) {
+      $content1 = jQueryFrame($content1.selector);
+      $content2 = jQueryFrame($content2.selector);
+
+      assert.equal($content1.length, 0);
+      assert.equal($content2.length, 0);
+
+      done();
+    }
+    step++;
+  });
+});
+
+QUnit.test("Client Sided: show -> hide transition", function (assert) {
+  assert.expect(2);
+
+  $show = jQueryFrame("#page\\:mainForm\\:client\\:show");
+  $hide = jQueryFrame("#page\\:mainForm\\:client\\:hide");
+  $box = jQueryFrame("#page\\:mainForm\\:client\\:noRequestBox");
+
+  $show.click();
+  assert.equal($box.hasClass("tobago-collapsed"), false);
+
+  $hide.click();
+  assert.equal($box.hasClass("tobago-collapsed"), true);
+});
+
+QUnit.test("Client Sided: hide -> show transition", function (assert) {
+  assert.expect(2);
+
+  $show = jQueryFrame("#page\\:mainForm\\:client\\:show");
+  $hide = jQueryFrame("#page\\:mainForm\\:client\\:hide");
+  $box = jQueryFrame("#page\\:mainForm\\:client\\:noRequestBox");
+
+  $hide.click();
+  assert.equal($box.hasClass("tobago-collapsed"), true);
+
+  $show.click();
+  assert.equal($box.hasClass("tobago-collapsed"), false);
+});
+
+QUnit.test("Client Sided: hide content and submit empty string", function (assert) {
+  assert.expect(2);
+  var done = assert.async();
+
+  $messages = jQueryFrame("#page\\:messages .tobago-messages");
+  $show = jQueryFrame("#page\\:mainForm\\:client\\:show");
+  $hide = jQueryFrame("#page\\:mainForm\\:client\\:hide");
+  $box = jQueryFrame("#page\\:mainForm\\:client\\:noRequestBox");
+  $in = jQueryFrame("#page\\:mainForm\\:client\\:in\\:\\:field");
+  $submit = jQueryFrame("#page\\:mainForm\\:client\\:submit");
+
+  $hide.click();
+  assert.equal($box.hasClass("tobago-collapsed"), true);
+
+  $in.val("");
+  $submit.click();
+
+  jQuery("#page\\:testframe").load(function () {
+    $messages = jQueryFrame($messages.selector);
+    assert.equal($messages.length, 1);
+    done();
+  });
+});
+
+QUnit.test("Ajax: show -> hide transition", function (assert) {
+  assert.expect(2);
+  var done = assert.async(2);
+
+  $show = jQueryFrame("#page\\:mainForm\\:ajax\\:show");
+  $hide = jQueryFrame("#page\\:mainForm\\:ajax\\:hide");
+  $in = jQueryFrame("#page\\:mainForm\\:ajax\\:in\\:\\:field");
+
+  $show.click();
+
+  $.ajax({
+    type: 'GET',
+    url: 'content/30-concept/53-collapsible/00-collapsible-box/collapsible-box.xhtml'
+  }).done(function () {
+    $hide = jQueryFrame($hide.selector);
+    $in = jQueryFrame($in.selector);
+
+    assert.equal($in.length, 1);
+    $hide.click();
+
+    $.ajax({
+      type: 'GET',
+      url: 'content/30-concept/53-collapsible/00-collapsible-box/collapsible-box.xhtml'
+    }).done(function () {
+      $in = jQueryFrame($in.selector);
+      assert.equal($in.length, 0);
+      done();
+    });
+
+    done();
+  });
+});
+
+QUnit.test("Ajax: hide -> show transition", function (assert) {
+  assert.expect(2);
+  var done = assert.async(2);
+
+  $show = jQueryFrame("#page\\:mainForm\\:ajax\\:show");
+  $hide = jQueryFrame("#page\\:mainForm\\:ajax\\:hide");
+  $in = jQueryFrame("#page\\:mainForm\\:ajax\\:in\\:\\:field");
+
+  $hide.click();
+
+  $.ajax({
+    type: 'GET',
+    url: 'content/30-concept/53-collapsible/00-collapsible-box/collapsible-box.xhtml'
+  }).done(function () {
+    $show = jQueryFrame($show.selector);
+    $in = jQueryFrame($in.selector);
+
+    assert.equal($in.length, 0);
+    $show.click();
+
+    $.ajax({
+      type: 'GET',
+      url: 'content/30-concept/53-collapsible/00-collapsible-box/collapsible-box.xhtml'
+    }).done(function () {
+      $in = jQueryFrame($in.selector);
+      assert.equal($in.length, 1);
+      done();
+    });
+
+    done();
+  });
+});
+
+QUnit.test("Client Sided: hide content and submit empty string", function (assert) {
+  assert.expect(3);
+  var done = assert.async(3);
+
+  $messages = jQueryFrame("#page\\:messages .tobago-messages");
+  $show = jQueryFrame("#page\\:mainForm\\:ajax\\:show");
+  $hide = jQueryFrame("#page\\:mainForm\\:ajax\\:hide");
+  $in = jQueryFrame("#page\\:mainForm\\:ajax\\:in\\:\\:field");
+  $submit = jQueryFrame("#page\\:mainForm\\:ajax\\:submit");
+
+  $show.click();
+
+  $.ajax({
+    type: 'GET',
+    url: 'content/30-concept/53-collapsible/00-collapsible-box/collapsible-box.xhtml'
+  }).done(function () {
+    $hide = jQueryFrame($hide.selector);
+    $in = jQueryFrame($in.selector);
+
+    assert.equal($in.length, 1);
+    $in.val("");
+    $hide.click();
+
+    $.ajax({
+      type: 'GET',
+      url: 'content/30-concept/53-collapsible/00-collapsible-box/collapsible-box.xhtml'
+    }).done(function () {
+      $in = jQueryFrame($in.selector);
+      $submit = jQueryFrame($submit.selector);
+
+      assert.equal($in.length, 0);
+      $submit.click();
+      done();
+    });
+
+    done();
+  });
+
+  jQuery("#page\\:testframe").load(function () {
+    $messages = jQueryFrame($messages.selector);
+    assert.equal($messages.length, 0);
+    done();
+  });
+});

Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/10-collapsible-popup/collapsible-popup.test.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/10-collapsible-popup/collapsible-popup.test.js?rev=1753532&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/10-collapsible-popup/collapsible-popup.test.js (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/10-collapsible-popup/collapsible-popup.test.js Wed Jul 20 15:03:51 2016
@@ -0,0 +1,211 @@
+/*
+ * 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("Simple Popup", function (assert) {
+  assert.expect(9);
+  var done = assert.async(5);
+  var step = 1;
+
+  var $messages = jQueryFrame("#page\\:messages .tobago-messages");
+  var $open = jQueryFrame("#page\\:mainForm\\:simple\\:open");
+  var $submitOnPage = jQueryFrame("#page\\:mainForm\\:simple\\:submitOnPage");
+  var $in = jQueryFrame("#page\\:mainForm\\:simple\\:controllerPopup\\:in\\:\\:field");
+  var $submitOnPopup = jQueryFrame("#page\\:mainForm\\:simple\\:controllerPopup\\:submitOnPopup");
+  var $close = jQueryFrame("#page\\:mainForm\\:simple\\:controllerPopup\\:close");
+
+  $open.click();
+
+  jQuery("#page\\:testframe").load(function () {
+    if (step == 1) {
+      $in = jQueryFrame($in.selector);
+      $submitOnPopup = jQueryFrame($submitOnPopup.selector);
+
+      assert.equal($in.length, 1);
+      $in.val("some text");
+      $submitOnPopup.click();
+
+      done();
+    } else if (step == 2) {
+      $messages = jQueryFrame($messages.selector);
+      $in = jQueryFrame($in.selector);
+      $submitOnPopup = jQueryFrame($submitOnPopup.selector);
+
+      assert.equal($messages.length, 0);
+      assert.equal($in.length, 1);
+      assert.equal($in.val(), "some text");
+      $in.val("");
+      $submitOnPopup.click();
+
+      done();
+    } else if (step == 3) {
+      $messages = jQueryFrame($messages.selector);
+      $in = jQueryFrame($in.selector);
+      $close = jQueryFrame($close.selector);
+
+      assert.equal($messages.length, 1);
+      assert.equal($in.length, 1);
+      assert.equal($in.val(), "");
+      $close.click();
+
+      done();
+    } else if (step == 4) {
+      $submitOnPage = jQueryFrame($submitOnPage.selector);
+      $in = jQueryFrame($in.selector);
+
+      assert.equal($in.length, 0);
+      $submitOnPage.click();
+
+      done();
+    } else if (step == 5) {
+      $messages = jQueryFrame($messages.selector);
+
+      assert.equal($messages.length, 0);
+
+      done();
+    }
+    step++;
+  });
+});
+
+QUnit.test("Full Server Request", function (assert) {
+  assert.expect(9);
+  var done = assert.async(5);
+  var step = 1;
+
+  var $messages = jQueryFrame("#page\\:messages .tobago-messages");
+  var $open = jQueryFrame("#page\\:mainForm\\:server\\:open");
+  var $submitOnPage = jQueryFrame("#page\\:mainForm\\:server\\:submitOnPage");
+  var $in = jQueryFrame("#page\\:mainForm\\:server\\:fullServerRequestPopup\\:in\\:\\:field");
+  var $submitOnPopup = jQueryFrame("#page\\:mainForm\\:server\\:fullServerRequestPopup\\:submitOnPopup");
+  var $close = jQueryFrame("#page\\:mainForm\\:server\\:fullServerRequestPopup\\:close");
+
+  $open.click();
+
+  jQuery("#page\\:testframe").load(function () {
+    if (step == 1) {
+      $in = jQueryFrame($in.selector);
+      $submitOnPopup = jQueryFrame($submitOnPopup.selector);
+
+      assert.equal($in.length, 1);
+      $in.val("some text");
+      $submitOnPopup.click();
+
+      done();
+    } else if (step == 2) {
+      $messages = jQueryFrame($messages.selector);
+      $in = jQueryFrame($in.selector);
+      $submitOnPopup = jQueryFrame($submitOnPopup.selector);
+
+      assert.equal($messages.length, 0);
+      assert.equal($in.length, 1);
+      assert.equal($in.val(), "some text");
+      $in.val("");
+      $submitOnPopup.click();
+
+      done();
+    } else if (step == 3) {
+      $messages = jQueryFrame($messages.selector);
+      $in = jQueryFrame($in.selector);
+      $close = jQueryFrame($close.selector);
+
+      assert.equal($messages.length, 1);
+      assert.equal($in.length, 1);
+      assert.equal($in.val(), "");
+      $close.click();
+
+      done();
+    } else if (step == 4) {
+      $submitOnPage = jQueryFrame($submitOnPage.selector);
+      $in = jQueryFrame($in.selector);
+
+      assert.equal($in.length, 0);
+      $submitOnPage.click();
+
+      done();
+    } else if (step == 5) {
+      $messages = jQueryFrame($messages.selector);
+
+      assert.equal($messages.length, 0);
+
+      done();
+    }
+    step++;
+  });
+});
+
+QUnit.test("Client Sided", function (assert) {
+  assert.expect(9);
+  var done = assert.async(3);
+  var step = 1;
+
+  var $messages = jQueryFrame("#page\\:messages .tobago-messages");
+  var $open = jQueryFrame("#page\\:mainForm\\:client\\:open");
+  var $submitOnPage = jQueryFrame("#page\\:mainForm\\:client\\:submitOnPage");
+  var $popupCollapsed = jQueryFrame("#page\\:mainForm\\:client\\:clientPopup\\:\\:collapse");
+  var $in = jQueryFrame("#page\\:mainForm\\:client\\:clientPopup\\:in\\:\\:field");
+  var $submitOnPopup = jQueryFrame("#page\\:mainForm\\:client\\:clientPopup\\:submitOnPopup");
+  var $close = jQueryFrame("#page\\:mainForm\\:client\\:clientPopup\\:close");
+
+  $open.click();
+  assert.equal($popupCollapsed.val(), "false");
+  $close.click();
+  assert.equal($popupCollapsed.val(), "true");
+  $open.click();
+  assert.equal($popupCollapsed.val(), "false");
+  $in.val("some text");
+  $submitOnPopup.click();
+
+  jQuery("#page\\:testframe").load(function () {
+    if (step == 1) {
+      $messages = jQueryFrame($messages.selector);
+      $open = jQueryFrame($open.selector);
+      $popupCollapsed = jQueryFrame($popupCollapsed.selector);
+      $in = jQueryFrame($in.selector);
+      $submitOnPopup = jQueryFrame($submitOnPopup.selector);
+
+      assert.equal($messages.length, 0);
+      assert.equal($popupCollapsed.val(), "true");
+      $open.click();
+      assert.equal($popupCollapsed.val(), "false");
+      $in.val("");
+      $submitOnPopup.click();
+
+      done();
+    } else if (step == 2) {
+      $messages = jQueryFrame($messages.selector);
+      $submitOnPage = jQueryFrame($submitOnPage.selector);
+      $popupCollapsed = jQueryFrame($popupCollapsed.selector);
+
+      assert.equal($messages.length, 1);
+      assert.equal($popupCollapsed.val(), "true");
+      $submitOnPage.click();
+
+      done();
+    } else if (step == 3) {
+      $messages = jQueryFrame($messages.selector);
+
+      assert.equal($messages.length, 1);
+
+      done();
+    }
+    step++;
+  });
+});

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/test/java/org/apache/myfaces/tobago/example/demo/QUnitTests.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/test/java/org/apache/myfaces/tobago/example/demo/QUnitTests.java?rev=1753532&r1=1753531&r2=1753532&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/test/java/org/apache/myfaces/tobago/example/demo/QUnitTests.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/test/java/org/apache/myfaces/tobago/example/demo/QUnitTests.java Wed Jul 20 15:03:51 2016
@@ -244,6 +244,24 @@ public class QUnitTests {
   }
 
   @Test
+  public void popup() throws UnsupportedEncodingException {
+    String page = "content/20-component/060-popup/popup.xhtml";
+    runStandardTest(page);
+  }
+
+  @Test
+  public void contentValidation() throws UnsupportedEncodingException {
+    String page = "content/30-concept/06-validation/00/content-validation.xhtml";
+    runStandardTest(page);
+  }
+
+  @Test
+  public void validationJsr303() throws UnsupportedEncodingException {
+    String page = "content/30-concept/06-validation/01/validation-jsr303.xhtml";
+    runStandardTest(page);
+  }
+
+  @Test
   public void form() throws UnsupportedEncodingException {
     String page = "content/30-concept/08-form/form.xhtml";
     runStandardTest(page);
@@ -261,6 +279,18 @@ public class QUnitTests {
     runStandardTest(page);
   }
 
+  @Test
+  public void collapsibleBox() throws UnsupportedEncodingException {
+    String page = "content/30-concept/53-collapsible/00-collapsible-box/collapsible-box.xhtml";
+    runStandardTest(page);
+  }
+
+  @Test
+  public void collapsiblePopup() throws UnsupportedEncodingException {
+    String page = "content/30-concept/53-collapsible/10-collapsible-popup/collapsible-popup.xhtml";
+    runStandardTest(page);
+  }
+
   @Test
   public void testDate() throws UnsupportedEncodingException {
     String page = "content/40-test/1040-date/date.xhtml";



Mime
View raw message