File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
main/java/gwt/material/design/client/ui
test/java/gwt/material/design/client/ui Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -65,8 +65,10 @@ protected void onLoad() {
6565 // Stop propagation of event when checkbox / other elements has
6666 // been clicked to avoid duplicate events.
6767 if (Element .as (event .getNativeEvent ().getEventTarget ()) != getElement ()) {
68- event .stopPropagation ();
69- event .preventDefault ();
68+ if (getType () == CollectionType .CHECKBOX ) {
69+ event .stopPropagation ();
70+ event .preventDefault ();
71+ }
7072 }
7173 for (Widget w : MaterialCollectionItem .this ) {
7274 if (w instanceof MaterialCollectionSecondary ) {
Original file line number Diff line number Diff line change @@ -107,12 +107,20 @@ public void testCollectionItem() {
107107 // when / then
108108 for (int i = 1 ; i <= 5 ; i ++) {
109109 MaterialCollectionItem item = new MaterialCollectionItem ();
110+ boolean [] linkClickHandler = {false };
110111 boolean [] clickHandler = {false };
112+
113+ MaterialLink link = new MaterialLink ("Link" );
114+ link .addClickHandler (clickEvent -> linkClickHandler [0 ] = true );
111115 item .addClickHandler (clickEvent -> clickHandler [0 ] = true );
112- fireClickEvent (item );
113- assertTrue (clickHandler [0 ]);
116+ item .add (link );
114117 collection .add (item );
115118 assertNotNull (item );
119+
120+ fireClickEvent (item );
121+ fireClickEvent (link );
122+ assertTrue (clickHandler [0 ]);
123+ assertTrue (linkClickHandler [0 ]);
116124 }
117125 assertEquals (5 , collection .getChildren ().size ());
118126 }
You can’t perform that action at this time.
0 commit comments