marionette-helper
Advanced tools
Comparing version 0.2.0 to 0.2.1
34
index.js
@@ -182,2 +182,36 @@ var Marionette = require('marionette-client'); | ||
}); | ||
}, | ||
/** | ||
* select specific option from target select element | ||
* @param {Marionette.Element|String} el element or some css selector. | ||
* @param {String} optionText text for the option | ||
*/ | ||
tapSelectOption: function(el, optionText) { | ||
var selectedOption = null; | ||
if (!isElement(el)) { | ||
el = this.client.findElement(el); | ||
} | ||
el.findElements('option').some(function(optionEl) { | ||
if (optionEl.text() === optionText) { | ||
selectedOption = optionEl; | ||
return true; | ||
} | ||
return false; | ||
}); | ||
selectedOption.scriptWith(function(selectedOptionEl) { | ||
selectedOptionEl.selected = true; | ||
}); | ||
el.scriptWith(function(selectEl) { | ||
var evt = new Event('change', { | ||
'view': window, | ||
'bubbles': true, | ||
'cancelable': true | ||
}); | ||
selectEl.dispatchEvent(evt); | ||
}); | ||
} | ||
@@ -184,0 +218,0 @@ }; |
{ | ||
"name": "marionette-helper", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"author": { | ||
@@ -13,2 +13,6 @@ "name": "Gareth Aye", | ||
"dependencies": { | ||
"marionette-apps": "~0.3.3" | ||
}, | ||
"devDependencies": { | ||
@@ -15,0 +19,0 @@ "marionette-host-environment": "0.3.3", |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
16903
14
446
2
2
+ Addedmarionette-apps@~0.3.3
+ Addedmarionette-apps@0.3.13(transitive)