Version 1
[yaffs-website] / vendor / jcalderonzumba / gastonjs / src / Exception / MouseEventFailed.php
1 <?php
2
3 namespace Zumba\GastonJS\Exception;
4
5 /**
6  * Class MouseEventFailed
7  * @package Zumba\GastonJS\Exception
8  */
9 class MouseEventFailed extends NodeError {
10
11   /**
12    * Gets the name of the event
13    * @return string
14    */
15   public function getName() {
16     return $this->response["args"][0];
17   }
18
19   /**
20    * Selector of the element to act with the mouse
21    * @return string
22    */
23   public function getSelector() {
24     return $this->response["args"][1];
25   }
26
27   /**
28    * Returns the position where the click was done
29    * @return array
30    */
31   public function getPosition() {
32     $position = array();
33     $position[0] = $this->response["args"][1]['x'];
34     $position[1] = $this->response["args"][2]['y'];
35     return $position;
36   }
37
38   /**
39    * @return string
40    */
41   public function message() {
42     $name = $this->getName();
43     $position = implode(",", $this->getPosition());
44     return "Firing a $name at co-ordinates [$position] failed. Poltergeist detected
45             another element with CSS selector '#{selector}' at this position.
46             It may be overlapping the element you are trying to interact with.
47             If you don't care about overlapping elements, try using node.trigger('$name').";
48   }
49 }