aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bzpage.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bzpage.js')
-rw-r--r--lib/bzpage.js25
1 files changed, 24 insertions, 1 deletions
diff --git a/lib/bzpage.js b/lib/bzpage.js
index e315922..e8f11aa 100644
--- a/lib/bzpage.js
+++ b/lib/bzpage.js
@@ -9,7 +9,9 @@ var selfMod = require("self");
var fileMod = require("file");
var simpleStorage = require("simple-storage");
var preferences = require("preferences-service");
+var selection = require("selection");
var prompts = require("prompts");
+var tabs = require("tabs");
var Color = require("color").Color;
var bugURL = "https://bugzilla.redhat.com/show_bug.cgi?id=";
@@ -557,7 +559,7 @@ BZPage.prototype.collectComments = function collectComments () {
/**
- * Select option with given label on the <SELECT> element with given id.
+ * Select option with given value on the <SELECT> element with given id.
*
* Also execute change HTMLEvent, so that the form behaves accordingly.
*
@@ -579,6 +581,27 @@ BZPage.prototype.selectOption = function selectOption (id, label, fireEvent) {
}
};
+BZPage.prototype.selectOptionByLabel = function selectOptionByLabel(id, label, fireEvent) {
+ if (!fireEvent) {
+ fireEvent = true;
+ }
+ var sel = this.doc.getElementById(id);
+ var labelRE = new RegExp(label.trim());
+ var ourOption = Array.filter(sel.options, function (op) {
+ return op.textContent.trim() == label;
+ }, this);
+
+ if (ourOption[0]) {
+ sel.value = ourOption[0].value;
+ }
+
+ if (fireEvent) {
+ var intEvent = this.doc.createEvent("HTMLEvents");
+ intEvent.initEvent("change", true, true);
+ sel.dispatchEvent(intEvent);
+ }
+};
+
/**
* Send mouse click to the specified element
*