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 17:05:28 UTC
svn commit: r1791816 - in /myfaces/tobago/trunk:
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/
tobago-example/tobago-example-demo/src/main/webapp/content/20-component/060-popup/
Author: hnoeth
Date: Tue Apr 18 17:05:28 2017
New Revision: 1791816
URL: http://svn.apache.org/viewvc?rev=1791816&view=rev
Log:
* tc:operation now works on dropdown menu entries
Modified:
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TobagoClientBehaviorRenderer.java
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/20-component/060-popup/popup.xhtml
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TobagoClientBehaviorRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TobagoClientBehaviorRenderer.java?rev=1791816&r1=1791815&r2=1791816&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TobagoClientBehaviorRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TobagoClientBehaviorRenderer.java Tue Apr 18 17:05:28 2017
@@ -27,8 +27,8 @@ import org.apache.myfaces.tobago.interna
import org.apache.myfaces.tobago.internal.renderkit.Collapse;
import org.apache.myfaces.tobago.internal.renderkit.Command;
import org.apache.myfaces.tobago.internal.renderkit.CommandMap;
-import org.apache.myfaces.tobago.internal.util.StringUtils;
import org.apache.myfaces.tobago.internal.util.RenderUtils;
+import org.apache.myfaces.tobago.internal.util.StringUtils;
import org.apache.myfaces.tobago.util.ComponentUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -42,6 +42,7 @@ import javax.faces.component.behavior.Cl
import javax.faces.context.FacesContext;
import javax.faces.event.AjaxBehaviorEvent;
import javax.faces.event.PhaseId;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -182,8 +183,13 @@ public class TobagoClientBehaviorRendere
//// BEGIN
// XXX too complicated
- final List<AbstractUIOperation> operations =
- ComponentUtils.findDescendantList(component, AbstractUIOperation.class);
+ final List<AbstractUIOperation> operations = new ArrayList<AbstractUIOperation>();
+ for (final UIComponent child : component.getChildren()) {
+ if (AbstractUIOperation.class.isAssignableFrom(child.getClass())) {
+ operations.add((AbstractUIOperation) child);
+ }
+ }
+
Collapse collapse = null;
if (operations.size() > 0) {
final AbstractUIOperation operation = operations.get(0);
Modified: 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=1791816&r1=1791815&r2=1791816&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/060-popup/popup.test.js (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/060-popup/popup.test.js Tue Apr 18 17:05:28 2017
@@ -51,7 +51,7 @@ QUnit.test("Open 'Client Popup', press '
waitForAjax(function () {
$messages = jQueryFrame($messages.selector);
- return $messages.length == 1;
+ return $messages.length === 1;
}, function () {
$output = jQueryFrame($output.selector);
$messages = jQueryFrame($messages.selector);
@@ -86,7 +86,7 @@ QUnit.test("Open 'Client Popup', press '
waitForAjax(function () {
$messages = jQueryFrame($messages.selector);
- return $messages.length == 0;
+ return $messages.length === 0;
}, function () {
$output = jQueryFrame($output.selector);
$messages = jQueryFrame($messages.selector);
@@ -120,7 +120,7 @@ QUnit.test("Open 'Client Popup', press '
$submitCloseButton.click();
jQuery("#page\\:testframe").load(function () {
- if (step == 1) {
+ if (step === 1) {
$popup = jQueryFrame($popup.selector);
$output = jQueryFrame($output.selector);
@@ -159,3 +159,73 @@ QUnit.test("Open 'Client Popup', press '
done();
});
});
+
+QUnit.test("Open 'Large Popup'.", function (assert) {
+ assert.expect(8);
+
+ var $dropdownContainer = jQueryFrame("#page\\:mainForm\\:dropdownButton");
+ var $dropdownButton = jQueryFrame("#page\\:mainForm\\:dropdownButton\\:\\:command");
+ var $openButton = jQueryFrame("#page\\:mainForm\\:largePopupLink");
+ var $popup = jQueryFrame("#page\\:mainForm\\:largePopup");
+ var $closeButton = jQueryFrame("#page\\:mainForm\\:largePopup\\:closeLargePopup");
+
+ if ($popup.hasClass("show")) {
+ $closeButton.click();
+ }
+ if ($dropdownContainer.hasClass("show")) {
+ $dropdownButton.click();
+ }
+
+ assert.equal($dropdownContainer.hasClass("show"), false);
+ assert.equal($popup.hasClass("show"), false);
+
+ $dropdownButton.click();
+
+ assert.equal($dropdownContainer.hasClass("show"), true);
+ assert.equal($popup.hasClass("show"), false);
+
+ $openButton.click();
+
+ assert.equal($dropdownContainer.hasClass("show"), false);
+ assert.equal($popup.hasClass("show"), true);
+
+ $closeButton.click();
+
+ assert.equal($dropdownContainer.hasClass("show"), false);
+ assert.equal($popup.hasClass("show"), false);
+});
+
+QUnit.test("Open 'Small Popup'.", function (assert) {
+ assert.expect(8);
+
+ var $dropdownContainer = jQueryFrame("#page\\:mainForm\\:dropdownButton");
+ var $dropdownButton = jQueryFrame("#page\\:mainForm\\:dropdownButton\\:\\:command");
+ var $openButton = jQueryFrame("#page\\:mainForm\\:smallPopupLink");
+ var $popup = jQueryFrame("#page\\:mainForm\\:smallPopup");
+ var $closeButton = jQueryFrame("#page\\:mainForm\\:smallPopup\\:closeSmallPopup");
+
+ if ($popup.hasClass("show")) {
+ $closeButton.click();
+ }
+ if ($dropdownContainer.hasClass("show")) {
+ $dropdownButton.click();
+ }
+
+ assert.equal($dropdownContainer.hasClass("show"), false);
+ assert.equal($popup.hasClass("show"), false);
+
+ $dropdownButton.click();
+
+ assert.equal($dropdownContainer.hasClass("show"), true);
+ assert.equal($popup.hasClass("show"), false);
+
+ $openButton.click();
+
+ assert.equal($dropdownContainer.hasClass("show"), false);
+ assert.equal($popup.hasClass("show"), true);
+
+ $closeButton.click();
+
+ assert.equal($dropdownContainer.hasClass("show"), false);
+ assert.equal($popup.hasClass("show"), false);
+});
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/060-popup/popup.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/060-popup/popup.xhtml?rev=1791816&r1=1791815&r2=1791816&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/060-popup/popup.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/060-popup/popup.xhtml Tue Apr 18 17:05:28 2017
@@ -109,33 +109,31 @@
<tc:section label="Markup">
<p>The width of the popups can be changed by markups.</p>
- <tc:section label="Large">
- <p><code class="language-markup"><tc:popup ... markup="large"></code></p>
- <tc:button id="showLarge" label="Large Popup" omit="true">
+ <p><code class="language-markup"><tc:popup ... markup="large"></code> or
+ <code class="language-markup"><tc:popup ... markup="small"></code></p>
+ <tc:button id="dropdownButton" label="Open" omit="true">
+ <tc:link id="largePopupLink" label="Large Popup" omit="true">
<tc:operation name="show" for="largePopup"/>
- </tc:button>
- <tc:popup id="largePopup" collapsedMode="hidden" markup="large">
- <tc:box label="Large">
- <p>A popup with markup <code>large</code>.</p>
- <tc:button label="Close" omit="true">
- <tc:operation name="hide" for="largePopup"/>
- </tc:button>
- </tc:box>
- </tc:popup>
- </tc:section>
- <tc:section label="Small">
- <p><code class="language-markup"><tc:popup ... markup="small"></code></p>
- <tc:button id="showSmall" label="Small Popup" omit="true">
+ </tc:link>
+ <tc:link id="smallPopupLink" label="Small Popup" omit="true">
<tc:operation name="show" for="smallPopup"/>
- </tc:button>
- <tc:popup id="smallPopup" collapsedMode="hidden" markup="small">
- <tc:box label="Small">
- <p>A popup with markup <code>small</code>.</p>
- <tc:button label="Close" omit="true">
- <tc:operation name="hide" for="smallPopup"/>
- </tc:button>
- </tc:box>
- </tc:popup>
- </tc:section>
+ </tc:link>
+ </tc:button>
+ <tc:popup id="largePopup" collapsedMode="hidden" markup="large">
+ <tc:box label="Large">
+ <p>A popup with markup <code>large</code>.</p>
+ <tc:button id="closeLargePopup" label="Close" omit="true">
+ <tc:operation name="hide" for="largePopup"/>
+ </tc:button>
+ </tc:box>
+ </tc:popup>
+ <tc:popup id="smallPopup" collapsedMode="hidden" markup="small">
+ <tc:box label="Small">
+ <p>A popup with markup <code>small</code>.</p>
+ <tc:button id="closeSmallPopup" label="Close" omit="true">
+ <tc:operation name="hide" for="smallPopup"/>
+ </tc:button>
+ </tc:box>
+ </tc:popup>
</tc:section>
</ui:composition>