You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by hn...@apache.org on 2017/11/24 10:26:02 UTC

[myfaces-tobago] branch master updated (a589627 -> 42620eb)

This is an automated email from the ASF dual-hosted git repository.

hnoeth pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git.


    from a589627  fix segmentLeft segmentRight * fix a bug where the ID-suffix '::label' is set on the component instead of the label
     new 4776643  improve tests * label and markups are test for labelLayout="x"
     new 42620eb  TOBAGO-1826 Possibility to access the "markup"s via JavaScript * fix labelLayout="skip" for tc:in

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../internal/renderkit/renderer/InRenderer.java    |  4 +-
 .../100-id-markup/id-markup.test.js                | 65 ++++++++++++++++------
 2 files changed, 51 insertions(+), 18 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
['"commits@myfaces.apache.org" <co...@myfaces.apache.org>'].

[myfaces-tobago] 01/02: improve tests * label and markups are test for labelLayout="x"

Posted by hn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hnoeth pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git

commit 47766431899f33645da557d29fe90432341b324a
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Fri Nov 24 11:24:14 2017 +0100

    improve tests
    * label and markups are test for labelLayout="x"
---
 .../100-id-markup/id-markup.test.js                | 65 ++++++++++++++++------
 1 file changed, 48 insertions(+), 17 deletions(-)

diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4800-labelLayout/100-id-markup/id-markup.test.js b/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4800-labelLayout/100-id-markup/id-markup.test.js
index 1e1ba72..d45a7a2 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4800-labelLayout/100-id-markup/id-markup.test.js
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4800-labelLayout/100-id-markup/id-markup.test.js
@@ -16,7 +16,7 @@
  */
 
 QUnit.test("No label set", function (assert) {
-  assert.expect(3);
+  assert.expect(5);
 
   var $section = jQueryFrame("#page\\:mainForm\\:sectionNoLabel");
   var $rootDiv = $section.find(".tobago-section-content > div");
@@ -24,15 +24,15 @@ QUnit.test("No label set", function (assert) {
   var $input = $rootDiv.find("input");
 
   assert.equal($rootDiv.attr('id'), "page:mainForm:inNoLabel");
-  // TODO test label and markups
-  // assert.equal(jQuery.parseJSON($rootDiv.attr('data-tobago-markup'))[0], "testmarkup");
-  // assert.equal($label.length, 0);
+  assert.equal($label.length, 0);
   assert.equal($input.attr('id'), "page:mainForm:inNoLabel::field");
   assert.equal($input.attr('name'), "page:mainForm:inNoLabel");
+
+  assert.equal(jQuery.parseJSON($rootDiv.attr('data-tobago-markup'))[0], "testmarkup");
 });
 
 QUnit.test("labelLayout=none", function (assert) {
-  assert.expect(3);
+  assert.expect(5);
 
   var $section = jQueryFrame("#page\\:mainForm\\:sectionNone");
   var $rootDiv = $section.find(".tobago-section-content > div");
@@ -40,23 +40,28 @@ QUnit.test("labelLayout=none", function (assert) {
   var $input = $rootDiv.find("input");
 
   assert.equal($rootDiv.attr('id'), "page:mainForm:inNone");
-  // assert.equal(jQuery.parseJSON($rootDiv.attr('data-tobago-markup'))[0], "testmarkup");
-  // assert.equal($label.length, 0);
+  assert.equal($label.length, 0);
   assert.equal($input.attr('id'), "page:mainForm:inNone::field");
   assert.equal($input.attr('name'), "page:mainForm:inNone");
+
+  assert.equal(jQuery.parseJSON($rootDiv.attr('data-tobago-markup'))[0], "testmarkup");
 });
 
 QUnit.test("labelLayout=skip", function (assert) {
-  assert.expect(1);
+  assert.expect(3);
 
   var $section = jQueryFrame("#page\\:mainForm\\:sectionSkip");
   var $rootInput = $section.find(".tobago-section-content > input");
+  var $label = $section.find("label");
 
+  assert.equal($label.length, 0);
   assert.equal($rootInput.attr('id'), "page:mainForm:inSkip");
+
+  assert.equal(jQuery.parseJSON($rootInput.attr('data-tobago-markup'))[0], "testmarkup");
 });
 
 QUnit.test("labelLayout=top", function (assert) {
-  assert.expect(3);
+  assert.expect(5);
 
   var $section = jQueryFrame("#page\\:mainForm\\:sectionTop");
   var $rootDiv = $section.find(".tobago-section-content > div");
@@ -64,14 +69,15 @@ QUnit.test("labelLayout=top", function (assert) {
   var $input = $rootDiv.find("input");
 
   assert.equal($rootDiv.attr('id'), "page:mainForm:inTop");
-  // assert.equal(jQuery.parseJSON($rootDiv.attr('data-tobago-markup'))[0], "testmarkup");
-  // assert.equal($label.length, 0);
+  assert.equal($label.attr('for'), "page:mainForm:inTop::field");
   assert.equal($input.attr('id'), "page:mainForm:inTop::field");
   assert.equal($input.attr('name'), "page:mainForm:inTop");
+
+  assert.equal(jQuery.parseJSON($rootDiv.attr('data-tobago-markup'))[0], "testmarkup");
 });
 
 QUnit.test("labelLayout=flowLeft", function (assert) {
-  assert.expect(3);
+  assert.expect(5);
 
   var $section = jQueryFrame("#page\\:mainForm\\:sectionFlowLeft");
   var $rootDiv = $section.find(".tobago-section-content > div");
@@ -79,12 +85,15 @@ QUnit.test("labelLayout=flowLeft", function (assert) {
   var $input = $rootDiv.find("input");
 
   assert.equal($rootDiv.attr('id'), "page:mainForm:inFlowLeft");
+  assert.equal($label.attr('for'), "page:mainForm:inFlowLeft::field");
   assert.equal($input.attr('id'), "page:mainForm:inFlowLeft::field");
   assert.equal($input.attr('name'), "page:mainForm:inFlowLeft");
+
+  assert.equal(jQuery.parseJSON($rootDiv.attr('data-tobago-markup'))[0], "testmarkup");
 });
 
 QUnit.test("labelLayout=flowRight", function (assert) {
-  assert.expect(3);
+  assert.expect(5);
 
   var $section = jQueryFrame("#page\\:mainForm\\:sectionFlowRight");
   var $rootDiv = $section.find(".tobago-section-content > div");
@@ -92,12 +101,15 @@ QUnit.test("labelLayout=flowRight", function (assert) {
   var $input = $rootDiv.find("input");
 
   assert.equal($rootDiv.attr('id'), "page:mainForm:inFlowRight");
+  assert.equal($label.attr('for'), "page:mainForm:inFlowRight::field");
   assert.equal($input.attr('id'), "page:mainForm:inFlowRight::field");
   assert.equal($input.attr('name'), "page:mainForm:inFlowRight");
+
+  assert.equal(jQuery.parseJSON($rootDiv.attr('data-tobago-markup'))[0], "testmarkup");
 });
 
 QUnit.test("labelLayout=flexLeft", function (assert) {
-  assert.expect(3);
+  assert.expect(5);
 
   var $section = jQueryFrame("#page\\:mainForm\\:sectionFlexLeft");
   var $rootDiv = $section.find(".tobago-section-content > div");
@@ -105,12 +117,15 @@ QUnit.test("labelLayout=flexLeft", function (assert) {
   var $input = $rootDiv.find("input");
 
   assert.equal($rootDiv.attr('id'), "page:mainForm:inFlexLeft");
+  assert.equal($label.attr('for'), "page:mainForm:inFlexLeft::field");
   assert.equal($input.attr('id'), "page:mainForm:inFlexLeft::field");
   assert.equal($input.attr('name'), "page:mainForm:inFlexLeft");
+
+  assert.equal(jQuery.parseJSON($rootDiv.attr('data-tobago-markup'))[0], "testmarkup");
 });
 
 QUnit.test("labelLayout=flexRight", function (assert) {
-  assert.expect(3);
+  assert.expect(5);
 
   var $section = jQueryFrame("#page\\:mainForm\\:sectionFlexRight");
   var $rootDiv = $section.find(".tobago-section-content > div");
@@ -118,12 +133,15 @@ QUnit.test("labelLayout=flexRight", function (assert) {
   var $input = $rootDiv.find("input");
 
   assert.equal($rootDiv.attr('id'), "page:mainForm:inFlexRight");
+  assert.equal($label.attr('for'), "page:mainForm:inFlexRight::field");
   assert.equal($input.attr('id'), "page:mainForm:inFlexRight::field");
   assert.equal($input.attr('name'), "page:mainForm:inFlexRight");
+
+  assert.equal(jQuery.parseJSON($rootDiv.attr('data-tobago-markup'))[0], "testmarkup");
 });
 
 QUnit.test("labelLayout=segmentLeft", function (assert) {
-  assert.expect(5);
+  assert.expect(7);
 
   var $section = jQueryFrame("#page\\:mainForm\\:sectionSegmentLeft");
   var $segmentLayout = $section.find(".tobago-section-content > div");
@@ -137,10 +155,13 @@ QUnit.test("labelLayout=segmentLeft", function (assert) {
   assert.equal($inputSegment.attr('id'), "page:mainForm:inSegmentLeft");
   assert.equal($input.attr('id'), "page:mainForm:inSegmentLeft::field");
   assert.equal($input.attr('name'), "page:mainForm:inSegmentLeft");
+
+  assert.equal(jQuery.parseJSON($labelSegment.attr('data-tobago-markup'))[0], "testmarkup");
+  assert.equal(jQuery.parseJSON($inputSegment.attr('data-tobago-markup'))[0], "testmarkup");
 });
 
 QUnit.test("labelLayout=segmentRight", function (assert) {
-  assert.expect(5);
+  assert.expect(7);
 
   var $section = jQueryFrame("#page\\:mainForm\\:sectionSegmentRight");
   var $segmentLayout = $section.find(".tobago-section-content > div");
@@ -154,4 +175,14 @@ QUnit.test("labelLayout=segmentRight", function (assert) {
   assert.equal($inputSegment.attr('id'), "page:mainForm:inSegmentRight");
   assert.equal($input.attr('id'), "page:mainForm:inSegmentRight::field");
   assert.equal($input.attr('name'), "page:mainForm:inSegmentRight");
+
+  assert.equal(jQuery.parseJSON($labelSegment.attr('data-tobago-markup'))[0], "testmarkup");
+  assert.equal(jQuery.parseJSON($inputSegment.attr('data-tobago-markup'))[0], "testmarkup");
+});
+
+QUnit.test("Number of data-tobago-markup attributes", function (assert) {
+  assert.expect(1);
+
+  var $dataTobagoMarkups = jQueryFrame("#page\\:content .tobago-section-content [data-tobago-markup]");
+  assert.equal($dataTobagoMarkups.length, 12, "Two for segment layout components, one for all other components");
 });

-- 
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <co...@myfaces.apache.org>.

[myfaces-tobago] 02/02: TOBAGO-1826 Possibility to access the "markup"s via JavaScript * fix labelLayout="skip" for tc:in

Posted by hn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hnoeth pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git

commit 42620eb9c7c753307e512ea9a0897517891b83f3
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Fri Nov 24 11:25:24 2017 +0100

    TOBAGO-1826 Possibility to access the "markup"s via JavaScript
    * fix labelLayout="skip" for tc:in
---
 .../apache/myfaces/tobago/internal/renderkit/renderer/InRenderer.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/InRenderer.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/InRenderer.java
index 7c67348..ea8c7ca 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/InRenderer.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/InRenderer.java
@@ -84,7 +84,6 @@ public class InRenderer extends MessageLayoutRendererBase {
       writer.startElement(HtmlElements.DIV); // Wrapping the field to fix input groups with flexLeft/flexRight
       if (input.isLabelLayoutSkip()) {
         writer.writeIdAttribute(clientId);
-        writer.writeAttribute(DataAttributes.MARKUP, JsonUtils.encode(markup), false);
       }
       writer.writeClassAttribute(TobagoClass.INPUT__GROUP__OUTER);
       writer.startElement(HtmlElements.DIV);
@@ -102,6 +101,9 @@ public class InRenderer extends MessageLayoutRendererBase {
     writer.writeAttribute(HtmlAttributes.TYPE, type);
     writer.writeNameAttribute(clientId);
     writer.writeIdAttribute(fieldId);
+    if (input.isLabelLayoutSkip()) {
+      writer.writeAttribute(DataAttributes.MARKUP, JsonUtils.encode(markup), false);
+    }
     HtmlRendererUtils.writeDataAttributes(facesContext, writer, input);
     if (currentValue != null) {
       writer.writeAttribute(HtmlAttributes.VALUE, currentValue, true);

-- 
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <co...@myfaces.apache.org>.