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/04/18 18:04:27 UTC
svn commit: r1791818 - in /myfaces/tobago/trunk:
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/LabelLayoutRendererBase.java
tobago-example/tobago-example-demo/src/main/webapp/script/tobago-test.js
Author: hnoeth
Date: Tue Apr 18 18:04:27 2017
New Revision: 1791818
URL: http://svn.apache.org/viewvc?rev=1791818&view=rev
Log:
* the ID of the label-part now has the suffix ::label
* add test for duplicated IDs
Modified:
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/LabelLayoutRendererBase.java
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/script/tobago-test.js
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/LabelLayoutRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/LabelLayoutRendererBase.java?rev=1791818&r1=1791817&r2=1791818&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/LabelLayoutRendererBase.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/LabelLayoutRendererBase.java Tue Apr 18 18:04:27 2017
@@ -97,6 +97,7 @@ public abstract class LabelLayoutRendere
throws IOException {
final TobagoResponseWriter writer = getResponseWriter(facesContext);
+ String clientId = component.getClientId(facesContext);
// possible values:
// - none
@@ -114,13 +115,30 @@ public abstract class LabelLayoutRendere
case flexRight:
divClass = TobagoClass.FLEX_LAYOUT;
break;
+ case segmentLeft:
+ if (LabelLayout.getSegment(facesContext) == LabelLayout.segmentRight) {
+ clientId += ComponentUtils.SUB_SEPARATOR + "label";
+ }
+ divClass = null;
+ break;
+ case segmentRight:
+ if (LabelLayout.getSegment(facesContext) == LabelLayout.segmentLeft) {
+ clientId += ComponentUtils.SUB_SEPARATOR + "label";
+ }
+ divClass = null;
+ break;
+ case none:
+ case top:
+ case flowLeft:
+ case flowRight:
+ case skip:
default: // none, top, segmentLeft, segmentRight, flowLeft, flowRight
divClass = null;
}
// if (labelLayout != LabelLayout.none) {
writer.startElement(HtmlElements.DIV);
- writer.writeIdAttribute(component.getClientId(facesContext));
+ writer.writeIdAttribute(clientId);
// }
// writer.writeClassAttribute(divClass, BootstrapClass.maximumSeverity(component));
// todo: check if BootstrapClass.FORM_GROUP is needed, I've removed it, because of it's margin-bottom: 15px;
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/script/tobago-test.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/script/tobago-test.js?rev=1791818&r1=1791817&r2=1791818&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/script/tobago-test.js (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/script/tobago-test.js Tue Apr 18 18:04:27 2017
@@ -38,3 +38,18 @@ function waitForAjax(waitingDone, execut
}
}, 50);
}
+
+function getDuplicatedIDs() {
+ var duplicatedIDs = [];
+ jQueryFrame('[id]').each(function () {
+ var ids = jQueryFrame('[id="' + this.id + '"]');
+ if (ids.length > 1 && ids[0] == this)
+ duplicatedIDs.push(this.id);
+ });
+ return duplicatedIDs;
+}
+
+QUnit.test("duplicated IDs", function (assert) {
+ var duplicatedIDs = getDuplicatedIDs();
+ assert.equal(duplicatedIDs.length, 0, "duplicated IDs are: " + duplicatedIDs);
+});