aboutsummaryrefslogtreecommitdiffstats
path: root/src/ngScenario
diff options
context:
space:
mode:
Diffstat (limited to 'src/ngScenario')
-rw-r--r--src/ngScenario/Scenario.js2
-rw-r--r--src/ngScenario/dsl.js18
2 files changed, 19 insertions, 1 deletions
diff --git a/src/ngScenario/Scenario.js b/src/ngScenario/Scenario.js
index f78e3931..4d848f2c 100644
--- a/src/ngScenario/Scenario.js
+++ b/src/ngScenario/Scenario.js
@@ -236,7 +236,7 @@ function callerFile(offset) {
(function(fn){
var parentTrigger = fn.trigger;
fn.trigger = function(type) {
- if (/(click|change|keydown|blur|input)/.test(type)) {
+ if (/(click|change|keydown|blur|input|mousedown|mouseup)/.test(type)) {
var processDefaults = [];
this.each(function(index, node) {
processDefaults.push(browserTrigger(node, type));
diff --git a/src/ngScenario/dsl.js b/src/ngScenario/dsl.js
index 9d46e0cf..67a56af9 100644
--- a/src/ngScenario/dsl.js
+++ b/src/ngScenario/dsl.js
@@ -328,6 +328,8 @@ angular.scenario.dsl('select', function() {
* element(selector, label).count() get the number of elements that match selector
* element(selector, label).click() clicks an element
* element(selector, label).mouseover() mouseover an element
+ * element(selector, label).mousedown() mousedown an element
+ * element(selector, label).mouseup() mouseup an element
* element(selector, label).query(fn) executes fn(selectedElements, done)
* element(selector, label).{method}() gets the value (as defined by jQuery, ex. val)
* element(selector, label).{method}(value) sets the value (as defined by jQuery, ex. val)
@@ -392,6 +394,22 @@ angular.scenario.dsl('element', function() {
});
};
+ chain.mousedown = function() {
+ return this.addFutureAction("element '" + this.label + "' mousedown", function($window, $document, done) {
+ var elements = $document.elements();
+ elements.trigger('mousedown');
+ done();
+ });
+ };
+
+ chain.mouseup = function() {
+ return this.addFutureAction("element '" + this.label + "' mouseup", function($window, $document, done) {
+ var elements = $document.elements();
+ elements.trigger('mouseup');
+ done();
+ });
+ };
+
chain.query = function(fn) {
return this.addFutureAction('element ' + this.label + ' custom query', function($window, $document, done) {
fn.call(this, $document.elements(), done);