Sha256: a16fe4bb4553b2b2e27490c0ccd47b5734c4e7886e8391bc801211bb19538102
Contents?: true
Size: 971 Bytes
Versions: 3
Compression:
Stored size: 971 Bytes
Contents
/** @module ember */ /** Like `find`, but throws an error if the element selector returns no results. Example: ```javascript var $el = findWithAssert('.doesnt-exist'); // throws error ``` With the `context` param: ```javascript var $el = findWithAssert('.selector-id', '.parent-element-class'); // assert will pass ``` @method findWithAssert @param {String} selector jQuery selector string for finding an element within the DOM @param {String} [context] (optional) jQuery selector that will limit the selector argument to find only within the context's children @return {Object} jQuery object representing the results of the query @throws {Error} throws error if object returned has a length of 0 @public */ export default function findWithAssert(app, selector, context) { let $el = app.testHelpers.find(selector, context); if ($el.length === 0) { throw new Error('Element ' + selector + ' not found.'); } return $el; }
Version data entries
3 entries across 3 versions & 1 rubygems