kamrify commited on
Commit
0faac17
·
1 Parent(s): 7a731b1

Allo getting title, description and popover from element

Browse files
Files changed (3) hide show
  1. src/core/element.js +9 -0
  2. src/core/popover.js +18 -0
  3. types/index.d.ts +18 -0
src/core/element.js CHANGED
@@ -129,6 +129,15 @@ export default class Element {
129
  });
130
  }
131
 
 
 
 
 
 
 
 
 
 
132
  /**
133
  * Is called when element is about to be deselected
134
  * i.e. when moving the focus to next element of closing
 
129
  });
130
  }
131
 
132
+ /**
133
+ * Gets the popover for the current element if any
134
+ * @returns {Popover|*}
135
+ * @public
136
+ */
137
+ getPopover() {
138
+ return this.popover;
139
+ }
140
+
141
  /**
142
  * Is called when element is about to be deselected
143
  * i.e. when moving the focus to next element of closing
src/core/popover.js CHANGED
@@ -67,6 +67,24 @@ export default class Popover extends Element {
67
  this.closeBtnNode = popover.querySelector(`.${CLASS_CLOSE_BTN}`);
68
  }
69
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  /**
71
  * Hides the popover
72
  * @public
 
67
  this.closeBtnNode = popover.querySelector(`.${CLASS_CLOSE_BTN}`);
68
  }
69
 
70
+ /**
71
+ * Gets the title node for the popover
72
+ * @returns {Element | null | *}
73
+ * @public
74
+ */
75
+ getTitleNode() {
76
+ return this.titleNode;
77
+ }
78
+
79
+ /**
80
+ * Gets the description node for the popover
81
+ * @returns {Element | null | *}
82
+ * @public
83
+ */
84
+ getDescriptionNode() {
85
+ return this.descriptionNode;
86
+ }
87
+
88
  /**
89
  * Hides the popover
90
  * @public
types/index.d.ts CHANGED
@@ -275,6 +275,12 @@ declare module 'driver.js' {
275
  */
276
  public getSize(): Driver.ElementSize;
277
 
 
 
 
 
 
 
278
  /**
279
  * Removes the highlight classes from current element if any
280
  */
@@ -458,6 +464,18 @@ declare module 'driver.js' {
458
  * @param {Driver.Position} position
459
  */
460
  private autoPosition(position: Driver.Position): void;
 
 
 
 
 
 
 
 
 
 
 
 
461
  }
462
 
463
  class Stage extends Element {
 
275
  */
276
  public getSize(): Driver.ElementSize;
277
 
278
+ /**
279
+ * Gets the popover on current element if any
280
+ * @returns {Driver.Popover}
281
+ */
282
+ public getPopover(): Driver.Popover;
283
+
284
  /**
285
  * Removes the highlight classes from current element if any
286
  */
 
464
  * @param {Driver.Position} position
465
  */
466
  private autoPosition(position: Driver.Position): void;
467
+
468
+ /**
469
+ * Gets the title node for popover
470
+ * @returns {Node | HTMLElement}
471
+ */
472
+ public getTitleNode(): Node | HTMLElement;
473
+
474
+ /**
475
+ * Gets the description node for popover
476
+ * @returns {Node | HTMLElement}
477
+ */
478
+ public getDescriptionNode(): Node | HTMLElement;
479
  }
480
 
481
  class Stage extends Element {