mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Export clickIt utility from test-helpers package
This commit is contained in:
@@ -15,15 +15,6 @@ var nodesToArray = function (array) {
|
||||
return _.map(array, _.identity);
|
||||
};
|
||||
|
||||
var clickIt = function (elem) {
|
||||
// jQuery's bubbling change event polyfill for IE 8 seems
|
||||
// to require that the element in question have focus when
|
||||
// it receives a simulated click.
|
||||
if (elem.focus)
|
||||
elem.focus();
|
||||
clickElement(elem);
|
||||
};
|
||||
|
||||
Tinytest.add("spacebars-tests - old - template_tests - simple helper", function (test) {
|
||||
var tmpl = Template.old_spacebars_template_test_simple_helper;
|
||||
var R = ReactiveVar(1);
|
||||
|
||||
@@ -10,27 +10,6 @@ var nodesToArray = function (array) {
|
||||
return _.map(array, _.identity);
|
||||
};
|
||||
|
||||
var inDocument = function (elem) {
|
||||
while ((elem = elem.parentNode)) {
|
||||
if (elem == document) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
var clickIt = function (elem) {
|
||||
if (!inDocument(elem))
|
||||
throw new Error("Can't click on elements without first adding them to the document");
|
||||
|
||||
// jQuery's bubbling change event polyfill for IE 8 seems
|
||||
// to require that the element in question have focus when
|
||||
// it receives a simulated click.
|
||||
if (elem.focus)
|
||||
elem.focus();
|
||||
clickElement(elem);
|
||||
};
|
||||
|
||||
// maybe use created callback on the template instead of this?
|
||||
var extendTemplateWithInit = function (template, initFunc) {
|
||||
var tmpl = new Template(template.viewName+'-extended', template.renderFunction);
|
||||
|
||||
@@ -42,3 +42,25 @@ clickElement = function(elem) {
|
||||
else
|
||||
simulateEvent(elem, 'click');
|
||||
};
|
||||
|
||||
var inDocument = function (elem) {
|
||||
while ((elem = elem.parentNode)) {
|
||||
if (elem == document) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
clickIt = function (elem) {
|
||||
if (!inDocument(elem))
|
||||
throw new Error("Can't click on elements without first adding them to the document");
|
||||
|
||||
// jQuery's bubbling change event polyfill for IE 8 seems
|
||||
// to require that the element in question have focus when
|
||||
// it receives a simulated click.
|
||||
if (elem.focus)
|
||||
elem.focus();
|
||||
clickElement(elem);
|
||||
};
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ Package.onUse(function (api) {
|
||||
'pollUntil', 'try_all_permutations',
|
||||
'SeededRandom', 'clickElement', 'blurElement',
|
||||
'focusElement', 'simulateEvent', 'getStyleProperty', 'canonicalizeHtml',
|
||||
'renderToDiv',
|
||||
'renderToDiv', 'clickIt',
|
||||
'withCallbackLogger', 'testAsyncMulti', 'simplePoll',
|
||||
'makeTestConnection', 'DomUtils']);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user