From c80e1711e592708ccd65f6e1a5db152a10070232 Mon Sep 17 00:00:00 2001 From: Blake West Date: Fri, 17 Oct 2014 18:44:50 -0700 Subject: [PATCH 1/2] Bumped version to show how much more awesome it is. --- bower.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bower.json b/bower.json index 76ce974..a8801b0 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "behave", - "version": "0.0.4", + "version": "0.1.0", "authors": [ "Blake West " ], From 0ce67f68d95a87c4f531aabf4cbc1ede0c70cf4f Mon Sep 17 00:00:00 2001 From: Blake West Date: Sun, 19 Oct 2014 12:09:46 -0700 Subject: [PATCH 2/2] New dist files from all the changes. --- dist/behave.js | 174 +++++++++++++++++++++++++++++++++------------ dist/behave.min.js | 2 +- 2 files changed, 129 insertions(+), 47 deletions(-) diff --git a/dist/behave.js b/dist/behave.js index 6a56986..1189a08 100644 --- a/dist/behave.js +++ b/dist/behave.js @@ -52,11 +52,21 @@ if(typeof t!="number"&&null!=t){var o=u;for(t=Y.createCallback(t,e,3);o--&&t(n[o Y.prototype[n]=function(){return new nt(t.apply(this.__wrapped__,arguments),this.__chain__)}}),Y}var h,g=[],y=[],m=0,_=+new Date+"",b=75,d=40,w=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",j=/\b__p\+='';/g,k=/\b(__p\+=)''\+/g,x=/(__e\(.*?\)|\b__t\))\+'';/g,C=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,O=/\w*$/,I=/^function[ \n\r\t]+\w/,N=/<%=([\s\S]+?)%>/g,E=RegExp("^["+w+"]*0+(?=.$)"),S=/($^)/,R=/\bthis\b/,A=/['\n\r\t\u2028\u2029\\]/g,D="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),B="[object Arguments]",$="[object Array]",F="[object Boolean]",T="[object Date]",W="[object Function]",q="[object Number]",z="[object Object]",P="[object RegExp]",K="[object String]",L={}; L[W]=!1,L[B]=L[$]=L[F]=L[T]=L[q]=L[z]=L[P]=L[K]=!0;var M={leading:!1,maxWait:0,trailing:!1},U={configurable:!1,enumerable:!1,value:null,writable:!1},V={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},G={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},H=V[typeof window]&&window||this,J=V[typeof exports]&&exports&&!exports.nodeType&&exports,Q=V[typeof module]&&module&&!module.nodeType&&module,X=Q&&Q.exports===J&&J,Y=V[typeof global]&&global;!Y||Y.global!==Y&&Y.window!==Y||(H=Y); var Z=v();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(H._=Z, define(function(){return Z})):J&&Q?X?(Q.exports=Z)._=Z:J._=Z:H._=Z}).call(this); -// Little jQuery extension to have exact equals; -$.expr[':'].textEquals = function(a, i, m) { - var match = $(a).text().match("^" + m[3] + "$") +'use strict'; +// Little jQuery extension for exact and rough text matching +$.expr[':'].textEquals = function(el, i, m) { + var textToMatch = m[3]; + var match = $(el).text().trim().match("^" + textToMatch + "$") return match && match.length > 0; -} +}; + +// This is similar to contains, except not case sensitive. +$.expr[':'].textRoughMatch = function(el, i, m) { + var textToMatch = m[3]; + var elText = $(el).text().toLowerCase(); + var res = elText.toLowerCase().indexOf(textToMatch.toLowerCase()) !== -1; + return res; +}; window.Behave = {}; Behave.view = $(document.body); @@ -66,7 +76,7 @@ Behave.domTypes = { attrOptions: ['name', 'for', 'placeholder', 'contains', 'type', 'test-me'] }, clickable: { - elementTypes: ['button', 'a'], + elementTypes: ['button', 'a', 'select'], attrOptions: ['contains', 'href', 'test-me'] }, icon: { @@ -74,34 +84,32 @@ Behave.domTypes = { attrOptions: ['type', 'class', 'test-me'] }, display: { - elementTypes: [''], // This is actually all elements, since there's no leading el type + // The empty string is actually all elements, since there's no leading el type + elementTypes: ['table', 'tr', 'td', 'th', ''], attrOptions: ['test-me', 'contains'] } -} - -Behave.getAllElsAttrOptions = ['name', 'for', 'placeholder', 'type', 'test-me'] +}; -Behave.find = function(identifier, type) { +Behave.find = function(identifier, type, opts) { + opts = opts || {}; var element = ''; var searchOptions = type ? {specificOption: Behave.domTypes[type]} : Behave.domTypes; _.each(searchOptions, function(searchParams) { _.each(searchParams.elementTypes, function(elType) { - if (element.length) { - // Explicitly returning false kills iteration early in lodash. - return false; - } + // Explicitly returning false kills iteration early in lodash. + if (element.length) {return false;} + _.each(searchParams.attrOptions, function(attrOption) { switch (attrOption) { case 'contains': - var filter = ":textEquals("+ identifier + ")" - element = Behave.view.find(elType + filter); + element = findByText(identifier, elType); break; case 'class': - element = findByClass(identifier, elType, 'glyphicon-'); + element = findByClass(identifier, elType); break; default: var filter = "[" + attrOption + "='" + identifier + "']"; - element = Behave.view.find(elType + filter); + element = tryToFind(elType + filter); } // Explicitly returning false kills iteration early in lodash. if (element.length) { @@ -109,7 +117,7 @@ Behave.find = function(identifier, type) { } }); }); - }) + }); if (element && element.is('label')) { element = getClosestInput(element); @@ -118,14 +126,34 @@ Behave.find = function(identifier, type) { if (!element.length) { element = Behave.view.find(identifier); } + + // No element has been found, and we're in error mode. + if (!element.length && !opts.noErrors) { + throw new Error('Can\'t find element identified by ' + identifier); + } + + // We found too many things + if (element.length > 1 && !opts.findMany) { + throw new Error('Matched multiple elements identified by ' + identifier + '. Use findAll if that\'s what you expect.') + } + return element; }; +Behave.tryFind = function(identifier, type) { + return Behave.find(identifier, type, {noErrors: true}); +}; + +Behave.findAll = function(identifier, type) { + return Behave.find(identifier, type, {findMany: true}); +}; + Behave.fill = function(identifier) { // If id is already jQuery, just go with it. Useful if you've set a variable using Behave.find, and then want to // reuse that variable in a fill later on. var $el = identifier instanceof jQuery ? identifier : Behave.find(identifier, 'field'); + var fillWith = function(data) { if ($el.is('form') || $el.attr('type') === 'form') { if (!_.isObject(data)) { @@ -150,43 +178,94 @@ Behave.fill = function(identifier) { return fillObject; }; -Behave.getAllEls = function(element, $els) { - element = element || Behave.view; - $els = $els || {}; - var kids = element.children; - if (kids.length) { - element.children().each(function() { - $els = Behave.getAllEls($(this), $els); - }); +Behave.bexpect = function(identifier, opts) { + if (_.isObject(jasmine)) { + if (_.isString(identifier)) { + return jasmine.getGlobal().expect(Behave.find(identifier, opts)); + } + return jasmine.getGlobal().expect(identifier); } - _.each(Behave.getAllElsAttrOptions, function(attrOption) { - var attrVal = cleanVal(element.attr(attrOption)); - if (attrVal) { - element.reload = function() { - return Behave.find(attrVal); - } + + throw new Error("It appears jasmine or expect isn't defined. Thus Behave can't delegate expect"); +}; + +Behave.click = function(identifier) { + if (identifier instanceof jQuery) { + if (identifier.is('input') && identifier.attr('type') === 'radio') { + return identifier.click().trigger('click'); + } else { + return identifier.trigger('click'); } - attrVal && ($els[attrVal] = element) - }); - var elText = element.text(); - if(elText) {$els[cleanVal(elText)] = element;} - return $els; + return; + } + if (_.isString(identifier)) { + return Behave.find(identifier).trigger('click'); + } + throw new Error("The identifier passed to click was invalid. It must be either a string or jQuery object"); +}; + +Behave.choose = function(value) { + // If id is already jQuery, just go with it. Useful if you've set a variable using Behave.find, and then want to + // reuse that variable in a fill later on. + + var chooseFrom = function(dropDown) { + var $el = dropDown instanceof jQuery ? dropDown : Behave.find(dropDown); + return $el.val(value).trigger('change'); + }; + + var chooseObject = { + from: chooseFrom + }; + + return chooseObject; }; // PRIVATE FUNCTIONS +var tryToFind = function(expression) { + var el = ''; + try { + el = Behave.view.find(expression); + } + catch (e) { + // Syntax errors occur sometimes when trying to do certain operations + // with ~'s and such. We just want it to return nothing in this case. + if ( !(_.contains(e.message, "Syntax error")) ) { + // Re throw if it's not a syntax errors + throw (e) + } + } + return $(el); +}; + var getClosestInput = function($el) { var sibling = $el.next(); - if (sibling.is('input')) {return sibling} + if (sibling.is('input')) {return sibling;} var relatedInput = sibling.find('input'); return relatedInput.length ? relatedInput : $el; }; -var findByClass = function(identifier, elType, prefix) { - prefix = prefix || ''; +var findByClass = function(identifier, elType) { + var prefix = _.contains(['icon', 'div', 'span'], elType) ? 'glyphicon-' : ''; elType = elType || ''; - return Behave.view.find(elType + '.' + prefix + identifier).first(); -} + var expression = elType + '.' + prefix + identifier; + + return tryToFind(expression).first(); +}; + +var findByText = function(identifier, elType) { + var filterMethod, filterString, expression; + filterMethod = ":textEquals"; + + if (identifier[0] === '~') { + identifier = identifier.slice(1); + filterMethod = ":textRoughMatch"; + } + filterString = filterMethod + "('" + identifier + "')"; + expression = elType + filterString; + + return tryToFind(expression); +}; var cleanVal = function(val) { if (!val) {return;} @@ -194,7 +273,7 @@ var cleanVal = function(val) { // Remove any spaces. val = val.replace(' ', ''); - if (val.indexOf('-') !== -1) { + if (_.contains(val, '-')) { // camelCasing attrs with dashes in them. var words = val.split('-'); words[1] = words[1][0].toUpperCase() + words[1].substring(1); @@ -206,5 +285,8 @@ var cleanVal = function(val) { // Set functions to the window for convenience window.find = Behave.find; -window.fill = Behave.fill - +window.fill = Behave.fill; +window.findAll = Behave.findAll; +window.tryFind = Behave.tryFind; +window.bexpect = Behave.bexpect; +window.click = Behave.click; diff --git a/dist/behave.min.js b/dist/behave.min.js index 4b4e799..3a0d92b 100644 --- a/dist/behave.min.js +++ b/dist/behave.min.js @@ -1 +1 @@ -(function(){function n(n,e,t){t=(t||0)-1;for(var r=n?n.length:0;++tr||"undefined"==typeof t)return 1;if(r>t||"undefined"==typeof r)return-1}return n.n-e.n}function o(n){var e=-1,r=n.length,u=n[0],o=n[0|r/2],i=n[r-1];if(u&&"object"==typeof u&&o&&"object"==typeof o&&i&&"object"==typeof i)return!1;for(u=f(),u["false"]=u["null"]=u["true"]=u.undefined=!1,o=f(),o.k=n,o.l=u,o.push=t;++et?0:t);++r3&&"function"==typeof i[f-2])var l=te(i[--f-1],i[f--],2);else f>2&&"function"==typeof i[f-1]&&(l=i[--f]);for(;++a=_&&f===n,v=u||h?a():s;if(h){var g=o(v);g?(f=e,v=g):(h=!1,v=u?v:(c(v),s))}for(;++if(v,y))&&((u||h)&&v.push(y),s.push(g))}return h?(c(v.k),p(v)):u&&c(v),s}function ae(n){return function(e,t,r){var u={};t=Y.createCallback(t,r,3),r=-1;var o=e?e.length:0;if("number"==typeof o)for(;++rt?Nt(0,o+t):t)||0,Pt(n)?i=-1o&&(o=a)}}else e=!e&&we(n)?r:Y.createCallback(e,t,3),Oe(n,function(n,t,r){t=e(n,t,r),t>u&&(u=t,o=n)});return o}function Ne(n,e){var t=-1,r=n?n.length:0;if("number"==typeof r)for(var u=Xe(r);++targuments.length;e=te(e,r,4);var o=-1,i=n.length;if("number"==typeof i)for(u&&(t=n[++o]);++oarguments.length;return e=te(e,r,4),Ee(n,function(n,r,o){t=u?(u=!1,n):e(t,n,r,o)}),t}function Se(n){var e=-1,t=n?n.length:0,r=Xe("number"==typeof t?t:0);return Oe(n,function(n){var t=He(++e);r[e]=r[t],r[t]=n}),r}function De(n,e,t){var r;e=Y.createCallback(e,t,3),t=-1;var u=n?n.length:0;if("number"==typeof u)for(;++t=_&&u===n;if(l){var c=o(a);c?(u=e,a=c):l=!1}for(;++ru(a,c)&&f.push(c);return l&&p(a),f}function Fe(n,e,t){var r=0,u=n?n.length:0;if("number"!=typeof e&&null!=e){var o=-1;for(e=Y.createCallback(e,t,3);++or?Nt(0,u+r):r||0}else if(r)return r=We(e,t),e[r]===t?r:-1;return n(e,t,r)}function ze(n,e,t){if("number"!=typeof e&&null!=e){var r=0,u=-1,o=n?n.length:0;for(e=Y.createCallback(e,t,3);++uu;)r=u+o>>>1,t(n[r])t?0:t);++e0?c=bt(u,t):(i&&st(i),t=p,i=c=p=v,t&&(s=mt(),a=n.apply(l,o)))}var o,i,a,f,l,c,p,s=0,h=!1,g=!0;if(!de(n))throw new it;if(e=Nt(0,e)||0,!0===t)var y=!0,g=!1;else _e(t)&&(y=t.leading,h="maxWait"in t&&(Nt(e,t.maxWait)||0),g="trailing"in t?t.trailing:g);return function(){if(o=arguments,f=mt(),l=this,p=g&&(c||!y),!1===h)var t=y&&!c;else{i||y||(s=f);var v=h-(f-s);v>0?i||(i=bt(r,v)):(i&&(i=st(i)),s=f,a=n.apply(l,o))}return c||e===h||(c=bt(u,e)),t&&(a=n.apply(l,o)),a}}function Ue(n){if(!de(n))throw new it;var e=Dt.call(arguments,1);return bt(function(){n.apply(v,e)},1)}function Qe(n){return n}function Ge(n,e){var t=n,r=!e||de(t);e||(t=ne,e=n,n=Y),Oe(ye(e),function(u){var o=n[u]=e[u];r&&(t.prototype[u]=function(){var e=this.__wrapped__,r=[e];return dt.apply(r,arguments),r=o.apply(n,r),e&&"object"==typeof e&&e===r?this:(r=new t(r),r.__chain__=this.__chain__,r)})})}function He(n,e,t){var r=null==n,u=null==e;return null==t&&("boolean"==typeof n&&u?(t=n,n=1):u||"boolean"!=typeof e||(t=e,u=!0)),r&&u&&(e=1),n=+n||0,u?(e=n,n=0):e=+e||0,r=St(),t||n%1||e%1?Tt(n+r*(e-n+parseFloat("1e-"+((r+"").length-1))),e):n+ht(r*(e-n+1))}function Je(){return this.__wrapped__}t=t?Z.defaults(G.Object(),t,Z.pick(G,$)):G;var Xe=t.Array,Ye=t.Boolean,Ze=t.Date,nt=t.Function,et=t.Math,tt=t.Number,rt=t.Object,ut=t.RegExp,ot=t.String,it=t.TypeError,at=[],ft=rt.prototype,lt=t._,ct=ut("^"+ot(ft.valueOf).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),pt=et.ceil,st=t.clearTimeout,ht=et.floor,vt=nt.prototype.toString,gt=ct.test(gt=rt.getPrototypeOf)&>,yt=ft.hasOwnProperty,mt=ct.test(mt=Ze.now)&&mt||function(){return+new Ze},dt=at.push,_t=t.setImmediate,bt=t.setTimeout,wt=at.splice,jt=ft.toString,kt=at.unshift,xt=function(){try{var n={},e=ct.test(e=rt.defineProperty)&&e,t=e(n,n,n)&&e}catch(r){}return t}(),Ct=ct.test(Ct=jt.bind)&&Ct,Bt=ct.test(Bt=rt.create)&&Bt,Ot=ct.test(Ot=Xe.isArray)&&Ot,Et=t.isFinite,At=t.isNaN,It=ct.test(It=rt.keys)&&It,Nt=et.max,Tt=et.min,$t=t.parseInt,St=et.random,Dt=at.slice,Rt=ct.test(t.attachEvent),Ft=Ct&&!/\n|true/.test(Ct+Rt),qt={};qt[D]=Xe,qt[R]=Ye,qt[F]=Ze,qt[q]=nt,qt[W]=rt,qt[z]=tt,qt[P]=ut,qt[V]=ot,ne.prototype=Y.prototype;var zt=Y.support={};zt.fastBind=Ct&&!Ft,zt.funcDecomp=!ct.test(t.a)&&N.test(h),zt.funcNames="string"==typeof nt.name,Y.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:E,variable:"",imports:{_:Y}},Bt||(le=function(n){if(_e(n)){l.prototype=n;var e=new l;l.prototype=null}return e||{}});var Wt=xt?function(n,e){M.value=e,xt(n,"__bindData__",M)}:l,Pt=Ot||function(n){return n&&"object"==typeof n&&"number"==typeof n.length&&jt.call(n)==D||!1},Vt=It?function(n){return _e(n)?It(n):[]}:J,Kt={"&":"&","<":"<",">":">",'"':""","'":"'"},Lt=me(Kt),Mt=ut("("+Vt(Lt).join("|")+")","g"),Ut=ut("["+Vt(Kt).join("")+"]","g"),Qt=ae(function(n,e,t){yt.call(n,t)?n[t]++:n[t]=1}),Gt=ae(function(n,e,t){(yt.call(n,t)?n[t]:n[t]=[]).push(e)}),Ht=ae(function(n,e,t){n[t]=e});Ft&&X&&"function"==typeof _t&&(Ue=function(n){if(!de(n))throw new it;return _t.apply(t,arguments)});var Jt=8==$t(w+"08")?$t:function(n,e){return $t(we(n)?n.replace(A,""):n,e||0)};return Y.after=function(n,e){if(!de(e))throw new it;return function(){return 1>--n?e.apply(this,arguments):void 0}},Y.assign=H,Y.at=function(n){for(var e=arguments,t=-1,r=re(e,!0,!1,1),e=e[2]&&e[2][e[1]]===n?1:r.length,u=Xe(e);++t=_&&o(i?r[i]:g)}n:for(;++l(m?e(m,y):s(g,y))){for(i=u,(m||g).push(y);--i;)if(m=f[i],0>(m?e(m,y):s(r[i],y)))continue n;v.push(y)}}for(;u--;)(m=f[u])&&p(m);return c(f),c(g),v},Y.invert=me,Y.invoke=function(n,e){var t=Dt.call(arguments,2),r=-1,u="function"==typeof e,o=n?n.length:0,i=Xe("number"==typeof o?o:0);return Oe(n,function(n){i[++r]=(u?e:n[e]).apply(n,t)}),i},Y.keys=Vt,Y.map=Ae,Y.max=Ie,Y.memoize=function(n,e){function t(){var r=t.cache,u=e?e.apply(this,arguments):d+arguments[0];return yt.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}if(!de(n))throw new it;return t.cache={},t},Y.merge=function(n){var e=arguments,t=2;if(!_e(n))return n;if("number"!=typeof e[2]&&(t=e.length),t>3&&"function"==typeof e[t-2])var r=te(e[--t-1],e[t--],2);else t>2&&"function"==typeof e[t-1]&&(r=e[--t]);for(var e=Dt.call(arguments,1,t),u=-1,o=a(),i=a();++ua&&(o=a)}}else e=!e&&we(n)?r:Y.createCallback(e,t,3),Oe(n,function(n,t,r){t=e(n,t,r),u>t&&(u=t,o=n)});return o},Y.omit=function(n,e,t){var r=pe(),u="function"==typeof e,o={};if(u)e=Y.createCallback(e,t,3);else var i=re(arguments,!0,!1,1);return b(n,function(n,t,a){(u?!e(n,t,a):0>r(i,t))&&(o[t]=n)}),o},Y.once=function(n){var e,t;if(!de(n))throw new it;return function(){return e?t:(e=!0,t=n.apply(this,arguments),n=null,t)}},Y.pairs=function(n){for(var e=-1,t=Vt(n),r=t.length,u=Xe(r);++et?Nt(0,r+t):Tt(t,r-1))+1);r--;)if(n[r]===e)return r;return-1},Y.mixin=Ge,Y.noConflict=function(){return t._=lt,this},Y.parseInt=Jt,Y.random=He,Y.reduce=Te,Y.reduceRight=$e,Y.result=function(n,e){if(n){var t=n[e];return de(t)?n[e]():t}},Y.runInContext=h,Y.size=function(n){var e=n?n.length:0;return"number"==typeof e?e:Vt(n).length},Y.some=De,Y.sortedIndex=We,Y.template=function(n,e,t){var r=Y.templateSettings;n||(n=""),t=Q({},t,r);var u,o=Q({},t.imports,r.imports),r=Vt(o),o=je(o),a=0,f=t.interpolate||I,l="__p+='",f=ut((t.escape||I).source+"|"+f.source+"|"+(f===E?C:I).source+"|"+(t.evaluate||I).source+"|$","g");n.replace(f,function(e,t,r,o,f,c){return r||(r=o),l+=n.slice(a,c).replace(T,i),t&&(l+="'+__e("+t+")+'"),f&&(u=!0,l+="';"+f+";__p+='"),r&&(l+="'+((__t=("+r+"))==null?'':__t)+'"),a=c+e.length,e}),l+="';\n",f=t=t.variable,f||(t="obj",l="with("+t+"){"+l+"}"),l=(u?l.replace(j,""):l).replace(k,"$1").replace(x,"$1;"),l="function("+t+"){"+(f?"":t+"||("+t+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var c=nt(r,"return "+l).apply(v,o)}catch(p){throw p.source=l,p}return e?c(e):(c.source=l,c)},Y.unescape=function(n){return null==n?"":ot(n).replace(Mt,he)},Y.uniqueId=function(n){var e=++m;return ot(null==n?"":n)+e},Y.all=xe,Y.any=De,Y.detect=Be,Y.findWhere=Be,Y.foldl=Te,Y.foldr=$e,Y.include=ke,Y.inject=Te,y(Y,function(n,e){Y.prototype[e]||(Y.prototype[e]=function(){var e=[this.__wrapped__],t=this.__chain__;return dt.apply(e,arguments),e=n.apply(Y,e),t?new ne(e,t):e})}),Y.first=Fe,Y.last=function(n,e,t){var r=0,u=n?n.length:0;if("number"!=typeof e&&null!=e){var o=u;for(e=Y.createCallback(e,t,3);o--&&e(n[o],o,n);)r++}else if(r=e,null==r||t)return n?n[u-1]:v;return s(n,Nt(0,u-r))},Y.sample=function(n,e,t){var r=n?n.length:0;return"number"!=typeof r&&(n=je(n)),null==e||t?n?n[He(r-1)]:v:(n=Se(n),n.length=Tt(Nt(0,e),n.length),n)},Y.take=Fe,Y.head=Fe,y(Y,function(n,e){var t="sample"!==e;Y.prototype[e]||(Y.prototype[e]=function(e,r){var u=this.__chain__,o=n(this.__wrapped__,e,r);return u||null!=e&&(!r||t&&"function"==typeof e)?new ne(o,u):o})}),Y.VERSION="2.2.1",Y.prototype.chain=function(){return this.__chain__=!0,this},Y.prototype.toString=function(){return ot(this.__wrapped__)},Y.prototype.value=Je,Y.prototype.valueOf=Je,Oe(["join","pop","shift"],function(n){var e=at[n];Y.prototype[n]=function(){var n=this.__chain__,t=e.apply(this.__wrapped__,arguments);return n?new ne(t,n):t}}),Oe(["push","reverse","sort","unshift"],function(n){var e=at[n];Y.prototype[n]=function(){return e.apply(this.__wrapped__,arguments),this}}),Oe(["concat","slice","splice"],function(n){var e=at[n];Y.prototype[n]=function(){return new ne(e.apply(this.__wrapped__,arguments),this.__chain__)}}),Y}var v,g=[],y=[],m=0,d=+new Date+"",_=75,b=40,w=" \f \n\r\u2028\u2029 ᠎              ",j=/\b__p\+='';/g,k=/\b(__p\+=)''\+/g,x=/(__e\(.*?\)|\b__t\))\+'';/g,C=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,B=/\w*$/,O=/^function[ \n\r\t]+\w/,E=/<%=([\s\S]+?)%>/g,A=RegExp("^["+w+"]*0+(?=.$)"),I=/($^)/,N=/\bthis\b/,T=/['\n\r\t\u2028\u2029\\]/g,$="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),S="[object Arguments]",D="[object Array]",R="[object Boolean]",F="[object Date]",q="[object Function]",z="[object Number]",W="[object Object]",P="[object RegExp]",V="[object String]",K={};K[q]=!1,K[S]=K[D]=K[R]=K[F]=K[z]=K[W]=K[P]=K[V]=!0;var L={leading:!1,maxWait:0,trailing:!1},M={configurable:!1,enumerable:!1,value:null,writable:!1},U={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},Q={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"},G=U[typeof window]&&window||this,H=U[typeof exports]&&exports&&!exports.nodeType&&exports,J=U[typeof module]&&module&&!module.nodeType&&module,X=J&&J.exports===H&&H,Y=U[typeof global]&&global;!Y||Y.global!==Y&&Y.window!==Y||(G=Y);var Z=h();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(G._=Z,define(function(){return Z})):H&&J?X?(J.exports=Z)._=Z:H._=Z:G._=Z}).call(this),$.expr[":"].textEquals=function(n,e,t){var r=$(n).text().match("^"+t[3]+"$");return r&&r.length>0},window.Behave={},Behave.view=$(document.body),Behave.domTypes={field:{elementTypes:["input","select","option","label","textarea","form"],attrOptions:["name","for","placeholder","contains","type","test-me"]},clickable:{elementTypes:["button","a"],attrOptions:["contains","href","test-me"]},icon:{elementTypes:["icon","div","span"],attrOptions:["type","class","test-me"]},display:{elementTypes:[""],attrOptions:["test-me","contains"]}},Behave.getAllElsAttrOptions=["name","for","placeholder","type","test-me"],Behave.find=function(n,e){var t="",r=e?{specificOption:Behave.domTypes[e]}:Behave.domTypes;return _.each(r,function(e){_.each(e.elementTypes,function(r){return t.length?!1:void _.each(e.attrOptions,function(e){switch(e){case"contains":var u=":textEquals("+n+")";t=Behave.view.find(r+u);break;case"class":t=findByClass(n,r,"glyphicon-");break;default:var u="["+e+"='"+n+"']";t=Behave.view.find(r+u)}return t.length?!1:void 0})})}),t&&t.is("label")&&(t=getClosestInput(t)),t.length||(t=Behave.view.find(n)),t},Behave.fill=function(n){var e=n instanceof jQuery?n:Behave.find(n,"field"),t=function(n){if(e.is("form")||"form"===e.attr("type")){if(!_.isObject(n))throw new Error("Must pass in a hash with signature of {element: value} when filling a whole form");return void _.each(n,function(n,e){Behave.fill(e).with(n)})}return"checkbox"===e.attr("type")?e.prop("checked",n):void e.val(n).trigger("input")},r={"with":t};return r},Behave.getAllEls=function(n,e){n=n||Behave.view,e=e||{};var t=n.children;t.length&&n.children().each(function(){e=Behave.getAllEls($(this),e)}),_.each(Behave.getAllElsAttrOptions,function(t){var r=cleanVal(n.attr(t));r&&(n.reload=function(){return Behave.find(r)}),r&&(e[r]=n)});var r=n.text();return r&&(e[cleanVal(r)]=n),e};var getClosestInput=function(n){var e=n.next();if(e.is("input"))return e;var t=e.find("input");return t.length?t:n},findByClass=function(n,e,t){return t=t||"",e=e||"",Behave.view.find(e+"."+t+n).first()},cleanVal=function(n){if(n){if(n=n.replace(" ",""),-1!==n.indexOf("-")){var e=n.split("-");e[1]=e[1][0].toUpperCase()+e[1].substring(1),e[2]&&(e[2]=e[2][0].toUpperCase()+e[2].substring(1)),n=e.join("")}return n}};window.find=Behave.find,window.fill=Behave.fill; \ No newline at end of file +(function(){function n(n,e,t){t=(t||0)-1;for(var r=n?n.length:0;++tr||"undefined"==typeof t)return 1;if(r>t||"undefined"==typeof r)return-1}return n.n-e.n}function i(n){var e=-1,r=n.length,u=n[0],i=n[0|r/2],o=n[r-1];if(u&&"object"==typeof u&&i&&"object"==typeof i&&o&&"object"==typeof o)return!1;for(u=f(),u["false"]=u["null"]=u["true"]=u.undefined=!1,i=f(),i.k=n,i.l=u,i.push=t;++et?0:t);++r3&&"function"==typeof o[f-2])var l=te(o[--f-1],o[f--],2);else f>2&&"function"==typeof o[f-1]&&(l=o[--f]);for(;++a=b&&f===n,v=u||h?a():s;if(h){var g=i(v);g?(f=e,v=g):(h=!1,v=u?v:(c(v),s))}for(;++of(v,y))&&((u||h)&&v.push(y),s.push(g))}return h?(c(v.k),p(v)):u&&c(v),s}function ae(n){return function(e,t,r){var u={};t=Y.createCallback(t,r,3),r=-1;var i=e?e.length:0;if("number"==typeof i)for(;++rt?$t(0,i+t):t)||0,zt(n)?o=-1i&&(i=a)}}else e=!e&&we(n)?r:Y.createCallback(e,t,3),Oe(n,function(n,t,r){t=e(n,t,r),t>u&&(u=t,i=n)});return i}function $e(n,e){var t=-1,r=n?n.length:0;if("number"==typeof r)for(var u=Xe(r);++targuments.length;e=te(e,r,4);var i=-1,o=n.length;if("number"==typeof o)for(u&&(t=n[++i]);++iarguments.length;return e=te(e,r,4),Te(n,function(n,r,i){t=u?(u=!1,n):e(t,n,r,i)}),t}function Ne(n){var e=-1,t=n?n.length:0,r=Xe("number"==typeof t?t:0);return Oe(n,function(n){var t=He(++e);r[e]=r[t],r[t]=n}),r}function Se(n,e,t){var r;e=Y.createCallback(e,t,3),t=-1;var u=n?n.length:0;if("number"==typeof u)for(;++t=b&&u===n;if(l){var c=i(a);c?(u=e,a=c):l=!1}for(;++ru(a,c)&&f.push(c);return l&&p(a),f}function De(n,e,t){var r=0,u=n?n.length:0;if("number"!=typeof e&&null!=e){var i=-1;for(e=Y.createCallback(e,t,3);++ir?$t(0,u+r):r||0}else if(r)return r=Le(e,t),e[r]===t?r:-1;return n(e,t,r)}function qe(n,e,t){if("number"!=typeof e&&null!=e){var r=0,u=-1,i=n?n.length:0;for(e=Y.createCallback(e,t,3);++uu;)r=u+i>>>1,t(n[r])t?0:t);++e0?c=_t(u,t):(o&&st(o),t=p,o=c=p=v,t&&(s=dt(),a=n.apply(l,i)))}var i,o,a,f,l,c,p,s=0,h=!1,g=!0;if(!me(n))throw new ot;if(e=$t(0,e)||0,!0===t)var y=!0,g=!1;else be(t)&&(y=t.leading,h="maxWait"in t&&($t(e,t.maxWait)||0),g="trailing"in t?t.trailing:g);return function(){if(i=arguments,f=dt(),l=this,p=g&&(c||!y),!1===h)var t=y&&!c;else{o||y||(s=f);var v=h-(f-s);v>0?o||(o=_t(r,v)):(o&&(o=st(o)),s=f,a=n.apply(l,i))}return c||e===h||(c=_t(u,e)),t&&(a=n.apply(l,i)),a}}function Ke(n){if(!me(n))throw new ot;var e=St.call(arguments,1);return _t(function(){n.apply(v,e)},1)}function Ve(n){return n}function Ge(n,e){var t=n,r=!e||me(t);e||(t=ne,e=n,n=Y),Oe(ye(e),function(u){var i=n[u]=e[u];r&&(t.prototype[u]=function(){var e=this.__wrapped__,r=[e];return mt.apply(r,arguments),r=i.apply(n,r),e&&"object"==typeof e&&e===r?this:(r=new t(r),r.__chain__=this.__chain__,r)})})}function He(n,e,t){var r=null==n,u=null==e;return null==t&&("boolean"==typeof n&&u?(t=n,n=1):u||"boolean"!=typeof e||(t=e,u=!0)),r&&u&&(e=1),n=+n||0,u?(e=n,n=0):e=+e||0,r=Nt(),t||n%1||e%1?At(n+r*(e-n+parseFloat("1e-"+((r+"").length-1))),e):n+ht(r*(e-n+1))}function Je(){return this.__wrapped__}t=t?Z.defaults(G.Object(),t,Z.pick(G,F)):G;var Xe=t.Array,Ye=t.Boolean,Ze=t.Date,nt=t.Function,et=t.Math,tt=t.Number,rt=t.Object,ut=t.RegExp,it=t.String,ot=t.TypeError,at=[],ft=rt.prototype,lt=t._,ct=ut("^"+it(ft.valueOf).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),pt=et.ceil,st=t.clearTimeout,ht=et.floor,vt=nt.prototype.toString,gt=ct.test(gt=rt.getPrototypeOf)&>,yt=ft.hasOwnProperty,dt=ct.test(dt=Ze.now)&&dt||function(){return+new Ze},mt=at.push,bt=t.setImmediate,_t=t.setTimeout,wt=at.splice,jt=ft.toString,xt=at.unshift,kt=function(){try{var n={},e=ct.test(e=rt.defineProperty)&&e,t=e(n,n,n)&&e}catch(r){}return t}(),Bt=ct.test(Bt=jt.bind)&&Bt,Ct=ct.test(Ct=rt.create)&&Ct,Ot=ct.test(Ot=Xe.isArray)&&Ot,Tt=t.isFinite,Et=t.isNaN,It=ct.test(It=rt.keys)&&It,$t=et.max,At=et.min,Ft=t.parseInt,Nt=et.random,St=at.slice,Rt=ct.test(t.attachEvent),Dt=Bt&&!/\n|true/.test(Bt+Rt),Mt={};Mt[S]=Xe,Mt[R]=Ye,Mt[D]=Ze,Mt[M]=nt,Mt[L]=rt,Mt[q]=tt,Mt[z]=ut,Mt[W]=it,ne.prototype=Y.prototype;var qt=Y.support={};qt.fastBind=Bt&&!Dt,qt.funcDecomp=!ct.test(t.a)&&$.test(h),qt.funcNames="string"==typeof nt.name,Y.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:T,variable:"",imports:{_:Y}},Ct||(le=function(n){if(be(n)){l.prototype=n;var e=new l;l.prototype=null}return e||{}});var Lt=kt?function(n,e){U.value=e,kt(n,"__bindData__",U)}:l,zt=Ot||function(n){return n&&"object"==typeof n&&"number"==typeof n.length&&jt.call(n)==S||!1},Wt=It?function(n){return be(n)?It(n):[]}:J,Pt={"&":"&","<":"<",">":">",'"':""","'":"'"},Qt=de(Pt),Ut=ut("("+Wt(Qt).join("|")+")","g"),Kt=ut("["+Wt(Pt).join("")+"]","g"),Vt=ae(function(n,e,t){yt.call(n,t)?n[t]++:n[t]=1}),Gt=ae(function(n,e,t){(yt.call(n,t)?n[t]:n[t]=[]).push(e)}),Ht=ae(function(n,e,t){n[t]=e});Dt&&X&&"function"==typeof bt&&(Ke=function(n){if(!me(n))throw new ot;return bt.apply(t,arguments)});var Jt=8==Ft(w+"08")?Ft:function(n,e){return Ft(we(n)?n.replace(E,""):n,e||0)};return Y.after=function(n,e){if(!me(e))throw new ot;return function(){return 1>--n?e.apply(this,arguments):void 0}},Y.assign=H,Y.at=function(n){for(var e=arguments,t=-1,r=re(e,!0,!1,1),e=e[2]&&e[2][e[1]]===n?1:r.length,u=Xe(e);++t=b&&i(o?r[o]:g)}n:for(;++l(d?e(d,y):s(g,y))){for(o=u,(d||g).push(y);--o;)if(d=f[o],0>(d?e(d,y):s(r[o],y)))continue n;v.push(y)}}for(;u--;)(d=f[u])&&p(d);return c(f),c(g),v},Y.invert=de,Y.invoke=function(n,e){var t=St.call(arguments,2),r=-1,u="function"==typeof e,i=n?n.length:0,o=Xe("number"==typeof i?i:0);return Oe(n,function(n){o[++r]=(u?e:n[e]).apply(n,t)}),o},Y.keys=Wt,Y.map=Ee,Y.max=Ie,Y.memoize=function(n,e){function t(){var r=t.cache,u=e?e.apply(this,arguments):m+arguments[0];return yt.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}if(!me(n))throw new ot;return t.cache={},t},Y.merge=function(n){var e=arguments,t=2;if(!be(n))return n;if("number"!=typeof e[2]&&(t=e.length),t>3&&"function"==typeof e[t-2])var r=te(e[--t-1],e[t--],2);else t>2&&"function"==typeof e[t-1]&&(r=e[--t]);for(var e=St.call(arguments,1,t),u=-1,i=a(),o=a();++ua&&(i=a)}}else e=!e&&we(n)?r:Y.createCallback(e,t,3),Oe(n,function(n,t,r){t=e(n,t,r),u>t&&(u=t,i=n)});return i},Y.omit=function(n,e,t){var r=pe(),u="function"==typeof e,i={};if(u)e=Y.createCallback(e,t,3);else var o=re(arguments,!0,!1,1);return _(n,function(n,t,a){(u?!e(n,t,a):0>r(o,t))&&(i[t]=n)}),i},Y.once=function(n){var e,t;if(!me(n))throw new ot;return function(){return e?t:(e=!0,t=n.apply(this,arguments),n=null,t)}},Y.pairs=function(n){for(var e=-1,t=Wt(n),r=t.length,u=Xe(r);++et?$t(0,r+t):At(t,r-1))+1);r--;)if(n[r]===e)return r;return-1},Y.mixin=Ge,Y.noConflict=function(){return t._=lt,this},Y.parseInt=Jt,Y.random=He,Y.reduce=Ae,Y.reduceRight=Fe,Y.result=function(n,e){if(n){var t=n[e];return me(t)?n[e]():t}},Y.runInContext=h,Y.size=function(n){var e=n?n.length:0;return"number"==typeof e?e:Wt(n).length},Y.some=Se,Y.sortedIndex=Le,Y.template=function(n,e,t){var r=Y.templateSettings;n||(n=""),t=V({},t,r);var u,i=V({},t.imports,r.imports),r=Wt(i),i=je(i),a=0,f=t.interpolate||I,l="__p+='",f=ut((t.escape||I).source+"|"+f.source+"|"+(f===T?B:I).source+"|"+(t.evaluate||I).source+"|$","g");n.replace(f,function(e,t,r,i,f,c){return r||(r=i),l+=n.slice(a,c).replace(A,o),t&&(l+="'+__e("+t+")+'"),f&&(u=!0,l+="';"+f+";__p+='"),r&&(l+="'+((__t=("+r+"))==null?'':__t)+'"),a=c+e.length,e}),l+="';\n",f=t=t.variable,f||(t="obj",l="with("+t+"){"+l+"}"),l=(u?l.replace(j,""):l).replace(x,"$1").replace(k,"$1;"),l="function("+t+"){"+(f?"":t+"||("+t+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var c=nt(r,"return "+l).apply(v,i)}catch(p){throw p.source=l,p}return e?c(e):(c.source=l,c)},Y.unescape=function(n){return null==n?"":it(n).replace(Ut,he)},Y.uniqueId=function(n){var e=++d;return it(null==n?"":n)+e},Y.all=ke,Y.any=Se,Y.detect=Ce,Y.findWhere=Ce,Y.foldl=Ae,Y.foldr=Fe,Y.include=xe,Y.inject=Ae,y(Y,function(n,e){Y.prototype[e]||(Y.prototype[e]=function(){var e=[this.__wrapped__],t=this.__chain__;return mt.apply(e,arguments),e=n.apply(Y,e),t?new ne(e,t):e})}),Y.first=De,Y.last=function(n,e,t){var r=0,u=n?n.length:0;if("number"!=typeof e&&null!=e){var i=u;for(e=Y.createCallback(e,t,3);i--&&e(n[i],i,n);)r++}else if(r=e,null==r||t)return n?n[u-1]:v;return s(n,$t(0,u-r))},Y.sample=function(n,e,t){var r=n?n.length:0;return"number"!=typeof r&&(n=je(n)),null==e||t?n?n[He(r-1)]:v:(n=Ne(n),n.length=At($t(0,e),n.length),n)},Y.take=De,Y.head=De,y(Y,function(n,e){var t="sample"!==e;Y.prototype[e]||(Y.prototype[e]=function(e,r){var u=this.__chain__,i=n(this.__wrapped__,e,r);return u||null!=e&&(!r||t&&"function"==typeof e)?new ne(i,u):i})}),Y.VERSION="2.2.1",Y.prototype.chain=function(){return this.__chain__=!0,this},Y.prototype.toString=function(){return it(this.__wrapped__)},Y.prototype.value=Je,Y.prototype.valueOf=Je,Oe(["join","pop","shift"],function(n){var e=at[n];Y.prototype[n]=function(){var n=this.__chain__,t=e.apply(this.__wrapped__,arguments);return n?new ne(t,n):t}}),Oe(["push","reverse","sort","unshift"],function(n){var e=at[n];Y.prototype[n]=function(){return e.apply(this.__wrapped__,arguments),this}}),Oe(["concat","slice","splice"],function(n){var e=at[n];Y.prototype[n]=function(){return new ne(e.apply(this.__wrapped__,arguments),this.__chain__)}}),Y}var v,g=[],y=[],d=0,m=+new Date+"",b=75,_=40,w=" \f \n\r\u2028\u2029 ᠎              ",j=/\b__p\+='';/g,x=/\b(__p\+=)''\+/g,k=/(__e\(.*?\)|\b__t\))\+'';/g,B=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,C=/\w*$/,O=/^function[ \n\r\t]+\w/,T=/<%=([\s\S]+?)%>/g,E=RegExp("^["+w+"]*0+(?=.$)"),I=/($^)/,$=/\bthis\b/,A=/['\n\r\t\u2028\u2029\\]/g,F="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),N="[object Arguments]",S="[object Array]",R="[object Boolean]",D="[object Date]",M="[object Function]",q="[object Number]",L="[object Object]",z="[object RegExp]",W="[object String]",P={};P[M]=!1,P[N]=P[S]=P[R]=P[D]=P[q]=P[L]=P[z]=P[W]=!0;var Q={leading:!1,maxWait:0,trailing:!1},U={configurable:!1,enumerable:!1,value:null,writable:!1},K={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},V={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"},G=K[typeof window]&&window||this,H=K[typeof exports]&&exports&&!exports.nodeType&&exports,J=K[typeof module]&&module&&!module.nodeType&&module,X=J&&J.exports===H&&H,Y=K[typeof global]&&global;!Y||Y.global!==Y&&Y.window!==Y||(G=Y);var Z=h();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(G._=Z,define(function(){return Z})):H&&J?X?(J.exports=Z)._=Z:H._=Z:G._=Z}).call(this),$.expr[":"].textEquals=function(n,e,t){var r=t[3],u=$(n).text().trim().match("^"+r+"$");return u&&u.length>0},$.expr[":"].textRoughMatch=function(n,e,t){var r=t[3],u=$(n).text().toLowerCase(),i=-1!==u.toLowerCase().indexOf(r.toLowerCase());return i},window.Behave={},Behave.view=$(document.body),Behave.domTypes={field:{elementTypes:["input","select","option","label","textarea","form"],attrOptions:["name","for","placeholder","contains","type","test-me"]},clickable:{elementTypes:["button","a","select"],attrOptions:["contains","href","test-me"]},icon:{elementTypes:["icon","div","span"],attrOptions:["type","class","test-me"]},display:{elementTypes:["table","tr","td","th",""],attrOptions:["test-me","contains"]}},Behave.find=function(n,e,t){t=t||{};var r="",u=e?{specificOption:Behave.domTypes[e]}:Behave.domTypes;if(_.each(u,function(e){_.each(e.elementTypes,function(t){return r.length?!1:void _.each(e.attrOptions,function(e){switch(e){case"contains":r=findByText(n,t);break;case"class":r=findByClass(n,t);break;default:var u="["+e+"='"+n+"']";r=tryToFind(t+u)}return r.length?!1:void 0})})}),r&&r.is("label")&&(r=getClosestInput(r)),r.length||(r=Behave.view.find(n)),!r.length&&!t.noErrors)throw new Error("Can't find element identified by "+n);if(r.length>1&&!t.findMany)throw new Error("Matched multiple elements identified by "+n+". Use findAll if that's what you expect.");return r},Behave.tryFind=function(n,e){return Behave.find(n,e,{noErrors:!0})},Behave.findAll=function(n,e){return Behave.find(n,e,{findMany:!0})},Behave.fill=function(n){var e=n instanceof jQuery?n:Behave.find(n,"field"),t=function(n){if(e.is("form")||"form"===e.attr("type")){if(!_.isObject(n))throw new Error("Must pass in a hash with signature of {element: value} when filling a whole form");return void _.each(n,function(n,e){Behave.fill(e).with(n)})}return"checkbox"===e.attr("type")?e.prop("checked",n):void e.val(n).trigger("input")},r={"with":t};return r},Behave.bexpect=function(n,e){if(_.isObject(jasmine))return jasmine.getGlobal().expect(_.isString(n)?Behave.find(n,e):n);throw new Error("It appears jasmine or expect isn't defined. Thus Behave can't delegate expect")},Behave.click=function(n){if(n instanceof jQuery)return n.is("input")&&"radio"===n.attr("type")?n.click().trigger("click"):n.trigger("click");if(_.isString(n))return Behave.find(n).trigger("click");throw new Error("The identifier passed to click was invalid. It must be either a string or jQuery object")},Behave.choose=function(n){var e=function(e){var t=e instanceof jQuery?e:Behave.find(e);return t.val(n).trigger("change")},t={from:e};return t};var tryToFind=function(n){var e="";try{e=Behave.view.find(n)}catch(t){if(!_.contains(t.message,"Syntax error"))throw t}return $(e)},getClosestInput=function(n){var e=n.next();if(e.is("input"))return e;var t=e.find("input");return t.length?t:n},findByClass=function(n,e){var t=_.contains(["icon","div","span"],e)?"glyphicon-":"";e=e||"";var r=e+"."+t+n;return tryToFind(r).first()},findByText=function(n,e){var t,r,u;return t=":textEquals","~"===n[0]&&(n=n.slice(1),t=":textRoughMatch"),r=t+"('"+n+"')",u=e+r,tryToFind(u)},cleanVal=function(n){if(n){if(n=n.replace(" ",""),_.contains(n,"-")){var e=n.split("-");e[1]=e[1][0].toUpperCase()+e[1].substring(1),e[2]&&(e[2]=e[2][0].toUpperCase()+e[2].substring(1)),n=e.join("")}return n}};window.find=Behave.find,window.fill=Behave.fill,window.findAll=Behave.findAll,window.tryFind=Behave.tryFind,window.bexpect=Behave.bexpect,window.click=Behave.click; \ No newline at end of file