Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add tests for buttonclick.getPressedButton

  • Loading branch information...
commit 98ff5473a6658e9f052947f5036579c464d29a70 1 parent 6a43fca
@elemoine elemoine authored
Showing with 35 additions and 0 deletions.
  1. +35 −0 tests/Events/buttonclick.html
View
35 tests/Events/buttonclick.html
@@ -27,6 +27,41 @@
buttonClick.destroy();
events.destroy();
}
+
+ function test_getPressedButton(t) {
+ t.plan(4);
+
+ // set up
+
+ events = new OpenLayers.Events({}, element);
+ buttonClick = new OpenLayers.Events.buttonclick(events);
+
+ var button = document.createElement('button'),
+ span1 = document.createElement('span'),
+ span2 = document.createElement('span'),
+ span3 = document.createElement('span');
+ button.className = 'olButton';
+ button.appendChild(span1);
+ span1.appendChild(span2);
+ span2.appendChild(span3);
+
+ t.ok(buttonClick.getPressedButton(button) === button,
+ 'getPressedButton returns button when element is button');
+ t.ok(buttonClick.getPressedButton(span1) === button,
+ 'getPressedButton returns button when element is button descendant level 1');
+ t.ok(buttonClick.getPressedButton(span2) === button,
+ 'getPressedButton returns button when element is button descendant level 2');
+ t.eq(buttonClick.getPressedButton(span3), undefined,
+ 'getPressedButton returns undefined when element is button descendant level 3');
+
+ // test
+
+
+ // tear down
+
+ buttonClick.destroy();
+ events.destroy();
+ }
function test_ButtonClick_buttonClick(t) {
t.plan(27);
Please sign in to comment.
Something went wrong with that request. Please try again.