spectacular_rails 1.6.0.2 → 1.6.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/font/FontAwesome.otf +0 -0
  3. data/app/assets/font/fontawesome-webfont.eot +0 -0
  4. data/app/assets/font/fontawesome-webfont.svg +399 -0
  5. data/app/assets/font/fontawesome-webfont.ttf +0 -0
  6. data/app/assets/font/fontawesome-webfont.woff +0 -0
  7. data/app/assets/javascripts/jade.js +208 -0
  8. data/app/assets/javascripts/snap.js +11 -0
  9. data/app/assets/javascripts/source-map.js +1804 -0
  10. data/app/assets/javascripts/source-map.min.js +1 -0
  11. data/app/assets/javascripts/spectacular.js +5692 -0
  12. data/app/assets/javascripts/spectacular.min.js +5 -0
  13. data/app/assets/javascripts/templates.js +103 -0
  14. data/app/assets/javascripts/templates.min.js +1 -0
  15. data/app/assets/stylesheets/font-awesome/css/font-awesome-ie7.css +1203 -0
  16. data/app/assets/stylesheets/font-awesome/css/font-awesome-ie7.min.css +384 -0
  17. data/app/assets/stylesheets/font-awesome/css/font-awesome.css.erb +1479 -0
  18. data/app/assets/stylesheets/font-awesome/css/font-awesome.min.css +403 -0
  19. data/app/assets/stylesheets/font-awesome/less/bootstrap.less +84 -0
  20. data/app/assets/stylesheets/font-awesome/less/core.less +129 -0
  21. data/app/assets/stylesheets/font-awesome/less/extras.less +93 -0
  22. data/app/assets/stylesheets/font-awesome/less/font-awesome-ie7.less +1953 -0
  23. data/app/assets/stylesheets/font-awesome/less/font-awesome.less +33 -0
  24. data/app/assets/stylesheets/font-awesome/less/icons.less +381 -0
  25. data/app/assets/stylesheets/font-awesome/less/mixins.less +48 -0
  26. data/app/assets/stylesheets/font-awesome/less/path.less +14 -0
  27. data/app/assets/stylesheets/font-awesome/less/variables.less +735 -0
  28. data/app/assets/stylesheets/font-awesome/scss/_bootstrap.scss +84 -0
  29. data/app/assets/stylesheets/font-awesome/scss/_core.scss +129 -0
  30. data/app/assets/stylesheets/font-awesome/scss/_extras.scss +93 -0
  31. data/app/assets/stylesheets/font-awesome/scss/_icons.scss +381 -0
  32. data/app/assets/stylesheets/font-awesome/scss/_mixins.scss +48 -0
  33. data/app/assets/stylesheets/font-awesome/scss/_path.scss +14 -0
  34. data/app/assets/stylesheets/font-awesome/scss/_variables.scss +734 -0
  35. data/app/assets/stylesheets/font-awesome/scss/font-awesome-ie7.scss +1953 -0
  36. data/app/assets/stylesheets/font-awesome/scss/font-awesome.scss +33 -0
  37. data/app/assets/stylesheets/spectacular.css +950 -0
  38. data/lib/spectacular_rails/version.rb +1 -1
  39. data/lib/spectacular_rails.rb +0 -18
  40. metadata +37 -1
@@ -0,0 +1,5 @@
1
+ (function(){var BADGE_MAP,CHAR_MAP,COLOR_MAP,LINE_RE,Plurals,URI_RE,a,addClass,ancestors,buildHTML,currentWindowOnload,defaults,displayErrors,errors,escapeHTML,exports,fixNodeHeight,hasClass,hasErrors,icon,isCommonJS,k,params,removeClass,selfAndAncestors,spectacular,stripHTML,tag,toggleClass,utils,v,viewerSize,wrapNode,_ref,_ref1,__slice=[].slice,__indexOf=[].indexOf||function(item){for(var i=0,l=this.length;i<l;i++){if(i in this&&this[i]===item)return i}return-1},__hasProp={}.hasOwnProperty,__extends=function(child,parent){for(var key in parent){if(__hasProp.call(parent,key))child[key]=parent[key]}function ctor(){this.constructor=child}ctor.prototype=parent.prototype;child.prototype=new ctor;child.__super__=parent.prototype;return child},__bind=function(fn,me){return function(){return fn.apply(me,arguments)}};Object.getPropertyDescriptor=function(o,name){var descriptor,proto;proto=o;descriptor=void 0;while(proto&&!(descriptor=Object.getOwnPropertyDescriptor(proto,name))){proto=(typeof Object.getPrototypeOf==="function"?Object.getPrototypeOf(proto):void 0)||proto.__proto__}return descriptor};Function.prototype.include=function(){var excl,excluded,k,mixin,mixins,v,_i,_len,_ref;mixins=1<=arguments.length?__slice.call(arguments,0):[];excluded=["constructor","excluded"];for(_i=0,_len=mixins.length;_i<_len;_i++){mixin=mixins[_i];excl=excluded.concat();if(mixin.prototype.excluded!=null){excl=excl.concat(mixin.prototype.excluded)}_ref=mixin.prototype;for(k in _ref){v=_ref[k];if(__indexOf.call(excl,k)<0){this.prototype[k]=v}}if(typeof mixin.included==="function"){mixin.included(this)}}return this};Function.prototype.extend=function(){var excl,excluded,k,mixin,mixins,v,_i,_len;mixins=1<=arguments.length?__slice.call(arguments,0):[];excluded=["extended","excluded","included"];for(_i=0,_len=mixins.length;_i<_len;_i++){mixin=mixins[_i];excl=excluded.concat();if(mixin.excluded!=null){excl=excl.concat(mixin.excluded)}for(k in mixin){v=mixin[k];if(__indexOf.call(excl,k)<0){this[k]=v}}if(typeof mixin.extended==="function"){mixin.extended(this)}}return this};Function.prototype.concern=function(){var mixins;mixins=1<=arguments.length?__slice.call(arguments,0):[];this.include.apply(this,mixins);return this.extend.apply(this,mixins)};Function.prototype.getter=function(name,block){var oldDescriptor,set;oldDescriptor=Object.getPropertyDescriptor(this.prototype,name);if(oldDescriptor!=null){set=oldDescriptor.set}Object.defineProperty(this.prototype,name,{get:block,set:set,configurable:true,enumerable:true});return this};Function.prototype.setter=function(name,block){var get,oldDescriptor;oldDescriptor=Object.getPropertyDescriptor(this.prototype,name);if(oldDescriptor!=null){get=oldDescriptor.get}Object.defineProperty(this.prototype,name,{set:block,get:get,configurable:true,enumerable:true});return this};Function.prototype.accessor=function(name,options){return Object.defineProperty(this.prototype,name,{get:options.get,set:options.set,configurable:true,enumerable:true})};Function.prototype.signature=function(){var re,_ref;re=/^function(\s+[a-zA-Z_][a-zA-Z0-9_]*)*\s*\(([^\)]+)\)/;return((_ref=re.exec(this.toString()))!=null?_ref[2].split(/\s*,\s*/):void 0)||[]};isCommonJS=typeof window==="undefined";if(isCommonJS){exports=exports||{}}else{exports=window}exports.spectacular=exports.spectacular||{};spectacular=exports.spectacular;spectacular.version="1.4.0";spectacular.global=function(){if(typeof window!=="undefined"){return window}if(typeof global!=="undefined"){return global}return{}}();spectacular.deprecated=function(message){var caller,deprecatedMethodCallerFile,deprecatedMethodCallerName,e,parseLine,s,_ref;parseLine=function(line){var f,m,o,_ref,_ref1,_ref2,_ref3;if(line.indexOf("@")>0){if(line.indexOf("</")>0){_ref=/<\/([^@]+)@(.)+$/.exec(line),m=_ref[0],o=_ref[1],f=_ref[2]}else{_ref1=/@(.)+$/.exec(line),m=_ref1[0],f=_ref1[1]}}else{if(line.indexOf("(")>0){_ref2=/at\s+([^\s]+)\s*\(([^\)])+/.exec(line),m=_ref2[0],o=_ref2[1],f=_ref2[2]}else{_ref3=/at\s+([^\s]+)/.exec(line),m=_ref3[0],f=_ref3[1]}}return[o,f]};e=new Error;caller="";if(e.stack!=null){s=e.stack.split("\n");_ref=parseLine(s[3]),deprecatedMethodCallerName=_ref[0],deprecatedMethodCallerFile=_ref[1];caller=deprecatedMethodCallerName?" (called from "+deprecatedMethodCallerName+" at "+deprecatedMethodCallerFile+")":"(called from "+deprecatedMethodCallerFile+")"}return console.log("DEPRECATION WARNING: "+message+caller)};spectacular.deprecated._name="deprecated";spectacular.nextTick=(typeof process!=="undefined"&&process!==null?process.setImmediate:void 0)||(typeof process!=="undefined"&&process!==null?process.nextTick:void 0)||(typeof window!=="undefined"&&window!==null?window.setImmediate:void 0)||(typeof window!=="undefined"&&window!==null?window.nextTick:void 0)||function(callback){return setTimeout(callback,0)};utils=spectacular.utils||(spectacular.utils={});spectacular.utils.squeeze=function(s){return s.replace(/\s+/g," ")};spectacular.utils.strip=function(s){return s.replace(/^\s+|\s+$/g,"")};spectacular.utils.capitalize=function(s){return s.replace(/^(\w)/,function(m,c){return c.toUpperCase()})};spectacular.utils.underscore=function(s){return s.replace(/([a-z])([A-Z])/g,"$1_$2").split(/[-/]|\s/g).join("_").toLowerCase()};spectacular.utils.camelize=function(s){var a,w,_i,_len;a=s.toLowerCase().split(/[_\s-]/);s=a.shift();for(_i=0,_len=a.length;_i<_len;_i++){w=a[_i];s=""+s+utils.capitalize(w)}return s};spectacular.utils.snakify=function(o){var descriptor,k,v,_results;_results=[];for(k in o){v=o[k];descriptor=Object.getOwnPropertyDescriptor(o,k);if(descriptor!=null){_results.push(Object.defineProperty(o,utils.underscore(k),descriptor))}else{_results.push(o[utils.underscore(k)]=v)}}return _results};spectacular.utils.keys=function(o){var k,_results;_results=[];for(k in o){_results.push(k)}return _results};spectacular.utils.isArray=function(o){return Object.prototype.toString.call(o)==="[object Array]"};spectacular.utils.literalEnumeration=function(array){var last,result;if(array.length>1){last=array.pop();result=array.join(", ");result+=" and "+last}else{result=array.toString()}return result};spectacular.utils.fill=function(l,s){var o;if(l==null){l=4}if(s==null){s=" "}o="";while(o.length<l){o=""+o+s}return o};spectacular.utils.uniq=function(arr){var newArr,v,_i,_len;newArr=[];for(_i=0,_len=arr.length;_i<_len;_i++){v=arr[_i];if(__indexOf.call(newArr,v)<0){newArr.push(v)}}return newArr};spectacular.utils.escapeDiff=function(s){return utils.escape(s.replace(/<del>/g,"[[del]]").replace(/<\/del>/g,"[[/del]]").replace(/<ins>/g,"[[ins]]").replace(/<\/ins>/g,"[[/ins]]")).replace(/\[\[del\]\]/g,"<del>").replace(/\[\[\/del\]\]/g,"</del>").replace(/\[\[ins\]\]/g,"<ins>").replace(/\[\[\/ins\]\]/g,"</ins>")};spectacular.utils.escape=function(s){var n;n=s;n=n.replace(/&/g,"&amp;");n=n.replace(/</g,"&lt;");n=n.replace(/>/g,"&gt;");n=n.replace(/"/g,"&quot;");return n};spectacular.utils.unescape=function(s){var n;n=s;n=n.replace(/&amp;/g,"&");n=n.replace(/&lt;/g,"<");n=n.replace(/&gt;/g,">");n=n.replace(/&quot;/g,'"');return n};spectacular.utils.indent=function(string,ind){var i,s,_i,_ref;if(ind==null){ind=4}s="";for(i=_i=0,_ref=ind-1;0<=_ref?_i<=_ref:_i>=_ref;i=0<=_ref?++_i:--_i){s=""+s+" "}return""+s+string.replace(/\n/g,"\n"+s)};spectacular.utils.padRight=function(string,pad){if(pad==null){pad=4}string=string.toString();while(string.length<pad){string=" "+string}return string};spectacular.utils.toggle=function(value,c1,c2){if(value){return c2}else{return c1}};spectacular.utils.TAGS=isCommonJS?{diffStart:"",diffEnd:"",delStart:"",delEnd:"",insStart:"",insEnd:"",space:""}:{diffStart:'<span class="diff">',diffEnd:"</span>",delStart:"<del>",delEnd:"</del>",insStart:"<ins>",insEnd:"</ins>",space:""};spectacular.utils.ins=function(str){return utils.TAGS.insStart+str+utils.TAGS.insEnd};spectacular.utils.del=function(str){return utils.TAGS.delStart+str+utils.TAGS.delEnd};spectacular.utils.descOfNode=function(actual){if(actual!=null){if(actual.length!=null){return utils.inspect(Array.prototype.map.call(actual,function(e){return e.outerHTML}))}else{return utils.inspect(actual.outerHTML)}}else{return actual}};spectacular.utils.diff=function(o,n){var i,ns,os;ns=new Object;os=new Object;i=0;while(i<n.length){if(ns[n[i]]==null||typeof ns[n[i]]!=="object"){ns[n[i]]={rows:new Array,o:null}}ns[n[i]].rows.push(i);i++}i=0;while(i<o.length){if(os[o[i]]==null||typeof os[n[i]]!=="object"){os[o[i]]={rows:new Array,n:null}}os[o[i]].rows.push(i);i++}for(i in ns){if(ns[i].rows.length===1&&typeof os[i]!=="undefined"&&os[i].rows.length===1){n[ns[i].rows[0]]={text:n[ns[i].rows[0]],row:os[i].rows[0]};o[os[i].rows[0]]={text:o[os[i].rows[0]],row:ns[i].rows[0]}}}i=0;while(i<n.length-1){if(n[i].text!=null&&n[i+1].text==null&&n[i].row+1<o.length&&o[n[i].row+1].text==null&&n[i+1]===o[n[i].row+1]){n[i+1]={text:n[i+1],row:n[i].row+1};o[n[i].row+1]={text:o[n[i].row+1],row:i+1}}i++}i=n.length-1;while(i>0){if(n[i].text!=null&&n[i-1].text==null&&n[i].row>0&&o[n[i].row-1].text==null&&n[i-1]===o[n[i].row-1]){n[i-1]={text:n[i-1],row:n[i].row-1};o[n[i].row-1]={text:o[n[i].row-1],row:i-1}}i--}return{o:o,n:n}};spectacular.utils.stringDiff=function(o,n){var i,nSpace,oSpace,out,pre,str;if(n==null||n.length===0){return utils.del(o)}if(o==null||o.length===0){return utils.ins(n)}o=String(o).replace(/\s+$/,"");n=String(n).replace(/\s+$/,"");out=utils.diff(o===""?[]:o.split(/\s+/),n===""?[]:n.split(/\s+/));str="";oSpace=o.match(/\s+/g);if(oSpace==null){oSpace=[utils.TAGS.space]}else{oSpace.push(utils.TAGS.space)}nSpace=n.match(/\s+/g);if(nSpace==null){nSpace=[utils.TAGS.space]}else{nSpace.push(utils.TAGS.space)}if(out.n.length===0){i=0;while(i<out.o.length){str+=utils.del(utils.escape(out.o[i])+oSpace[i]);i++}}else{if(out.n[0].text==null){n=0;while(n<out.o.length&&out.o[n].text==null){str+=utils.del(utils.escape(out.o[n])+oSpace[n]);n++}}i=0;while(i<out.n.length){if(out.n[i].text==null){str+=utils.ins(utils.escape(out.n[i])+nSpace[i])}else{pre="";n=out.n[i].row+1;while(n<out.o.length&&out.o[n].text==null){pre+=utils.del(utils.escape(out.o[n])+oSpace[n]);n++}str+=""+out.n[i].text+nSpace[i]+pre}i++}}return str};spectacular.utils.inspect=function(obj,depth,lookup){var ind,k,v;if(depth==null){depth=1}if(lookup==null){lookup=[]}switch(typeof obj){case"string":return"'"+obj+"'";case"number":case"boolean":return""+obj;case"object":if(obj==null){return"null"}if(__indexOf.call(lookup,obj)>=0){return"[circular]"}lookup.push(obj);ind=utils.fill(depth*2);if(utils.isArray(obj)){if(obj.length===0){return"[]"}return"[\n"+obj.map(function(o){return ind+utils.inspect(o,depth+1,lookup)}).join(",\n")+"\n"+ind.slice(0,-2)+"]"}else{if(utils.keys(obj).length===0){return"{}"}return"{\n"+function(){var _results;_results=[];for(k in obj){v=obj[k];_results.push(""+ind+k+": "+utils.inspect(v,depth+1,lookup))}return _results}().join(",\n")+"\n"+ind.slice(0,-2)+"}"}break;case"function":if(obj.name){return obj.name}else if(obj._name){return obj._name}else{return obj.toString()}break;default:return"undefined"}};spectacular.utils.objectDiff=function(left,right,depth){var a,allKeys,i,ind,k,key,l,p,prevInd,s,typeLeft,typeRight;if(depth==null){depth=1}typeLeft=typeof left;typeRight=typeof right;if(typeLeft!==typeRight){s="";if(left!=null){s+=utils.del(utils.inspect(left,depth))}if(right!=null){s+=utils.ins(utils.inspect(right,depth))}return s}switch(typeLeft){case"string":return utils.inspect(utils.stringDiff(left,right));case"number":case"boolean":return utils.stringDiff(left.toString(),right.toString());case"object":if(utils.isArray(left)!==utils.isArray(right)){return utils.del(utils.inspect(left,depth))+utils.ins(utils.inspect(right,depth))}ind=utils.fill(depth*2);prevInd=utils.fill((depth-1)*2);if(utils.isArray(left)){l=Math.max(left.length,right.length);s="[";a=function(){var _i,_ref,_results;_results=[];for(i=_i=0,_ref=l-1;0<=_ref?_i<=_ref:_i>=_ref;i=0<=_ref?++_i:--_i){_results.push("\n"+ind+utils.objectDiff(left[i],right[i],depth+1))}return _results}();return s+=a.join(",")+("\n"+prevInd+"]")}else{allKeys=utils.uniq(utils.keys(left).concat(utils.keys(right)));s="{";a=function(){var _i,_len,_results;_results=[];for(_i=0,_len=allKeys.length;_i<_len;_i++){k=allKeys[_i];key=k+": ";p="";if(!right[k]){p=utils.del(""+key+left[k])}else if(!left[k]){p=utils.ins(""+key+right[k])}else{p=key+utils.objectDiff(left[k],right[k],depth+1)}_results.push("\n"+ind+p)}return _results}();return s+=a.join(",")+("\n"+prevInd+"}")}}};spectacular.utils.compare=function(actual,value,diff,noMessage){var i,k,v,_i,_len;if(noMessage==null){noMessage=false}switch(typeof value){case"object":if(utils.isArray(actual)){if(!noMessage){diff.diff=utils.TAGS.diffStart+(""+diff.diff+"\n\n"+utils.objectDiff(actual,value))+utils.TAGS.diffEnd}if(actual.length!==value.length){return false}for(i=_i=0,_len=value.length;_i<_len;i=++_i){v=value[i];if(!utils.compare(actual[i],v,diff,true)){return false}}return true}else{if(!noMessage){diff.diff=utils.TAGS.diffStart+(""+diff.diff+"\n\n"+utils.objectDiff(actual,value))+utils.TAGS.diffEnd}if(utils.keys(actual).length!==utils.keys(value).length){return false}for(k in value){v=value[k];if(!utils.compare(actual[k],v,diff,true)){return false}}return true}break;case"string":if(!noMessage){diff.diff=utils.TAGS.diffStart+(""+diff.diff+"\n\n'"+utils.stringDiff(actual,value)+"'")+utils.TAGS.diffEnd}return actual===value;default:return actual===value}};spectacular.utils.findStateMethodOrProperty=function(obj,state){var camelizedVersion,snakedVersion;camelizedVersion="is"+utils.capitalize(state);snakedVersion="is_"+state;if(obj[state]!=null){return state}else if(obj[camelizedVersion]!=null){return camelizedVersion}else if(obj[snakedVersion]!=null){return snakedVersion}else{return null}};for(k in utils){v=utils[k];v._name=k}spectacular.utils.colorize=function(str,color,colorsEnabled){if(colorsEnabled==null){colorsEnabled=false}if(str!=null&&colorsEnabled&&(str!=null?str[color]:void 0)){return str[color]}else{return str}};URI_RE="((http:\\/\\/)?.*\\.(js|coffee))(\\?[^:]*)*";LINE_RE=":(\\d+)(:(\\d+))*";spectacular.errors={};spectacular.errors.GeckoParser=function(){function GeckoParser(){}GeckoParser.prototype.match=function(stack){return/@/g.test(stack)};GeckoParser.prototype.filter=function(line){return/@/.test(line)};GeckoParser.prototype.details=function(line){var c,column,e,file,h,match,method,p,q,re,_ref;re=RegExp("\\s*([^\\s]*)(@)"+URI_RE+LINE_RE);_ref=re.exec(line),match=_ref[0],method=_ref[1],p=_ref[2],file=_ref[3],h=_ref[4],e=_ref[5],q=_ref[6],line=_ref[7],c=_ref[8],column=_ref[9];return{file:file,line:line,column:column,method:method}};return GeckoParser}();spectacular.errors.V8Parser=function(){function V8Parser(){}V8Parser.prototype.match=function(stack){return/\s+at\s+/g.test(stack)};V8Parser.prototype.filter=function(line){return/\s+at\s+/.test(line)};V8Parser.prototype.details=function(line){var c,column,e,file,h,match,method,p,q,re,_ref;re=RegExp("at\\s*(([^\\s]*)\\s*\\(|\\()*"+URI_RE+LINE_RE);_ref=re.exec(line),match=_ref[0],p=_ref[1],method=_ref[2],file=_ref[3],h=_ref[4],e=_ref[5],q=_ref[6],line=_ref[7],c=_ref[8],column=_ref[9];return{file:file,line:line,column:column,method:method,params:q}};return V8Parser}();spectacular.errors.ErrorParser=function(){ErrorParser.supportedFormats=[new spectacular.errors.V8Parser,new spectacular.errors.GeckoParser];function ErrorParser(stack){this.stack=stack;this.detectFormat();this.splitLines()}ErrorParser.prototype.splitLines=function(){this.lines=this.stack.split("\n").filter(this.format.filter);return this.size=this.lines.length};ErrorParser.prototype.detectFormat=function(){var format,_i,_len,_ref,_results;_ref=ErrorParser.supportedFormats;_results=[];for(_i=0,_len=_ref.length;_i<_len;_i++){format=_ref[_i];if(format.match(this.stack)){_results.push(this.format=format)}}return _results};ErrorParser.prototype.find=function(query){return this.lines.filter(function(line){return RegExp(""+query).test(line)})};ErrorParser.prototype.details=function(line){return this.format.details(line)};return ErrorParser}();spectacular.HasAncestors=function(){function HasAncestors(){}HasAncestors.included=function(ctor){ctor.getter("ancestors",function(){var ancestors,parent;ancestors=[];parent=this.parent;while(parent){ancestors.push(parent);parent=parent.parent}return ancestors});return ctor.ancestorsScope=function(name,block){return this.getter(name,function(){return this.ancestors.filter(block)})}};HasAncestors.prototype.nthAncestor=function(level){var n,parent,_i;if(level<1){level=1}parent=this;n=0;for(n=_i=0;0<=level?_i<=level:_i>=level;n=0<=level?++_i:--_i){parent=parent.parent}return parent};return HasAncestors}();spectacular.Globalizable=function(){function Globalizable(){}Globalizable.unglobalizable=["globalize","unglobalize","keepContext","globalizeMember","unglobalizeMember","globalizable","globalized","alternate","previous"];Globalizable.prototype.keepContext=true;Globalizable.prototype.globalize=function(){var _this=this;this.previous||(this.previous={});this.globalizable.forEach(function(k){if(__indexOf.call(_this.constructor.unglobalizable||Globalizable.unglobalizable,k)<0){return _this.globalizeMember(k,_this[k])}});return this.globalized=true};Globalizable.prototype.unglobalize=function(){var _this=this;this.globalizable.forEach(function(k){if(__indexOf.call(_this.constructor.unglobalizable||Globalizable.unglobalizable,k)<0){return _this.unglobalizeMember(k,_this[k])}});return this.globalized=false};Globalizable.prototype.globalizeMember=function(key,value,alternate){var alt,proxy,self,_global;if(alternate==null){alternate=true}_global=spectacular.global;if(_global[key]!=null){this.previous[key]=_global[key]}self=this;if(typeof value==="function"){if(value._name==null){value._name=key}if(this.keepContext){proxy=function(){return value.apply(self,arguments)};proxy._name=key;_global[key]=proxy}else{_global[key]=value}}else{_global[key]=value}if(alternate){alt=this.alternate(key);if(alt!==key){return this.globalizeMember(alt,value,false)}}};Globalizable.prototype.unglobalizeMember=function(key,value,alternate){var alt,_global;if(alternate==null){alternate=true}_global=spectacular.global;if(this.previous[key]!=null){_global[key]=this.previous[key]}else{delete _global[key]}if(alternate){alt=this.alternate(key);if(alt!==key){return this.unglobalizeMember(alt,value,false)}}};Globalizable.prototype.alternate=function(key){if(key.indexOf("_")===-1){return utils.underscore(key)}else{return utils.camelize(key)}};return Globalizable}();spectacular.Hookable=function(){function Hookable(){}Hookable.hook=function(name){var capitalizedName;capitalizedName=utils.capitalize(name);this.mergeUp(""+name+"Hooks");return this.accessor("own"+capitalizedName+"Hooks",{get:function(){var _name;return this[_name="__own"+capitalizedName+"Hooks"]||(this[_name]=[])},set:function(v){return this["__own"+capitalizedName+"Hooks"]=v}})};Hookable.prototype.registerHook=function(name,block){var capitalizedName;capitalizedName=utils.capitalize(name);return this["own"+capitalizedName+"Hooks"].push(block)};return Hookable}();spectacular.GlobalizableObject=function(){GlobalizableObject.include(spectacular.Globalizable);GlobalizableObject.unglobalizable=spectacular.Globalizable.unglobalizable.concat("set");function GlobalizableObject(){var __globalizable;__globalizable=1<=arguments.length?__slice.call(arguments,0):[];this.__globalizable=__globalizable}Object.defineProperty(GlobalizableObject.prototype,"globalizable",{configurable:true,get:function(){if(this.__globalizable.length>0){return this.__globalizable}else{return utils.keys(this)}}});GlobalizableObject.prototype.set=function(property,value){this[property]=value;if(this.globalized){return this.globalizeMember(property,value)}};return GlobalizableObject}();spectacular.HasCollection=function(plural,singular){var ConcreteHasCollection,capitalizedPlural,capitalizedSingular,mixin;capitalizedSingular=utils.capitalize(singular);capitalizedPlural=utils.capitalize(plural);mixin=ConcreteHasCollection=function(){function ConcreteHasCollection(){}ConcreteHasCollection.included=function(ctor){return ctor[""+plural+"Scope"]=function(name,block){return ctor.getter(name,function(){return this[plural].filter(block)})}};return ConcreteHasCollection}();mixin.prototype["add"+capitalizedSingular]=function(){var item,items,_i,_len,_results;items=1<=arguments.length?__slice.call(arguments,0):[];_results=[];for(_i=0,_len=items.length;_i<_len;_i++){item=items[_i];if(__indexOf.call(this[plural],item)<0){_results.push(this[plural].push(item))}}return _results};mixin.prototype["remove"+capitalizedSingular]=function(){var item,items,newArray,_i,_len,_ref;items=1<=arguments.length?__slice.call(arguments,0):[];newArray=[];_ref=this[plural];for(_i=0,_len=_ref.length;_i<_len;_i++){item=_ref[_i];if(__indexOf.call(items,item)<0){newArray.push(item)}}return this[plural]=newArray};mixin.prototype[""+singular+"At"]=function(index){return this[plural][index]};mixin.prototype["find"+capitalizedSingular]=mixin.prototype["indexOf"+capitalizedSingular]=function(item){return this[plural].indexOf(item)};mixin.prototype["has"+capitalizedSingular]=mixin.prototype["contains"+capitalizedSingular]=function(item){return this[plural].indexOf(item)!==-1};mixin.prototype[""+plural+"Length"]=mixin.prototype[""+plural+"Size"]=mixin.prototype[""+plural+"Count"]=function(){return this[plural].length};return mixin};spectacular.HasNestedCollection=function(name,options){var ConcreteHasNestedCollection,mixin,through;if(options==null){options={}}through=options.through;if(through==null){throw new Error("missing through option")}mixin=ConcreteHasNestedCollection=function(){function ConcreteHasNestedCollection(){}ConcreteHasNestedCollection.included=function(ctor){ctor[""+name+"Scope"]=function(scopeName,block){return ctor.getter(scopeName,function(){return this[name].filter(block)})};return ctor.getter(name,function(){var items;items=[];this[through].forEach(function(item){items.push(item);if(item[name]!=null){return items=items.concat(item[name])}});return items})};return ConcreteHasNestedCollection}();return mixin};spectacular.AncestorsProperties=function(){function AncestorsProperties(){}AncestorsProperties.followUp=function(property){var capitalizedProperty,privateProperty;capitalizedProperty=utils.capitalize(property);privateProperty="own"+capitalizedProperty;return this.accessor(property,{get:function(){var _ref;return this[privateProperty]||((_ref=this.parent)!=null?_ref[property]:void 0)},set:function(value){return this[privateProperty]=value}})};AncestorsProperties.mergeUp=function(property){var capitalizedProperty,privateProperty;capitalizedProperty=utils.capitalize(property);privateProperty="own"+capitalizedProperty;return this.accessor(property,{get:function(){var a;a=this[privateProperty];if(this.parent!=null){a=this.parent[property].concat(a)}return a},set:function(value){return this[privateProperty]=value}})};return AncestorsProperties}();spectacular.Describable=function(){function Describable(){}Describable.included=function(ctor){return ctor.getter("description",function(){var space,_ref;if(((_ref=this.parent)!=null?_ref.description:void 0)!=null){space="";if(!this.noSpaceBeforeDescription){space=" "}return""+this.parent.description+space+this.ownDescription}else{return this.ownDescription}})};return Describable}();spectacular.Event=function(){function Event(name,target){this.name=name;this.target=target}return Event}();spectacular.EventDispatcher=function(){function EventDispatcher(){}EventDispatcher.prototype.on=function(event,callback){var _base;this.listeners||(this.listeners={});(_base=this.listeners)[event]||(_base[event]=[]);if(__indexOf.call(this.listeners[event],callback)<0){return this.listeners[event].push(callback)}};EventDispatcher.prototype.off=function(event,callback){var _ref;if(((_ref=this.listeners)!=null?_ref[event]:void 0)!=null&&__indexOf.call(this.listeners[event],callback)>=0){return this.listeners[event].splice(this.listeners[event].indexOf(callback),1)}};EventDispatcher.prototype.hasListener=function(event){var _ref;return((_ref=this.listeners)!=null?_ref[event]:void 0)!=null&&this.listeners[event].length>0};EventDispatcher.prototype.dispatch=function(event){var _ref,_ref1;return(_ref=this.listeners)!=null?(_ref1=_ref[event.name])!=null?_ref1.forEach(function(listener){return listener(event)}):void 0:void 0};return EventDispatcher}();spectacular.factories||(spectacular.factories=new spectacular.GlobalizableObject("build","create","factory","factoryMixin"));spectacular.factories.keepContext=false;spectacular.factories.buildMethodsCache={};spectacular.factories.build=function(ctor,args){var argumentsSignature,comma,f,n;if(args==null){args=[]}f=spectacular.factories.buildMethodsCache[args.length]!=null?spectacular.factories.buildMethodsCache[args.length]:(argumentsSignature="",comma="",args.length>0?(argumentsSignature=function(){var _i,_ref,_results;_results=[];for(n=_i=0,_ref=args.length-1;0<=_ref?_i<=_ref:_i>=_ref;n=0<=_ref?++_i:--_i){_results.push("arg"+n)}return _results}().join(","),comma=","):void 0,spectacular.factories.buildMethodsCache[args.length]=new Function("ctor"+comma+argumentsSignature,"return new ctor("+argumentsSignature+");"));return f.apply(null,[ctor].concat(args))};spectacular.factories.Set=function(){function Set(property,value){this.property=property;this.value=value}Set.prototype.apply=function(instance){if(typeof this.value==="function"){return instance[this.property]=this.value()}else{return instance[this.property]=this.value}};return Set}();spectacular.factories.Trait=function(){Trait.concern(spectacular.Hookable);Trait.include(spectacular.Globalizable);Trait.include(spectacular.HasAncestors);Trait.extend(spectacular.AncestorsProperties);Trait.followUp("arguments");Trait.followUp("buildBlock");Trait.hook("build");Trait.prototype.globalizable="set createWith build after".split(/\s+/g);function Trait(name){this.name=name;this.previous={};this.setters=[]}Trait.prototype.set=function(property,value){return this.setters.push(new spectacular.factories.Set(property,value))};Trait.prototype.build=function(ownBuildBlock){this.ownBuildBlock=ownBuildBlock};Trait.prototype.createWith=function(){var ownArguments;ownArguments=1<=arguments.length?__slice.call(arguments,0):[];this.ownArguments=ownArguments};Trait.prototype.after=function(hook,block){return this.registerHook(hook,block)};Trait.prototype.applySet=function(instance){return this.setters.forEach(function(setter){return setter.apply(instance)})};return Trait}();spectacular.factories.Factory=function(_super){__extends(Factory,_super);Factory.prototype.globalizable="set trait createWith build include after".split(/\s+/g);function Factory(name,_class){this["class"]=_class;Factory.__super__.constructor.call(this,name);this.traits={}}Factory.prototype.trait=function(name,block){var trait,_base;trait=(_base=this.traits)[name]||(_base[name]=new spectacular.factories.Trait(name));trait.globalize();block.call(trait);return trait.unglobalize()};Factory.prototype.buildInstance=function(traits,options){var args,hook,hooks,instance,trait,_i,_j,_len,_len1;if(options==null){options={}}args=this.getConstructorArguments(traits);instance=this.parent!=null?this.parent.instanciate(args,traits):this.instanciate(args,traits);this.applySet(instance);for(_i=0,_len=traits.length;_i<_len;_i++){trait=traits[_i];this.findTrait(trait).applySet(instance)}for(k in options){v=options[k];instance[k]=v}hooks=this.fromTraitAndThis("buildHooks",traits);for(_j=0,_len1=hooks.length;_j<_len1;_j++){hook=hooks[_j];hook.call(instance,instance)}return instance};Factory.prototype.instanciate=function(args,traits){var buildBlock;buildBlock=this.fromTraitOrThis("buildBlock",traits);if(buildBlock!=null){return buildBlock.apply(this,[this["class"]].concat(args))}else{return build(this["class"],args)}};Factory.prototype.fromTraitOrThis=function(property,traits){var trait,traitValue,value,_i,_len;value=this[property];for(_i=0,_len=traits.length;_i<_len;_i++){trait=traits[_i];traitValue=this.findTrait(trait)[property];if(traitValue!=null){value=traitValue}}return value};Factory.prototype.fromTraitAndThis=function(property,traits){var trait,traitValue,value,_i,_len;value=this[property];for(_i=0,_len=traits.length;_i<_len;_i++){trait=traits[_i];traitValue=this.findTrait(trait)[property];if(traitValue!=null){value=value.concat(traitValue)}}return value};Factory.prototype.include=function(){var mixin,mixinName,mixins,_i,_len,_results;mixins=1<=arguments.length?__slice.call(arguments,0):[];_results=[];for(_i=0,_len=mixins.length;_i<_len;_i++){mixinName=mixins[_i];mixin=spectacular.factories.mixins[mixinName];if(mixin==null){throw new Error("mixin '"+mixinName+"' can't be found")}_results.push(mixin.call(this,this))}return _results};Factory.prototype.getConstructorArguments=function(traits){var args;args=this.fromTraitOrThis("arguments",traits);if(args!=null&&typeof args[0]==="function"){args=args[0].call(spectacular.env.currentExample.context)}return args||[]};Factory.prototype.findTrait=function(traitName){var trait,_ref;trait=this.traits[traitName]||((_ref=this.parent)!=null?_ref.findTrait(traitName):void 0);if(trait==null){throw new Error("unknown trait "+traitName)}return trait};return Factory}(spectacular.factories.Trait);spectacular.factoriesCache={};spectacular.factories.factory=function(name,options,block){var cache,fct,parent,_ref;cache=spectacular.factoriesCache;if(typeof options==="function"){_ref=[{},options],options=_ref[0],block=_ref[1]}if(options["extends"]!=null){parent=cache[options["extends"]];if(parent==null){throw new Error("parent factory '"+options["extends"]+"' can't be found")}fct=cache[name]||(cache[name]=new spectacular.factories.Factory(name));fct.parent=parent}else if(options["class"]!=null){fct=cache[name]||(cache[name]=new spectacular.factories.Factory(name,options["class"]))}else{fct=cache[name];if(fct==null){throw new Error("no class provided")}}fct.globalize();block.call(fct);return fct.unglobalize()};spectacular.factories.mixins={};spectacular.factories.factoryMixin=function(name,block){return spectacular.factories.mixins[name]=block};spectacular.factories.create=function(){var fct,name,options,traits,_i;name=arguments[0],traits=3<=arguments.length?__slice.call(arguments,1,_i=arguments.length-1):(_i=1,[]),options=arguments[_i++];if(name==null){throw new Error("no factory name provided")}if(typeof options==="string"){traits.push(options);options=null}fct=spectacular.factoriesCache[name];if(fct==null){throw new Error("missing factory "+name)}return fct.buildInstance(traits,options)};spectacular.Promise=function(){Promise.unit=function(value){var promise;if(value==null){value=0}promise=new spectacular.Promise;promise.resolve(value);return promise};Promise.all=function(promises){var promise,results,solved;promise=new spectacular.Promise;solved=0;results=[];promises.forEach(function(p){return p.then(function(value){solved++;results[promises.indexOf(p)]=value;if(solved===promises.length){return promise.resolve(results)}}).fail(function(reason){return promise.reject(reason)})});return promise};function Promise(){this.pending=true;this.fulfilled=null;this.value=void 0;this.fulfilledHandlers=[];this.errorHandlers=[];this.progressHandlers=[]}Promise.prototype.isPending=function(){return this.pending};Promise.prototype.isResolved=function(){return!this.pending};Promise.prototype.isFulfilled=function(){return!this.pending&&this.fulfilled};Promise.prototype.isRejected=function(){return!this.pending&&!this.fulfilled};Promise.prototype.then=function(fulfilledHandler,errorHandler,progressHandler){var e,f,promise;promise=new spectacular.Promise;f=function(value){var err,res;try{res=typeof fulfilledHandler==="function"?fulfilledHandler(value):void 0}catch(_error){err=_error;promise.reject(err);return}if((res!=null?res.then:void 0)!=null){return res.then(function(value){return promise.resolve(value)
2
+ }).fail(function(reason){return promise.reject(reason)})}else{return promise.resolve(res)}};e=function(reason){if(typeof errorHandler==="function"){errorHandler(reason)}return promise.reject(reason)};if(this.pending){this.fulfilledHandlers.push(f);this.errorHandlers.push(e);if(progressHandler!=null){this.progressHandlers.push(progressHandler)}}else{if(this.fulfilled){f(this.value)}else{e(this.reason)}}return promise};Promise.prototype.fail=function(errorHandler){return this.then(function(){},errorHandler)};Promise.prototype.resolve=function(value){if(!this.pending){return}this.value=value;this.fulfilled=true;this.notifyHandlers();return this.pending=false};Promise.prototype.reject=function(reason){if(!this.pending){return}this.reason=reason;this.fulfilled=false;this.notifyHandlers();return this.pending=false};Promise.prototype.notifyHandlers=function(){var handler,_i,_j,_len,_len1,_ref,_ref1;if(!this.pending){return}if(this.fulfilled){_ref=this.fulfilledHandlers;for(_i=0,_len=_ref.length;_i<_len;_i++){handler=_ref[_i];handler(this.value)}}else{_ref1=this.errorHandlers;for(_j=0,_len1=_ref1.length;_j<_len1;_j++){handler=_ref1[_j];handler(this.reason)}}return this};return Promise}();spectacular.AsyncPromise=function(_super){__extends(AsyncPromise,_super);function AsyncPromise(){this.run=__bind(this.run,this);this.interval=null;this.timeout=5e3;this.message="Timed out";AsyncPromise.__super__.constructor.call(this)}AsyncPromise.prototype.run=function(){var lastTime,_this=this;lastTime=new Date;return this.interval=setInterval(function(){if(new Date-lastTime>=_this.timeout){return _this.reject(new Error(_this.message))}},10)};AsyncPromise.prototype.reject=function(reason){clearInterval(this.interval);return AsyncPromise.__super__.reject.call(this,reason)};AsyncPromise.prototype.resolve=function(value){clearInterval(this.interval);return AsyncPromise.__super__.resolve.call(this,value)};AsyncPromise.prototype.rejectAfter=function(timeout,message){this.timeout=timeout;this.message=message};return AsyncPromise}(spectacular.Promise);spectacular.Expectation=function(){function Expectation(example,actual,matcher,not,callstack,ownDescription){this.example=example;this.actual=actual;this.not=not!=null?not:false;this.callstack=callstack;this.createMessage=__bind(this.createMessage,this);this.match=__bind(this.match,this);this.matcher=Object.create(matcher);this.ownDescription=ownDescription!=null?""+ownDescription+" ":""}Expectation.prototype.match=function(){var promise,timeout,_this=this;promise=new spectacular.Promise;timeout=null;spectacular.Promise.unit().then(function(){timeout=setTimeout(function(){_this.success=false;_this.trace=new Error("matcher timed out");if(_this.not){_this.message=_this.matcher.messageForShouldnt}else{_this.message=_this.matcher.messageForShould}_this.description="should"+(_this.not?" not":"")+" "+_this.matcher.description;return promise.resolve(_this.success)},_this.matcher.timeout||5e3);return _this.matcher.match(_this.actual)}).then(function(success){_this.success=success;clearTimeout(timeout);if(_this.not){_this.success=!_this.success}_this.createMessage();return promise.resolve(_this.success)}).fail(function(trace){_this.trace=trace;clearTimeout(timeout);_this.success=false;if(_this.matcher.message==null){_this.matcher.message=_this.trace.message}if(_this.matcher.description==null){_this.matcher.description=""}return promise.reject(_this.trace)});return promise};Expectation.prototype.createMessage=function(){var specIndex,stack;if(this.not){this.message=this.matcher.messageForShouldnt}else{this.message=this.matcher.messageForShould}if(!this.success&&this.trace==null){if(this.callstack.stack!=null){stack=this.callstack.stack.split("\n");specIndex=spectacular.env.runner.findSpecFileInStack(stack);if(specIndex!==-1){this.callstack.stack=stack.slice(specIndex).join("\n")}}this.trace=this.callstack}this.description=""+this.ownDescription+"should"+(this.not?" not":"")+" "+this.matcher.description;return this.fullDescription=""+this.example.description+" "+this.ownDescription+"should"+(this.not?" not":"")+" "+this.matcher.description};return Expectation}();spectacular.ExampleResult=function(){var _addExpectation;ExampleResult.include(spectacular.HasCollection("expectations","expectation"));function ExampleResult(example,state){this.example=example;this.state=state;this.expectations=[];this.promise=spectacular.Promise.unit()}ExampleResult.prototype.hasFailures=function(){return this.expectations.some(function(e){return!e.success})};_addExpectation=ExampleResult.prototype.addExpectation;ExampleResult.prototype.addExpectation=function(expectation){var successHandler,_this=this;successHandler=function(){return expectation.match().fail(function(e){return _this.example.error(e)})};this.promise=this.promise.then(successHandler);return _addExpectation.call(this,expectation)};return ExampleResult}();spectacular.Example=function(){Example.include(spectacular.HasAncestors);Example.include(spectacular.Describable);Example.extend(spectacular.AncestorsProperties);Example.followUp("subjectBlock");Example.followUp("cascading");Example.followUp("inclusive");Example.followUp("exclusive");Example.mergeUp("beforeHooks");Example.mergeUp("afterHooks");Example.mergeUp("dependencies");function Example(block,ownDescription,parent){this.block=block;this.ownDescription=ownDescription!=null?ownDescription:"";this.parent=parent;this.executeExpectations=__bind(this.executeExpectations,this);this.reject=__bind(this.reject,this);this.resolve=__bind(this.resolve,this);if(this.ownDescription===""){this.noSpaceBeforeDescription=true}this.beforeHooks=[];this.afterHooks=[];this.dependencies=[];this.cascading=null;this.inclusive=false;this.exclusive=false}Example.getter("subject",function(){var _ref;return this.__subject||(this.__subject=(_ref=this.subjectBlock)!=null?_ref.call(this.context):void 0)});Example.getter("failed",function(){var _ref,_ref1;return(_ref=(_ref1=this.result)!=null?_ref1.state:void 0)==="skipped"||_ref==="errored"||_ref==="failure"});Example.getter("succeed",function(){var _ref;return((_ref=this.result)!=null?_ref.state:void 0)==="success"});Example.getter("reason",function(){var _ref;return this.afterReason||((_ref=this.examplePromise)!=null?_ref.reason:void 0)});Example.getter("duration",function(){if(this.runEndedAt!=null&&this.runStartedAt!=null){return this.runEndedAt.getTime()-this.runStartedAt.getTime()}else{return 0}});Example.getter("fullDescription",function(){var expectationsDescriptions;expectationsDescriptions=this.result.expectations.map(function(e){return e.description});expectationsDescriptions=utils.literalEnumeration(expectationsDescriptions);return""+this.description+" "+expectationsDescriptions});Example.getter("ownDescriptionWithExpectations",function(){var expectationsDescriptions;if(this.result.expectations.length===0&&this.ownDescription===""){return this.result.state}expectationsDescriptions=this.result.expectations.map(function(e){return e.description});expectationsDescriptions=utils.literalEnumeration(expectationsDescriptions);return""+this.ownDescription+" "+expectationsDescriptions});Example.ancestorsScope("identifiedAncestors",function(e){return e.options.id!=null});Example.prototype.pending=function(){var _ref;if((_ref=this.examplePromise)!=null?_ref.pending:void 0){this.result.state="pending";return this.examplePromise.resolve()}};Example.prototype.skip=function(){var error,specIndex,stack,_ref;if((_ref=this.examplePromise)!=null?_ref.pending:void 0){this.result.state="skipped";error=new Error("Skipped");if(error.stack!=null){stack=error.stack.split("\n");specIndex=spectacular.env.runner.findSpecFileInStack(stack);if(specIndex){error.stack=stack.slice(specIndex).join("\n")}}return this.examplePromise.reject(error)}};Example.prototype.resolve=function(){var _ref;if((_ref=this.examplePromise)!=null?_ref.pending:void 0){if(this.result.hasFailures()){this.result.state="failure";return this.examplePromise.reject()}else if(this.result.expectationsCount()===0){this.result.state="pending";return this.examplePromise.resolve()}else{this.result.state="success";return this.examplePromise.resolve()}}};Example.prototype.reject=function(reason){var _ref;if((_ref=this.examplePromise)!=null?_ref.pending:void 0){this.result.state="failure";return this.examplePromise.reject(reason)}};Example.prototype.error=function(reason){var _ref;if((_ref=this.examplePromise)!=null?_ref.pending:void 0){this.result.state="errored";return this.examplePromise.reject(reason)}};Example.prototype.createContext=function(){var context,_this=this;context={};Object.defineProperty(context,"subject",{get:function(){return _this.subject}});return context};Example.prototype.hasDependencies=function(){return this.dependencies.length>0};Example.prototype.dependenciesMet=function(){return true};Example.prototype.run=function(){var afterPromise,_this=this;this.runStartedAt=new Date;this.context=this.createContext();this.examplePromise=new spectacular.Promise;this.result=new spectacular.ExampleResult(this);if(!this.dependenciesMet()){this.skip();return this.examplePromise}afterPromise=new spectacular.Promise;this.runBefore(function(err){_this.runEndedAt=new Date;if(err!=null){return _this.error(err)}return _this.executeBlock()});this.examplePromise.then(function(){return _this.runAfter(function(err){_this.runEndedAt=new Date;if(err!=null){return _this.handleAfterError(err,afterPromise)}return afterPromise.resolve()})});this.examplePromise.fail(function(reason){return _this.runAfter(function(err){_this.runEndedAt=new Date;if(err!=null){return _this.handleAfterError(err,afterPromise)}return afterPromise.reject(reason)})});return afterPromise};Example.prototype.handleAfterError=function(error,promise){this.result.state="errored";this.afterReason=error;return promise.reject(error)};Example.prototype.runBefore=function(callback){var befores;befores=this.beforeHooks.concat();return this.runHooks(befores,callback)};Example.prototype.runAfter=function(callback){var afters;afters=this.afterHooks.concat();return this.runHooks(afters,callback)};Example.prototype.runHooks=function(hooks,callback){var next,_this=this;next=function(err){if(err!=null){return callback(err)}if(hooks.length===0){return callback()}else{return _this.executeHook(hooks.shift(),next)}};return next()};Example.prototype.executeHook=function(hook,next){var async,e,_this=this;try{if(this.acceptAsync(hook)){async=new spectacular.AsyncPromise;async.then(function(){return next()});async.fail(function(reason){return next(reason)});async.run();return hook.call(this.context,async)}else{hook.call(this.context);return next()}}catch(_error){e=_error;return next(e)}};Example.prototype.executeBlock=function(){var async,e,_this=this;if(this.block==null){return this.pending()}try{if(this.acceptAsync(this.block)){async=new spectacular.AsyncPromise;async.then(this.executeExpectations,this.reject);async.fail(function(reason){return _this.error(reason)});async.run();return this.block.call(this.context,async)}else{this.block.call(this.context);return this.executeExpectations()}}catch(_error){e=_error;return this.error(e)}};Example.prototype.executeExpectations=function(){return this.result.promise.then(this.resolve,this.reject)};Example.prototype.toString=function(){return"[Example("+this.description+")]"};Example.prototype.acceptAsync=function(func){return func.signature().length===1};return Example}();spectacular.ExampleGroup=function(_super){__extends(ExampleGroup,_super);ExampleGroup.include(spectacular.HasCollection("children","child"));ExampleGroup.include(spectacular.HasNestedCollection("descendants",{through:"children"}));ExampleGroup.filterGroups=function(e){return e.children!=null&&!e.inclusive};ExampleGroup.filterExamples=function(e){return e.children==null&&!e.inclusive};ExampleGroup.filterExclusiveExamples=function(e){return ExampleGroup.filterExamples(e)&&e.exclusive};ExampleGroup.childrenScope("exampleGroups",ExampleGroup.filterGroups);ExampleGroup.childrenScope("examples",ExampleGroup.filterExamples);ExampleGroup.childrenScope("exclusiveExamples",ExampleGroup.filterExclusiveExamples);ExampleGroup.descendantsScope("allExamples",ExampleGroup.filterExamples);ExampleGroup.descendantsScope("allExclusiveExamples",ExampleGroup.filterExclusiveExamples);ExampleGroup.descendantsScope("allExamplesWithDependecies",function(e){return ExampleGroup.filterExamples(e)&&e.hasDependencies()});ExampleGroup.descendantsScope("allExclusiveExamplesWithDependecies",function(e){return ExampleGroup.filterExclusiveExamples(e)&&e.hasDependencies()});ExampleGroup.descendantsScope("identifiedExamples",function(e){var _ref;return((_ref=e.options)!=null?_ref.id:void 0)!=null});ExampleGroup.getter("identifiedExamplesMap",function(){var e,res,_i,_len,_ref;res={};_ref=this.identifiedExamples;for(_i=0,_len=_ref.length;_i<_len;_i++){e=_ref[_i];res[e.options.id]=e}return res});ExampleGroup.getter("failed",function(){return this.allExamples.some(function(e){return e.failed})});ExampleGroup.getter("succeed",function(){return this.allExamples.every(function(e){return e.succeed})});ExampleGroup.getter("examplesSuceed",function(){return this.examples.every(function(e){return e.succeed})});ExampleGroup.SUBJECTS_MAP={"::":"instanceMemberAsSubject","#":"instanceMemberAsSubject",".":"classMemberAsSubject"};function ExampleGroup(block,desc,parent,options){var method,subject,token,tokenNotFound,_ref,_this=this;this.parent=parent;this.options=options!=null?options:{};subject=null;switch(typeof desc){case"string":tokenNotFound=true;_ref=ExampleGroup.SUBJECTS_MAP;for(token in _ref){method=_ref[token];if(desc.indexOf(token)===0){this[method].call(this,desc,token);tokenNotFound=false}}if(tokenNotFound&&this.parent==null||this.parent.description===""){this.noSpaceBeforeDescription=true}break;default:this.noSpaceBeforeDescription=true;subject=desc;this.subjectBlock=function(){return subject};desc=(subject!=null?subject.name:void 0)||(subject!=null?subject._name:void 0)||(subject!=null?subject.toString():void 0)||""}ExampleGroup.__super__.constructor.call(this,block,desc,this.parent);this.children=[]}ExampleGroup.prototype.run=function(){};ExampleGroup.prototype.classMemberAsSubject=function(desc,token){var original,owner,subject;this.noSpaceBeforeDescription=true;owner=this.subject;subject=owner!=null?owner[desc.replace(".","")]:void 0;if(typeof subject==="function"){original=subject;subject=function(){return original.apply(owner,arguments)}}return this.subjectBlock=function(){return subject}};ExampleGroup.prototype.instanceMemberAsSubject=function(desc,token){var type;this.noSpaceBeforeDescription=true;type=this.subject;return this.subjectBlock=function(){var original,owner,subject;subject=null;if(type){owner=build(type,this.parameters||[]);subject=owner[desc.replace(token,"")];this.owner=owner;if(typeof subject==="function"){original=subject;subject=function(){return original.apply(owner,arguments)}}}return subject}};ExampleGroup.prototype.executeBlock=function(){if(this.block==null){return it(function(){return pending()})}this.block.call(this);if(this.allExamples.length===0){return it(function(){return pending()})}};ExampleGroup.prototype.hasExclusiveExamples=function(){return this.allExclusiveExamples.length>0};ExampleGroup.prototype.hasExamplesWithDependencies=function(){return this.allExamples.some(function(e){return e.hasDependencies()})};ExampleGroup.prototype.hasExclusiveExamplesWithDependencies=function(){return this.allExclusiveExamples.some(function(e){return e.hasDependencies()})};ExampleGroup.prototype.toString=function(){return"[ExampleGroup("+this.description+")]"};return ExampleGroup}(spectacular.Example);spectacular.dom||(spectacular.dom={});spectacular.dom.NodeExpression=function(){NodeExpression.include(spectacular.HasAncestors);NodeExpression.include(spectacular.HasCollection("expressions","expression"));function NodeExpression(expression){this.expression=expression;this.matchesSelector=document.matchesSelector||document.mozMatchesSelector||document.msMatchesSelector||document.oMatchesSelector||document.webkitMatchesSelector||function(selector){var i,node,nodes;node=this;nodes=(node.parentNode||document).querySelectorAll(selector);i=-1;while(nodes[++i]&&nodes[i]!==node){i}return!!nodes[i]};this.expressions=[]}NodeExpression.prototype.isTextExpression=function(){return/^(\/|'|").*(\/|'|")$/gm.test(this.expression)};NodeExpression.prototype.match=function(el){var matchesSelector,_this=this;matchesSelector=el.length!=null?Array.prototype.every.call(el,function(e){return _this.matchesSelector.call(e,_this.expression)}):this.matchesSelector.call(el,this.expression);return matchesSelector&&this.expressions.every(function(e){return e.contained(el)})};NodeExpression.prototype.contained=function(el){var e,found,n,_i,_j,_len,_len1,_ref;if(this.isTextExpression()){return this.handleTextExpression(el)}else{if(el!=null){if(el.length!=null){found=[];for(_i=0,_len=el.length;_i<_len;_i++){e=el[_i];_ref=e.querySelectorAll(this.expression);for(_j=0,_len1=_ref.length;_j<_len1;_j++){n=_ref[_j];found.push(n)}}}else{found=el.querySelectorAll(this.expression)}return found.length>0&&this.expressions.every(function(e){return e.contained(found)})}else{return false}}};NodeExpression.prototype.handleTextExpression=function(el){var content,textContent;textContent=el.length!=null?Array.prototype.map.call(el,function(e){return e.textContent}).join(""):el.textContent;content=this.expression.slice(1,-1);if(this.expression.indexOf("/")===0){return new RegExp(content).test(textContent)}else{return textContent===content}};return NodeExpression}();spectacular.dom.DOMExpression=function(){DOMExpression.include(spectacular.HasCollection("expressions","expression"));function DOMExpression(source){this.source=source;this.expressions=[];this.parse()}DOMExpression.prototype.parse=function(){var current,currentIndent,currentParent,startingIndent,_this=this;startingIndent=0;currentIndent=0;currentParent=this;current=null;return this.source.split("\n").forEach(function(line,i){var dif,expr,exprInst,indent,invalidIndent;invalidIndent=function(){throw new Error("invalid indent on line "+(i+1)+" of '"+_this.source+"'")};if(utils.strip(line).length===0){return}indent=_this.getIndent(line);expr=utils.strip(line);exprInst=new spectacular.dom.NodeExpression(expr);if(current===null&&indent!==0){invalidIndent()}if(indent===currentIndent){exprInst.parent=currentParent;currentParent.addExpression(exprInst);return current=exprInst}else if(indent===currentIndent+1){if(current.isTextExpression()){throw new Error("text expressions cannot have children on line "+(i+1))}exprInst.parent=current;current.addExpression(exprInst);currentIndent=indent;currentParent=current;return current=exprInst}else if(indent<currentIndent&&Math.round(indent)===indent){dif=currentIndent-indent;currentParent=current.nthAncestor(Math.abs(dif));currentParent.addExpression(exprInst);exprInst.parent=currentParent;currentIndent=indent;return current=exprInst}else{return invalidIndent()}})};DOMExpression.prototype.getIndent=function(line){var re;re=/^(\s+).*/;if(!re.test(line)){return 0}line=line.replace(re,"$1");return line.length/2};DOMExpression.prototype.match=function(el){return this.expressions.every(function(e){return e.match(el)})};DOMExpression.prototype.contained=function(el){return this.expressions.every(function(e){return e.contained(el)})};DOMExpression.prototype.toString=function(){return this.source};return DOMExpression}();spectacular.Random=function(){function Random(seed){this.seed=seed}Random.prototype.get=function(){this.seed=(this.seed*9301+49297)%233280;return this.seed/233280};return Random}();spectacular.RunnerResults=function(){function RunnerResults(runner){var _ref;this.runner=runner;this.errors=[];this.failures=[];this.skipped=[];this.pending=[];this.results=[];this.examples=[];_ref=this.runner,this.loadStartedAt=_ref.loadStartedAt,this.loadEndedAt=_ref.loadEndedAt;this.specsStartedAt=null;this.specsEndedAt=null}RunnerResults.prototype.hasFailures=function(){return this.examples.some(function(e){var _ref;return(_ref=e.result.state)==="skipped"||_ref==="failure"||_ref==="errored"})};return RunnerResults}();spectacular.Runner=function(){Runner.include(spectacular.EventDispatcher);function Runner(root,options,env){var seed,_this=this;this.root=root;this.options=options;this.env=env;this.notifyEnd=__bind(this.notifyEnd,this);this.nextExample=__bind(this.nextExample,this);this.executeSpecs=__bind(this.executeSpecs,this);this.registerSpecs=__bind(this.registerSpecs,this);this.run=__bind(this.run,this);this.results=[];this.examples=[];this.stack=[];seed=this.options.seed!=null?this.options.seed:Math.round(Math.random()*99999999);this.options.seed=seed;this.random=new spectacular.Random(seed);this.randomSort=function(){return Math.round(1-_this.random.get()*2)}}Runner.prototype.run=function(){var promise,results;results=new spectacular.RunnerResults(this);return promise=spectacular.Promise.unit(results).then(function(results){results.specsStartedAt=new Date;return results}).then(this.registerSpecs).then(this.executeSpecs).then(function(results){results.specsEndedAt=new Date;return results}).then(this.notifyEnd).then(function(results){if(results.hasFailures()){return 1}else{return 0}})};Runner.prototype.findSpecFileInStack=function(stack){var i,l,p,_i,_j,_len,_len1,_ref;_ref=this.options.paths||[];for(_i=0,_len=_ref.length;_i<_len;_i++){p=_ref[_i];for(i=_j=0,_len1=stack.length;_j<_len1;i=++_j){l=stack[i];if(l.indexOf(p)!==-1){return i}}}return-1};Runner.prototype.registerSpecs=function(results){var example,set,_i,_len;set=this.root.children;if(this.options.random){set=set.sort(this.randomSort)}for(_i=0,_len=set.length;_i<_len;_i++){example=set[_i];this.register(example,this.root.hasExclusiveExamples())}this.dispatch(new spectacular.Event("start",this));return results};Runner.prototype.register=function(child,exclusiveOnly){var c,set,_i,_j,_k,_l,_len,_len1,_len2,_len3,_ref,_ref1,_results,_results1;if(exclusiveOnly==null){exclusiveOnly=false}if(child.children!=null){if(exclusiveOnly){if(child.hasExclusiveExamplesWithDependencies()){_ref=child.allExclusiveExamplesWithDependecies;for(_i=0,_len=_ref.length;_i<_len;_i++){c=_ref[_i];this.registerDependencies(c,exclusiveOnly)}}set=child.allExclusiveExamples;if(this.options.random){set=set.sort(this.randomSort)}_results=[];for(_j=0,_len1=set.length;_j<_len1;_j++){c=set[_j];_results.push(this.register(c,exclusiveOnly))}return _results}else{if(child.hasExamplesWithDependencies()){_ref1=child.allExamplesWithDependecies;for(_k=0,_len2=_ref1.length;_k<_len2;_k++){c=_ref1[_k];this.registerDependencies(c,exclusiveOnly)}}set=child.allExamples;if(this.options.random){set=set.sort(this.randomSort)}_results1=[];for(_l=0,_len3=set.length;_l<_len3;_l++){c=set[_l];_results1.push(this.register(c,exclusiveOnly))}return _results1}}else{if(exclusiveOnly&&!child.exclusive){return}if(child.hasDependencies()){this.registerDependencies(child,exclusiveOnly)}return this.insert(child,exclusiveOnly)}};Runner.prototype.registerDependencies=function(child){var dep,dependency,_i,_len,_ref,_results;_ref=child.dependencies;_results=[];for(_i=0,_len=_ref.length;_i<_len;_i++){dep=_ref[_i];dependency=this.root.identifiedExamplesMap[dep];if(dependency!=null){this.checkDependency(child,dependency);_results.push(this.register(dependency))}else{_results.push(void 0)}}return _results};Runner.prototype.insert=function(example){this.handleDependencies(example);if(__indexOf.call(this.examples,example)<0){this.examples.push(example)}if(__indexOf.call(this.stack,example)<0){return this.stack.push(example)}};Runner.prototype.handleDependencies=function(example){var cascading,cascadingSucceed,dep,dependencies,dependenciesSucceed,dependency,msg,s,_i,_j,_len,_len1,_ref,_ref1;if(__indexOf.call(this.stack,example)>=0){return}dependencies=[];cascading=null;dependenciesSucceed=null;cascadingSucceed=null;if(example.dependencies.length>0){_ref=example.dependencies;for(_i=0,_len=_ref.length;_i<_len;_i++){dep=_ref[_i];dependency=this.root.identifiedExamplesMap[dep];if(dependency!=null){dependencies.push(dependency)}else{msg="Warning: unmet dependency "+dep+" for example "+example;if(this.options.colors){msg=msg.yellow}this.dispatch(new spectacular.Event("message",msg))}}dependenciesSucceed=function(){return dependencies.every(function(e){return e.succeed})}}if(example.cascading!=null){_ref1=example.cascading.examples;for(_j=0,_len1=_ref1.length;_j<_len1;_j++){s=_ref1[_j];this.register(s)}cascadingSucceed=function(){return example.cascading.examplesSuceed}}if(dependenciesSucceed!=null){if(cascadingSucceed!=null){return example.dependenciesMet=function(){return dependenciesSucceed()&&cascadingSucceed()}}else{return example.dependenciesMet=dependenciesSucceed}}else if(cascadingSucceed!=null){return example.dependenciesMet=cascadingSucceed}};Runner.prototype.checkDependency=function(example,dependency){if(__indexOf.call(example.ancestors,dependency)>=0){throw new Error(""+example+" can't depends on ancestor "+dependency)}return this.checkCircularity(example,dependency)};Runner.prototype.checkCircularity=function(example,dependency){var currentParents,dep,depParents,id,_i,_j,_len,_len1,_ref;currentParents=example.identifiedAncestors.map(function(a){return a.options.id});depParents=dependency.identifiedAncestors.map(function(a){return a.options.id}).concat(dependency.options.id);for(_i=0,_len=currentParents.length;_i<_len;_i++){id=currentParents[_i];if(__indexOf.call(depParents,id)>=0){throw new Error("circular dependencies between "+example+" and "+dependency)}}if(dependency.dependencies.length>0){_ref=dependency.dependencies;for(_j=0,_len1=_ref.length;_j<_len1;_j++){dep=_ref[_j];dependency=this.root.identifiedExamplesMap[dep];if(dependency!=null){this.checkCircularity(example,dependency)}}}};Runner.prototype.executeSpecs=function(results){var promise;promise=new spectacular.Promise;this.nextExample(promise,results);return promise};Runner.prototype.nextExample=function(defer,results){var _this=this;return spectacular.nextTick(function(){var nextExample;if(_this.stack.length===0){return defer.resolve(results)}else{nextExample=_this.stack.shift();_this.env.currentExample=nextExample;return nextExample.run().then(function(){_this.handleResult(nextExample,results);return _this.nextExample(defer,results)}).fail(function(reason){_this.handleResult(nextExample,results);return _this.nextExample(defer,results)})}})};Runner.prototype.handleResult=function(example,results){results.results.push(example.result);results.examples.push(example);switch(example.result.state){case"pending":results.pending.push(example);break;case"skipped":results.skipped.push(example);break;case"errored":results.errors.push(example);break;case"failure":results.failures.push(example)}this.dispatch(new spectacular.Event("result",example));return this.env.currentExample=null};Runner.prototype.notifyEnd=function(results){this.dispatch(new spectacular.Event("end",results));return results};return Runner}();spectacular.helpers=new spectacular.GlobalizableObject;spectacular.helper=function(name,value){return spectacular.helpers.set(name,value)};spectacular.Environment=function(){Environment.include(spectacular.Globalizable);function Environment(options){this.options=options;this.run=__bind(this.run,this);this.globalizable="it xit describe xdescribe expect before after given subject its itsInstance itsReturn withParameters fail pending success skip should shouldnt dependsOn spyOn whenPass fixture except only sharedExample itBehavesLike fixturePath".split(/\s+/g);this.rootExampleGroup=new spectacular.ExampleGroup(null,"");this.currentExampleGroup=this.rootExampleGroup;this.currentExample=null;this.runner=new spectacular.Runner(this.rootExampleGroup,this.options,this);this.sharedExamples={};this.createExampleAlias("the");this.createExampleAlias("specify");this.createExampleGroupAlias("context");this.createOuterExampleAlias("xcontext","xdescribe");this.createOuterExampleAlias("withArguments","withParameters");this.createOuterExampleAlias("itShould","itBehavesLike");this.registerFixtureHandler("json",this.handleJSONFixture);this.registerFixtureHandler("html",this.handleHTMLFixture);this.registerFixtureHandler("dom",this.handleDOMFixture)}Environment.prototype.run=function(){return this.runner.run()};Environment._globalize=Environment.prototype.globalize;Environment._unglobalize=Environment.prototype.unglobalize;Environment.prototype.createGlobalizedMethod=function(name,block){if(__indexOf.call(this.globalizable,name)<0){this.globalizable.push(name);this[name]=block;if(this.globalized){return this.globalizeMember(name,block)}}};Environment.prototype.createExampleGroupAlias=function(name){return this.createOuterExampleAlias(name,"describe")};Environment.prototype.createExampleAlias=function(name){return this.createOuterExampleAlias(name,"it")};Environment.prototype.createInnerExampleAlias=function(newName,oldName){return this.createGlobalizedMethod(newName,function(){this.notOutsideIt(newName);return this[oldName].apply(this,arguments)})};Environment.prototype.createOuterExampleAlias=function(newName,oldName){return this.createGlobalizedMethod(newName,function(){this.notInsideIt(newName);return this[oldName].apply(this,arguments)})};Environment.prototype.globalize=function(){Environment._globalize.call(this);spectacular.factories.globalize();spectacular.matchers.globalize();spectacular.helpers.globalize();return this.globalizeObjectExtensions()};Environment.prototype.unglobalize=function(){Environment._unglobalize.call(this);spectacular.factories.unglobalize();spectacular.matchers.unglobalize();spectacular.helpers.unglobalize();return this.unglobalizeObjectExtensions()};Environment.prototype.unglobalizeObjectExtensions=function(){delete Object.prototype.should;delete Object.prototype.shouldnt;delete spectacular.global.should;return delete spectacular.global.shouldnt};Environment.prototype.globalizeObjectExtensions=function(){var env;env=this;Object.defineProperty(Object.prototype,"should",{writable:true,configurable:true,enumerable:false,value:function(matcher,neg){if(neg==null){neg=false}env.notOutsideIt("should");if(matcher==null){return}return env.currentExample.result.addExpectation(new spectacular.Expectation(env.currentExample,this.valueOf(),matcher,neg,new Error))}});return Object.defineProperty(Object.prototype,"shouldnt",{writable:true,configurable:true,enumerable:false,value:function(matcher){env.notOutsideIt("should");return this.should(matcher,true)}})};Environment.prototype.clone=function(){var optionsCopy,_ref;optionsCopy={};_ref=this.options;for(k in _ref){v=_ref[k];optionsCopy[k]=v}return new spectacular.Environment(optionsCopy)};Environment.prototype.notInsideIt=function(method){if(this.currentExample!=null){throw new Error(""+method+" called inside a it block")}};Environment.prototype.notOutsideIt=function(method){if(this.currentExample==null){throw new Error(""+method+" called outside a it block")}};Environment.prototype.notWihoutMatcher=function(method){throw new Error(""+method+" called without a matcher")};Environment.prototype.fail=function(){var error,specIndex,stack;error=new Error("Failed");if(error.stack!=null){stack=error.stack.split("\n");specIndex=spectacular.env.runner.findSpecFileInStack(stack);if(specIndex){error.stack=stack.slice(specIndex).join("\n")}}return this.currentExample.reject(error)};Environment.prototype.pending=function(){return this.currentExample.pending()};Environment.prototype.skip=function(){return this.currentExample.skip()};Environment.prototype.success=function(){};Environment.prototype.it=function(msgOrBlock,block){var example,_ref;this.notInsideIt("it");if(typeof msgOrBlock==="function"){_ref=["",msgOrBlock],msgOrBlock=_ref[0],block=_ref[1]}example=new spectacular.Example(block,msgOrBlock,this.currentExampleGroup);this.currentExampleGroup.addChild(example);
3
+ return example};Environment.prototype.xit=function(msgOrBlock,block){this.notInsideIt("xit");if(typeof msgOrBlock==="string"){return this.it(msgOrBlock,function(){return pending()})}else{return this.it(function(){return pending()})}};Environment.prototype.before=function(block){this.notInsideIt("before");return this.currentExampleGroup.ownBeforeHooks.push(block)};Environment.prototype.after=function(block){this.notInsideIt("after");return this.currentExampleGroup.ownAfterHooks.push(block)};Environment.prototype.its=function(property,block){var parentSubjectBlock,_this=this;this.notInsideIt("its");parentSubjectBlock=this.currentExampleGroup.subjectBlock;return this.emptyContext(function(){_this.subject(property,function(){return parentSubjectBlock!=null?parentSubjectBlock.call(this)[property]:void 0});return _this.specify("the "+property+" property",block)})};Environment.prototype.itsInstance=function(property,options,block){var parentSubjectBlock,_ref,_ref1,_ref2,_this=this;this.notInsideIt("itsInstance");if(typeof property==="function"){_ref=[block,{},property],property=_ref[0],options=_ref[1],block=_ref[2]}else if(typeof property==="object"){_ref1=[null,property,options],property=_ref1[0],options=_ref1[1],block=_ref1[2]}else if(typeof options==="function"){_ref2=[{},options],options=_ref2[0],block=_ref2[1]}parentSubjectBlock=this.currentExampleGroup.subjectBlock;if(parentSubjectBlock==null){throw new Error("itsInstance called in context without a previous subject")}return this.emptyContext(function(){_this.subject("instance",function(){var params;params=options["with"]!=null?typeof options["with"]==="function"?options["with"].call(this):options["with"]:this.parameters||[];return build(parentSubjectBlock!=null?parentSubjectBlock.call(this):void 0,params)});if(property!=null){return _this.its(property,block)}else{return _this.specify("the instance",block)}})};Environment.prototype.itsReturn=function(options,block){var parentSubjectBlock,_ref,_this=this;this.notInsideIt("itsReturn");if(typeof options==="function"){_ref=[options,{}],block=_ref[0],options=_ref[1]}parentSubjectBlock=this.currentExampleGroup.subjectBlock;if(parentSubjectBlock==null){throw new Error("itsReturn called in context without a previous subject")}return this.emptyContext(function(){_this.subject("returnedValue",function(){var context,ctx,params;context=options.inContext!=null||options.in_context!=null?(ctx=options.inContext||options.in_context,typeof ctx==="function"?ctx.call(this):ctx):this;params=options["with"]!=null?typeof options["with"]==="function"?options["with"].call(this):options["with"]:this.parameters||[];return parentSubjectBlock!=null?parentSubjectBlock.call(this).apply(context,params):void 0});return _this.specify("the returned value",block)})};Environment.prototype.subject=function(name,block){var subjectBlock,_ref;this.notInsideIt("subject");if(typeof name==="function"){_ref=[block,name],name=_ref[0],block=_ref[1]}subjectBlock=function(){var _name;return this[_name="__"+(name||"subject")]||(this[_name]=block.call(this))};this.currentExampleGroup.ownSubjectBlock=subjectBlock;if(name!=null){return this.given(name,subjectBlock)}};Environment.prototype.given=function(name,block){this.notInsideIt("given");return this.before(function(){return Object.defineProperty(this,name,{configurable:true,enumerable:true,get:function(){var _name;return this[_name="__"+name]||(this[_name]=block.call(this))}})})};Environment.prototype.describe=function(subject,options,block){var currentGroup,error,oldGroup,_ref;if(typeof options==="function"){_ref=[block,options],options=_ref[0],block=_ref[1]}this.notInsideIt("describe");oldGroup=this.currentExampleGroup;this.currentExampleGroup=currentGroup=new spectacular.ExampleGroup(block,subject,oldGroup,options);oldGroup.addChild(this.currentExampleGroup);try{this.currentExampleGroup.executeBlock()}catch(_error){error=_error}finally{this.currentExampleGroup=oldGroup;if(error!=null){throw error}}return currentGroup};Environment.prototype.xdescribe=function(subject,options,block){var _ref;this.notInsideIt("xdescribe");if(typeof options==="function"){_ref=[block,options],options=_ref[0],block=_ref[1]}return describe(subject,function(){return it(function(){return pending()})})};Environment.prototype.emptyContext=function(block){return this.context("",block)};Environment.prototype.withParameters=function(){var args;args=1<=arguments.length?__slice.call(arguments,0):[];this.notInsideIt("withParameters");return this.given("parameters",function(){if(typeof args[0]==="function"){return args[0].call(this)}else{return args}})};Environment.prototype.dependsOn=function(spec){this.notInsideIt("dependsOn");return this.currentExampleGroup.ownDependencies.push(spec)};Environment.prototype.whenPass=function(block){var previousContext,_this=this;this.notInsideIt("whenPass");previousContext=this.currentExampleGroup;return this.emptyContext(function(){_this.currentExampleGroup.ownCascading=previousContext;return block()})};Environment.prototype.spyOn=function(obj,method){var context,oldMethod,spy;this.notOutsideIt("spyOn");oldMethod=obj[method];context=this.currentExample.context;spy=function(){var args;args=1<=arguments.length?__slice.call(arguments,0):[];spy.argsForCall.push(args);if(spy.mock!=null){return spy.mock.apply(obj,args)}else{return oldMethod.apply(obj,args)}};spy.spied=oldMethod;spy.argsForCall=[];spy.andCallFake=function(mock){this.mock=mock;return this};spy.andReturns=function(value){return spy.andCallFake(function(){return value})};spy.andCallThrough=function(block){this.mock=function(){return block.call(context,oldMethod.apply(this,arguments))};return this};utils.snakify(spy);this.currentExample.ownAfterHooks.push(function(){return obj[method]=oldMethod});obj[method]=spy;return spy};Environment.prototype.should=function(matcher,neg){if(neg==null){neg=false}this.notOutsideIt("should");if(matcher==null){this.notWihoutMatcher("should")}return this.currentExample.result.addExpectation(new spectacular.Expectation(this.currentExample,this.currentExample.subject,matcher,neg,new Error))};Environment.prototype.shouldnt=function(matcher){return this.should(matcher,true)};Environment.prototype.expect=function(desc,value){var err,self;if(value==null&&arguments.length<2){value=desc}this.notOutsideIt("expect");self=this;err=new Error;return{to:function(matcher){if(matcher==null){self.notWihoutMatcher("expect(...).to")}return self.currentExample.result.addExpectation(new spectacular.Expectation(self.currentExample,value,matcher,false,err,desc))},not:{to:function(matcher){if(matcher==null){self.notWihoutMatcher("expect(...).not.to")}return self.currentExample.result.addExpectation(new spectacular.Expectation(self.currentExample,value,matcher,true,err,desc))}}}};Environment.prototype.except=function(example){return example.inclusive=true};Environment.prototype.only=function(example){return example.exclusive=true};Environment.prototype.sharedExample=function(name,block){if(name in this.sharedExamples){throw new Error("shared example '"+name+"' already registered")}return this.sharedExamples[name]=block};Environment.prototype.itBehavesLike=function(name,options){if(options==null){options={}}if(!(name in this.sharedExamples)){throw new Error("shared example '"+name+"' not found")}return this.sharedExamples[name].call(null,options)};Environment.prototype.fixturePath=function(file){return""+this.options.fixturesRoot+"/"+file};Environment.prototype.fixture=function(file,options){var env,envOptions,ext,name;if(options==null){options={}}this.notInsideIt("fixture");name=options.as||"fixture";env=this;envOptions=this.options;ext=file.split(".").slice(-1)[0];return this.before(function(async){var p,_this=this;p=env.fixturePath(file);return envOptions.loadFile(p).then(function(fileContent){return env.handleFixture(ext,fileContent).then(function(result){_this[name]=result;return async.resolve()})}).fail(function(reason){return async.reject(reason)})})};Environment.prototype.registerFixtureHandler=function(ext,proc){this.fixtureHandlers||(this.fixtureHandlers={});return this.fixtureHandlers[ext]=proc};Environment.prototype.handleFixture=function(ext,content){if(ext in this.fixtureHandlers){return this.fixtureHandlers[ext].call(this,content)}else{return spectacular.Promise.unit(content)}};Environment.prototype.handleJSONFixture=function(content){return spectacular.Promise.unit(JSON.parse(content))};Environment.prototype.handleDOMFixture=function(content){return spectacular.Promise.unit(new spectacular.dom.DOMExpression(content))};Environment.prototype.handleHTMLFixture=function(content){var body,fixtures,parent;parent=document.querySelector("#fixtures");if(parent==null){body=document.querySelector("body");fixtures=document.createElement("div");fixtures.id="fixtures";body.appendChild(fixtures)}parent=document.querySelector("#fixtures");parent.innerHTML=content;this.currentExample.ownAfterHooks.push(function(){return parent.innerHTML=""});return spectacular.Promise.unit(parent.childNodes)};Environment.prototype.toString=function(){return"[spectacular Environment]"};return Environment}();spectacular.matchers||(spectacular.matchers=new spectacular.GlobalizableObject);spectacular.matchers.keepContext=false;spectacular.matcher=function(name,block){var buildMatcher,chains,def,description,failureMessageForShould,failureMessageForShouldnt,genChain,getter,init,match,matcher,o,takes,timeout;o=new spectacular.GlobalizableObject;takes=null;match=null;chains={};timeout=null;description=null;init=null;failureMessageForShould=null;failureMessageForShouldnt=null;def=function(obj,prop,block){return Object.defineProperty(obj,prop,{value:block,enumerable:true,writable:true,configurable:true})};getter=function(obj,prop,block){return Object.defineProperty(obj,prop,{get:block,set:function(){},enumerable:true,configurable:true})};genChain=function(matcher,key,block){var f;f=function(){o=Object.create(this);block.apply(o,arguments);return o};return def(matcher,key,f)};buildMatcher=function(takes,args){var i,key,matcher,_i,_len;if(takes==null){takes=[]}if(args==null){args=[]}matcher={name:name};if(takes[0]!=null&&takes[0].indexOf("...")!==-1){key=takes[0].replace(/\.\.\./,"");matcher[key]=args}else{for(i=_i=0,_len=takes.length;_i<_len;i=++_i){k=takes[i];matcher[k]=args[i]}}if(init!=null){init.call(matcher)}matcher.match=function(actual){this.actual=actual;return this.result=match.apply(this,arguments)};matcher.timeout=timeout;matcher.formatValue=function(value){var _ref,_ref1;return((_ref=spectacular.env)!=null?(_ref1=_ref.options)!=null?typeof _ref1.valueOutput==="function"?_ref1.valueOutput(value):void 0:void 0:void 0)||value};for(k in chains){v=chains[k];genChain(matcher,k,v)}if(description!=null){getter(matcher,"description",description)}if(failureMessageForShould!=null){getter(matcher,"messageForShould",failureMessageForShould)}else{getter(matcher,"messageForShould",function(){return this.description})}if(failureMessageForShouldnt!=null){getter(matcher,"messageForShouldnt",failureMessageForShouldnt)}else if(failureMessageForShould!=null){getter(matcher,"messageForShouldnt",failureMessageForShould)}else{getter(matcher,"messageForShouldnt",function(){return this.description})}utils.snakify(matcher);return matcher};o.match=function(value){return match=value};o.timeout=function(value){return timeout=value};o.takes=function(){var args;args=1<=arguments.length?__slice.call(arguments,0):[];return takes=args};o.chain=function(chain,block){return chains[chain]=block};o.description=function(block){return description=block};o.init=function(block){return init=block};o.failureMessageForShould=function(block){return failureMessageForShould=block};o.failureMessageForShouldnt=function(block){return failureMessageForShouldnt=block};o.globalize();block.call(null);o.unglobalize();if(match==null){throw new Error("can't create matcher "+name+" without a match")}matcher=takes!=null?function(){var a;return buildMatcher(takes,function(){var _i,_len,_results;_results=[];for(_i=0,_len=arguments.length;_i<_len;_i++){a=arguments[_i];_results.push(a)}return _results}.apply(this,arguments))}:buildMatcher();return spectacular.matchers.set(name,matcher)};spectacular.matcher("exist",function(){match(function(actual,notText){return actual!=null});description(function(){return"exist"});failureMessageForShould(function(){return"Expected "+this.formatValue(this.actual)+" to exist"});return failureMessageForShouldnt(function(){return"Expected "+this.formatValue(this.actual)+" to be undefined"})});spectacular.matcher("be",function(){takes("desc","value");description(function(){var desc;desc=typeof this.desc==="string"?this.desc:this.formatValue(utils.squeeze(utils.inspect(this.value)));return"be "+desc});failureMessageForShould(function(){switch(typeof this.value){case"string":return"Expected "+this.formatValue(this.actual)+" to "+this.description+" but was "+this.formatValue(this.stateValue);case"number":case"boolean":return"Expected "+this.formatValue(this.actual)+" to "+this.description;default:return this.message="Expected "+this.formatValue(utils.inspect(this.actual))+" to "+this.description}});failureMessageForShouldnt(function(){switch(typeof this.value){case"string":return"Expected "+this.formatValue(this.actual)+" not to "+this.description+" but was "+this.formatValue(this.stateValue);case"number":case"boolean":return"Expected "+this.formatValue(this.actual)+" not to "+this.description;default:return this.message="Expected "+this.formatValue(utils.inspect(this.actual))+" not to "+this.description}});return match(function(actual){if(this.value==null){this.value=this.desc}switch(typeof this.value){case"string":this.state=utils.findStateMethodOrProperty(actual,this.value);if(this.state!=null){if(typeof actual[this.state]==="function"){this.stateValue=actual[this.state]()}else{this.stateValue=actual[this.state]}}else{this.stateValue=false}return this.stateValue;case"number":case"boolean":return(actual!=null?actual.valueOf():void 0)===this.value;case"function":if(typeof this.actual==="function"){return actual===this.value}else{return(actual!=null?actual.constructor:void 0)===this.value}break;default:return actual===this.value}})});spectacular.matcher("have",function(){takes("count","label");description(function(){return"have "+this.count+" "+this.label});match(function(actual){switch(typeof actual){case"string":return actual.length===this.count;case"object":if(utils.isArray(actual)){return actual.length===this.count}else{if(this.label==null){throw new Error("Undefined label in have matcher")}if(actual[this.label]){if(utils.isArray(actual[this.label])){return actual[this.label].length===this.count}else{return false}}else{return false}}break;default:return false}});failureMessageForShould(function(){switch(typeof this.actual){case"string":return"Expected string "+this.formatValue(utils.inspect(this.actual))+" to "+this.description+" but was "+this.formatValue(this.actual.length);case"object":if(utils.isArray(this.actual)){return"Expected array "+this.formatValue(utils.inspect(this.actual))+" to "+this.description+" but was "+this.formatValue(this.actual.length)}else{return this.message="Expected object "+this.formatValue(utils.inspect(this.actual))+" to "+this.description}break;default:return this.message="Expected "+this.formatValue(utils.inspect(this.actual))+" to "+this.description+" but it don't belong to a type that can be handled"}});return failureMessageForShouldnt(function(){switch(typeof this.actual){case"string":return"Expected string "+this.formatValue(utils.inspect(this.actual))+" not to "+this.description+" but was "+this.formatValue(this.actual.length);case"object":if(utils.isArray(this.actual)){return"Expected array "+this.formatValue(utils.inspect(this.actual))+" not to "+this.description+" but was "+this.formatValue(this.actual.length)}else{return this.message="Expected object "+this.formatValue(utils.inspect(this.actual))+" not to "+this.description}break;default:return this.message="Expected "+this.formatValue(utils.inspect(this.actual))+" not to "+this.description+" but it don't belong to a type that can be handled"}})});spectacular.matcher("haveProperty",function(){takes("property");chain("to",function(matcher){this.matcher=matcher});description(function(){var desc;desc="have property "+this.formatValue(this.property);if(this.matcher!=null){desc+=" to "+this.matcher.description}return desc});match(function(actual){if(this.matcher!=null){return actual[this.property]!=null&&this.matcher.match(actual[this.property])}else{return actual[this.property]!=null}});failureMessageForShould(function(){var desc;desc="Expected "+this.formatValue(utils.inspect(this.actual))+" to have a property "+this.formatValue(this.property);if(this.matcher!=null){desc+=" to "+this.matcher.description}return desc});return failureMessageForShouldnt(function(){var desc;desc="Expected "+this.formatValue(utils.inspect(this.actual))+" not to have a property "+this.formatValue(this.property);if(this.matcher!=null){desc+=" to "+this.matcher.description}return desc})});spectacular.matcher("haveProperties",function(){var collectHashs,collectStrings;collectStrings=function(col){return col.filter(function(el){return typeof el==="string"})};collectHashs=function(col){return col.filter(function(el){return typeof el==="object"})};takes("properties...");description(function(){var desc,descs,hashProperties,stringProperties,_this=this;stringProperties=collectStrings(this.properties).map(function(v){return _this.formatValue(v)});hashProperties=collectHashs(this.properties);descs=[];descs=descs.concat(stringProperties);hashProperties.forEach(function(item){var _results;_results=[];for(k in item){v=item[k];_results.push(descs.push(""+_this.formatValue(k)+" to "+v.description))}return _results});desc="have "+(descs.length>1?"properties":"property")+" ";desc+=utils.literalEnumeration(descs);return desc});match(function(actual){var m,res,_i,_len,_ref,_this=this;this.matchers=[];this.properties.forEach(function(key){var _results;if(typeof key==="object"){_results=[];for(k in key){_results.push(_this.matchers.push(haveProperty(k).to(key[k])))}return _results}else{return _this.matchers.push(haveProperty(key))}});res=true;_ref=this.matchers;for(_i=0,_len=_ref.length;_i<_len;_i++){m=_ref[_i];res=m.match(actual)&&res}return res});failureMessageForShould(function(){var _ref;return(_ref=this.matchers)!=null?_ref.filter(function(m){return!m.success}).map(function(m){return m.messageForShould}).join("\n"):void 0});return failureMessageForShouldnt(function(){var _ref;return(_ref=this.matchers)!=null?_ref.filter(function(m){return!m.success}).map(function(m){return m.messageForShouldnt}).join("\n"):void 0})});spectacular.matcher("haveBeenCalled",function(){description(function(){var msg;msg="have been called";if(this["arguments"]!=null){msg+="with "+this.formatValue(utils.inspect(this["arguments"]))}return msg});chain("with",function(){var arguments,_arguments;_arguments=1<=arguments.length?__slice.call(arguments,0):[];this["arguments"]=_arguments});match(function(actual,notText){var _this=this;if(typeof(actual!=null?actual.spied:void 0)==="function"){if(this["arguments"]!=null){return actual.argsForCall.length>0&&actual.argsForCall.some(function(a){return equal(a).match(_this["arguments"],"")})}else{return actual.argsForCall.length>0}}else{return false}});failureMessageForShould(function(){var _ref;if(typeof((_ref=this.actual)!=null?_ref.spied:void 0)==="function"){if(this["arguments"]!=null){return"Expected "+this.formatValue(this.actual.spied)+" to "+this.description+" but was called with "+this.formatValue(this.actual.argsForCall)}else{return"Expected "+this.formatValue(this.actual.spied)+" to have been called"}}else{return this.message="Expected a spy but it was "+this.formatValue(this.actual)}});return failureMessageForShouldnt(function(){var _ref;if(typeof((_ref=this.actual)!=null?_ref.spied:void 0)==="function"){if(this["arguments"]!=null){return"Expected "+this.formatValue(this.actual.spied)+" not to "+this.description+" but was called with "+this.actual.argsForCall}else{return"Expected "+this.formatValue(this.actual.spied)+" not to have been called"}}else{return this.message="Expected a spy but it was "+this.formatValue(this.actual)}})});spectacular.matcher("equal",function(){takes("value");description(function(){return"be equal to "+this.formatValue(utils.squeeze(utils.inspect(this.value)))});match(function(actual){this.diff={diff:""};return this.result=utils.compare(actual,this.value,this.diff)});failureMessageForShould(function(){var msg,_ref;msg="Expected "+this.formatValue(utils.inspect(this.actual))+" to be equal to "+this.formatValue(utils.inspect(this.value));if(((_ref=this.diff)!=null?_ref.diff.length:void 0)>0&&!this.result){msg+="\n\n"+this.diff.diff}return msg});return failureMessageForShouldnt(function(){var msg,_ref;msg="Expected "+this.formatValue(utils.inspect(this.actual))+" to be different than "+this.formatValue(utils.inspect(this.value));if(((_ref=this.diff)!=null?_ref.diff.length:void 0)>0&&!this.result){msg+="\n\n"+this.diff.diff}return msg})});spectacular.matcher("beWithin",function(){takes("delta");description(function(){return"be within "+this.formatValue(utils.squeeze(utils.inspect(this.delta)))+" of "+this.formatValue(utils.squeeze(utils.inspect(this.expected)))});chain("of",function(expected){this.expected=expected});match(function(actual){return this.expected-this.delta<=actual&&actual<=this.expected+this.delta});failureMessageForShould(function(){return"Expected "+this.formatValue(utils.inspect(this.actual))+" to "+this.description});return failureMessageForShouldnt(function(){return"Expected "+this.formatValue(utils.inspect(this.actual))+" not to "+this.description})});spectacular.matcher("match",function(){takes("re");description(function(){return"match "+this.formatValue(this.re)});match(function(actual){if(this.re.match!=null&&this.re.contained!=null){return this.re.match(actual)}else if(this.re.test!=null){return this.re.test(actual)}else{return String(actual).indexOf(this.re)!==-1}});failureMessageForShould(function(){if(this.re.match!=null&&this.re.contained!=null){return"Expected "+this.formatValue(utils.descOfNode(this.actual))+" to match "+this.formatValue(this.re)}else{return this.message="Expected "+this.formatValue(this.actual)+" to match "+this.formatValue(this.re)}});return failureMessageForShouldnt(function(){if(this.re.match!=null&&this.re.contained!=null){return"Expected "+this.formatValue(utils.descOfNode(this.actual))+" not to match "+this.formatValue(this.re)}else{return this.message="Expected "+this.formatValue(this.actual)+" not to match "+this.formatValue(this.re)}})});spectacular.matcher("contains",function(){takes("values...");description(function(){var valuesDescription,_ref,_ref1;if(((_ref=this.value)!=null?_ref.match:void 0)!=null&&((_ref1=this.value)!=null?_ref1.contained:void 0)!=null){return"contains "+this.formatValue(this.value)}else{valuesDescription=utils.literalEnumeration(this.values.map(function(v){return utils.inspect(v)}));return"contains "+this.formatValue(valuesDescription)}});match(function(actual){var _ref,_ref1;this.value=this.values[0];if(((_ref=this.value)!=null?_ref.match:void 0)!=null&&((_ref1=this.value)!=null?_ref1.contained:void 0)!=null){return this.value.contained(actual)}else{return this.values.every(function(v){return __indexOf.call(actual,v)>=0})}});failureMessageForShould(function(){var valuesDescription,_ref,_ref1;if(((_ref=this.value)!=null?_ref.match:void 0)!=null&&((_ref1=this.value)!=null?_ref1.contained:void 0)!=null){return"Expected "+this.formatValue(utils.descOfNode(this.actual))+" to contains "+this.formatValue(this.value)}else{valuesDescription=utils.literalEnumeration(this.values.map(function(v){return utils.inspect(v)}));return"Expected "+this.formatValue(utils.descOfNode(this.actual))+" to contains "+this.formatValue(valuesDescription)}});return failureMessageForShouldnt(function(){var valuesDescription,_ref,_ref1;if(((_ref=this.value)!=null?_ref.match:void 0)!=null&&((_ref1=this.value)!=null?_ref1.contained:void 0)!=null){return"Expected "+this.formatValue(utils.descOfNode(this.actual))+" not to contains "+this.formatValue(this.value)}else{valuesDescription=utils.literalEnumeration(this.values.map(function(v){return utils.inspect(v)}));return"Expected "+this.formatValue(utils.descOfNode(this.actual))+" not to contains "+this.formatValue(valuesDescription)}})});spectacular.matcher("throwAnError",function(){takes("message");description(function(){var msg;msg=this.message!=null?" with message "+this.formatValue(this.message):"";if(this["arguments"]!=null){msg+=" with arguments "+this.formatValue(utils.inspect(this["arguments"]))}if(this.context!=null){msg+=" in context "+this.formatValue(utils.inspect(this.context))}return"throw an error"+msg});chain("with",function(){var arguments,_arguments;_arguments=1<=arguments.length?__slice.call(arguments,0):[];this["arguments"]=_arguments});chain("inContext",function(context){this.context=context});match(function(actual){var err,result;try{if(this["arguments"]!=null){actual.apply(this.context,this["arguments"])}else{actual.call(this.context)}}catch(_error){err=_error}this.error=err;result=this.message!=null?this.error!=null&&this.message.test(this.error.message):this.error!=null;return result});failureMessageForShould(function(){return"Expected to "+this.description+" but was "+this.formatValue(this.error)});return failureMessageForShouldnt(function(){return"Expected not to "+this.description+" but was "+this.formatValue(this.error)})});spectacular.matcher("haveAttribute",function(){takes("attribute");chain("to",function(matcher){this.matcher=matcher});description(function(){var desc;desc="have attribute "+this.formatValue(this.attribute);if(this.matcher!=null){desc+=" to "+this.matcher.description}return desc});match(function(actual){if(this.matcher!=null){return actual.hasAttribute(this.attribute)&&this.matcher.match(actual.getAttribute(this.attribute))}else{return actual.hasAttribute(this.attribute)}});failureMessageForShould(function(){var desc;desc="Expected "+this.formatValue(utils.descOfNode(this.actual))+" to have an attribute "+this.formatValue(this.attribute);if(this.matcher!=null){desc+=" to "+this.matcher.description}return desc});return failureMessageForShouldnt(function(){var desc;desc="Expected "+this.formatValue(utils.descOfNode(this.actual))+" not to have an attribute "+this.formatValue(this.attribute);if(this.matcher!=null){desc+=" to "+this.matcher.description}return desc})});spectacular.matcher("haveAttributes",function(){var collectHashs,collectStrings;collectStrings=function(col){return col.filter(function(el){return typeof el==="string"})};collectHashs=function(col){return col.filter(function(el){return typeof el==="object"})};takes("attributes...");description(function(){var desc,descs,hashAttributes,stringAttributes,_this=this;stringAttributes=collectStrings(this.attributes).map(function(v){return _this.formatValue(v)});hashAttributes=collectHashs(this.attributes);descs=[];descs=descs.concat(stringAttributes);hashAttributes.forEach(function(item){var _results;_results=[];for(k in item){v=item[k];_results.push(descs.push(""+_this.formatValue(k)+" to "+v.description))}return _results});desc="have "+(descs.length>1?"attributes":"attribute")+" ";desc+=utils.literalEnumeration(descs);return desc});match(function(actual){var m,res,_i,_len,_ref,_this=this;this.matchers=[];this.attributes.forEach(function(key){var _results;if(typeof key==="object"){_results=[];for(k in key){_results.push(_this.matchers.push(haveAttribute(k).to(key[k])))}return _results}else{return _this.matchers.push(haveAttribute(key))}});res=true;_ref=this.matchers;for(_i=0,_len=_ref.length;_i<_len;_i++){m=_ref[_i];res=m.match(actual)&&res}return res});failureMessageForShould(function(){var _ref;return(_ref=this.matchers)!=null?_ref.filter(function(m){return!m.success}).map(function(m){return m.messageForShould}).join("\n"):void 0});return failureMessageForShouldnt(function(){var _ref;return(_ref=this.matchers)!=null?_ref.filter(function(m){return!m.success}).map(function(m){return m.messageForShouldnt}).join("\n"):void 0})});spectacular.matcher("haveClass",function(){takes("className");description(function(){return"have class "+this.formatValue(this.className)});match(function(actual){var classes,_ref;classes=actual.getAttribute("class");return classes!=null&&(_ref=this.className,__indexOf.call(classes.split(/\s+/g),_ref)>=0)});failureMessageForShould(function(){return"Expected "+this.formatValue(utils.descOfNode(this.actual))+" to "+this.description});return failureMessageForShouldnt(function(){return"Expected "+this.formatValue(utils.descOfNode(this.actual))+" not to "+this.description})});spectacular.matcher("haveSelector",function(){takes("selector");description(function(){return"have content that match "+this.formatValue(this.selector)});match(function(actual){var _this=this;if(actual.length!=null){return Array.prototype.some.call(actual,function(e){return e.querySelectorAll(_this.selector).length>0})}else{return actual.querySelectorAll(this.selector).length>0}});failureMessageForShould(function(){return"Expected "+this.formatValue(utils.descOfNode(this.actual))+" to have selector "+this.formatValue(this.selector)});return failureMessageForShouldnt(function(){return"Expected "+this.formatValue(utils.descOfNode(this.actual))+" not to have selector "+this.formatValue(this.selector)})});spectacular.formatters={};spectacular.formatters.CHAR_MAP={errored:"E",failure:"F",skipped:"x",pending:"*",success:"."};spectacular.formatters.COLOR_MAP={pending:"yellow",skipped:"magenta",failure:"red",errored:"yellow",success:"green"};spectacular.formatters.BADGE_MAP={errored:"error",failure:"fail"};spectacular.formatters.console={};_ref=spectacular.formatters,CHAR_MAP=_ref.CHAR_MAP,COLOR_MAP=_ref.COLOR_MAP,BADGE_MAP=_ref.BADGE_MAP;spectacular.formatters.console.DocumentationFormatter=function(){function DocumentationFormatter(example,options){this.example=example;this.options=options}DocumentationFormatter.prototype.format=function(){var ancestors,dif,res,start,state,_base,_base1;state=this.example.result.state;(_base=this.options).lastDepth||(_base.lastDepth=0);(_base1=this.options).lastAncestorsStack||(_base1.lastAncestorsStack=[]);ancestors=this.example.ancestors.filter(function(e){return e.ownDescription!==""});dif=this.cropAncestors(ancestors,this.options.lastAncestorsStack);start=ancestors.length-dif.length;res=this.formatDocumentation(this.example,dif,start,COLOR_MAP[state]);this.options.lastAncestorsStack=ancestors;return res};DocumentationFormatter.prototype.formatDocumentation=function(example,stack,start,color){var e,i,res,reverseStack,_i,_j,_len,_len1;reverseStack=[];for(_i=0,_len=stack.length;_i<_len;_i++){e=stack[_i];reverseStack.unshift(e)}res="";for(i=_j=0,_len1=reverseStack.length;_j<_len1;i=++_j){e=reverseStack[i];if(i===0){res+="\n"}res+="\n";res+=utils.indent(utils.strip(e.ownDescription),(start+1)*2);start+=1}res+="\n";res+=utils.indent(spectacular.utils.colorize(utils.strip(example.ownDescriptionWithExpectations),color,this.options.colors),(start+1)*2);this.options.lastDepth=start;return res};DocumentationFormatter.prototype.cropAncestors=function(ancestors,lastAncestorsStack){var a,elder,_i,_len;a=[];for(_i=0,_len=ancestors.length;_i<_len;_i++){elder=ancestors[_i];if(__indexOf.call(lastAncestorsStack,elder)<0){a.push(elder)}}return a};return DocumentationFormatter}();spectacular.formatters.console.DurationFormatter=function(){function DurationFormatter(runner,results){this.runner=runner;this.results=results;this.options=this.runner.options}DurationFormatter.prototype.format=function(){var loadDuration,loadEndedAt,loadStartedAt,promise,res,specsDuration,specsEndedAt,specsStartedAt,_ref1;promise=new spectacular.Promise;_ref1=this.results,loadStartedAt=_ref1.loadStartedAt,loadEndedAt=_ref1.loadEndedAt,specsStartedAt=_ref1.specsStartedAt,specsEndedAt=_ref1.specsEndedAt;
4
+ if(loadStartedAt!=null&&loadEndedAt!=null){loadDuration=this.formatDuration(loadStartedAt,loadEndedAt)}specsDuration=this.formatDuration(specsStartedAt,specsEndedAt);res="";if(loadDuration!=null){res+=" Specs loaded in "+loadDuration+"\n"}res+=" Finished in "+specsDuration+"\n\n";promise.resolve(res);return promise};DurationFormatter.prototype.formatDuration=function(start,end){var duration;duration=(end.getTime()-start.getTime())/1e3;return spectacular.utils.colorize(""+Math.max(0,duration)+"s","yellow",this.options.colors)};return DurationFormatter}();spectacular.formatters.console.ErrorFormatter=function(){function ErrorFormatter(error,options){this.error=error;this.options=options}ErrorFormatter.prototype.format=function(){var column,file,fileFormatter,formatters,line,promise,res,stackFormatter,_ref1,_this=this;promise=new spectacular.Promise;formatters=spectacular.formatters.console;res=this.formatMessage(this.error.message);res+="\n";if(this.error.stack!=null){stackFormatter=new formatters.ErrorStackFormatter(this.error.stack,this.options);if(this.options.showSource){_ref1=stackFormatter.parser.details(stackFormatter.parser.lines[0]),file=_ref1.file,line=_ref1.line,column=_ref1.column;fileFormatter=new formatters.ErrorSourceFormatter(this.options,file,line,column);fileFormatter.format().then(function(result){res+=spectacular.utils.colorize(result,"grey",_this.options.colors);return stackFormatter.format()}).then(function(result){res+=result;return promise.resolve(res)}).fail(function(reason){console.log(reason);return promise.resolve(res)})}else{res+=stackFormatter.format();promise.resolve(res)}}else{promise.resolve(res+"\n")}return promise};ErrorFormatter.prototype.formatMessage=function(message){return"\n"+spectacular.utils.indent(message||"")};return ErrorFormatter}();spectacular.formatters.console.ErrorSourceFormatter=function(){function ErrorSourceFormatter(options,file,line,column){this.options=options;this.file=file;if(column==null){column=1}this._format=__bind(this._format,this);this.line=parseInt(line);this.column=parseInt(column)}ErrorSourceFormatter.prototype.format=function(){var promise,_this=this;promise=new spectacular.Promise;if(this.options.hasSourceMap(this.file)){this.options.getOriginalSourceFor(this.file,this.line,this.column).then(function(res){return promise.resolve(_this._format(res))})}else{this.options.loadFile(this.file).then(function(content){return promise.resolve(_this._format({content:content,line:_this.line,column:_this.column}))})}return promise};ErrorSourceFormatter.prototype._format=function(_arg){var column,columnIndicator,content,end,line,lines,start,_ref1;content=_arg.content,line=_arg.line,column=_arg.column;_ref1=this.selectLines(content,line),lines=_ref1.lines,start=_ref1.start,end=_ref1.end;columnIndicator=this.columnIndicator(column);if(line!==end){lines.splice(line-start+1,0,columnIndicator)}else{lines.push(columnIndicator)}return"\n"+lines.join("\n")+"\n"};ErrorSourceFormatter.prototype.selectLines=function(content,line){var endLine,lines,startLine;lines=content.split("\n");startLine=Math.max(1,line-3)-1;endLine=Math.min(lines.length,line+1)-1;lines=lines.slice(startLine,+endLine+1||9e9).map(function(l,i){var pad;pad=l.length>0?" ":"";return" "+utils.padRight(i+startLine+1)+" |"+pad+l});return{lines:lines,start:startLine+1,end:endLine+1}};ErrorSourceFormatter.prototype.columnIndicator=function(column){return" | "+spectacular.utils.padRight("^",column)};return ErrorSourceFormatter}();spectacular.formatters.console.ErrorStackFormatter=function(){function ErrorStackFormatter(stack,options){this.stack=stack;this.options=options;this.parser=new spectacular.errors.ErrorParser(this.stack)}ErrorStackFormatter.prototype.format=function(){var l,lines,promise,stack;promise=new spectacular.Promise;lines=this.parser.lines;lines=lines.map(function(line){return line.replace(/^\s*/," ")});if(!this.options.longTrace){l=lines.length;lines=lines.slice(0,6);l=l-lines.length;if(l!==0){lines.push("\n use the --long-trace option to view the "+l+" remaining lines")}}stack="\n"+lines.join("\n")+"\n\n";promise.resolve(spectacular.utils.colorize(stack,"grey",this.options.colors));return promise};return ErrorStackFormatter}();spectacular.formatters.console.ExampleResultsFormatter=function(){function ExampleResultsFormatter(example,options,id){this.example=example;this.options=options;this.id=id}ExampleResultsFormatter.prototype.format=function(){var expectation,promise,promises,reason,result,_i,_len,_ref1;result=this.example.result;promise=new spectacular.Promise;switch(result.state){case"errored":this.formatExample(this.example.fullDescription,this.example.reason,result.state).then(function(msg){return promise.resolve(msg)});break;case"failure":if(result.expectations.length>0){promises=[];_ref1=result.expectations;for(_i=0,_len=_ref1.length;_i<_len;_i++){expectation=_ref1[_i];if(!expectation.success){reason={message:expectation.message,stack:expectation.trace.stack};promises.push(this.formatExample(expectation.fullDescription,reason,result.state))}}spectacular.Promise.all(promises).then(function(results){return promise.resolve(results.join(""))})}else{this.formatExample(this.example.fullDescription,this.example.reason,result.state).then(function(msg){return promise.resolve(msg)})}break;default:promise.resolve("")}return promise};ExampleResultsFormatter.prototype.formatExample=function(message,error,state){var errorFormatter,_this=this;errorFormatter=new spectacular.formatters.console.ErrorFormatter(error,this.options);return errorFormatter.format().then(function(errorTxt){var res;res=_this.badge(message,BADGE_MAP[state],COLOR_MAP[state]);return res+"\n"+errorTxt})};ExampleResultsFormatter.prototype.badge=function(message,label,color){var c,hc,res;c=spectacular.utils.colorize;hc=this.options.colors;res="";res+=c(c((" "+label+" ").toUpperCase(),"inverse",hc),"bold",hc);res+=" "+this.id+" ";res+=c(" ","inverse",hc);res+=" ";res+=message;res=c(res,color,hc);return res};return ExampleResultsFormatter}();spectacular.formatters.console.ProfileFormatter=function(){function ProfileFormatter(runner,results){var _ref1;this.runner=runner;this.results=results;_ref1=this.runner,this.examples=_ref1.examples,this.options=_ref1.options}ProfileFormatter.prototype.format=function(){var duration,example,promise,rate,res,sortedExamples,topSlowest,totalDuration,_i,_len;promise=new spectacular.Promise;sortedExamples=this.examples.sort(function(a,b){return b.duration-a.duration}).slice(0,10);totalDuration=this.results.specsEndedAt.getTime()-this.results.specsStartedAt.getTime();topSlowest=sortedExamples.reduce(function(a,b){return a+b.duration},0);rate=Math.floor(topSlowest/totalDuration*1e4)/100;res=" Top 10 slowest examples ("+topSlowest/1e3+" seconds, "+rate+"% of total time)\n\n";for(_i=0,_len=sortedExamples.length;_i<_len;_i++){example=sortedExamples[_i];duration=""+Math.floor(example.duration)/1e3+" seconds";res+=" "+spectacular.utils.colorize(duration,"red",this.options.colors)+" "+example.fullDescription+"\n"}promise.resolve(""+res+"\n");return promise};return ProfileFormatter}();spectacular.formatters.console.ProgressFormatter=function(){function ProgressFormatter(example,options){this.example=example;this.options=options}ProgressFormatter.prototype.format=function(){var state;state=this.example.result.state;return spectacular.utils.colorize(CHAR_MAP[state],COLOR_MAP[state],this.options.colors)};return ProgressFormatter}();spectacular.formatters.console.ResultsFormatter=function(){function ResultsFormatter(runner,results){var _ref1;this.runner=runner;this.results=results;this.options=this.runner.options;_ref1=this.results,this.errors=_ref1.errors,this.failures=_ref1.failures,this.skipped=_ref1.skipped,this.pending=_ref1.pending,this.results=_ref1.results}ResultsFormatter.prototype.format=function(){var assertions,errored,failures,pending,promise,skipped,success;promise=new spectacular.Promise;failures=this.failures.length;errored=this.errors.length;skipped=this.skipped.length;pending=this.pending.length;success=this.runner.examples.length-failures-errored-pending-skipped;assertions=this.results.reduce(function(a,b){return a+b.expectations.length},0);promise.resolve(this.formatResults(success,failures,errored,skipped,pending,assertions));return promise};ResultsFormatter.prototype.formatResults=function(success,failures,errors,skipped,pending,assertions){var hasError,res,toggle;toggle=spectacular.utils.toggle;hasError=failures+errors;res=[];res.push(this.formatCount(success,"success","success",toggle(hasError,"green")));res.push(this.formatCount(assertions,"assertion","assertions",toggle(hasError,"green")));res.push(this.formatCount(failures,"failure","failures",toggle(hasError,"green","red")));res.push(this.formatCount(errors,"error","errors",toggle(errors,"green","yellow")));res.push(this.formatCount(skipped,"skipped","skipped",toggle(skipped,"green","magenta")));res.push(this.formatCount(pending,"pending","pending",toggle(pending,"green","yellow")));return" "+res.join(", ")+"\n"};ResultsFormatter.prototype.formatCount=function(value,singular,plural,color){var s;s=""+value+" "+(value===0?plural:value===1?singular:plural);if(color!=null){s=spectacular.utils.colorize(s,color,this.options.colors)}return s};return ResultsFormatter}();spectacular.formatters.console.ResumeFormatter=function(){function ResumeFormatter(runner,results){var _ref1;this.runner=runner;this.results=results;this.options=this.runner.options;_ref1=this.results,this.errors=_ref1.errors,this.failures=_ref1.failures,this.skipped=_ref1.skipped,this.pending=_ref1.pending}ResumeFormatter.prototype.format=function(){var promise,res;promise=new spectacular.Promise;res="";if(this.errors.length>0){res+=this.formatResume("Errors:",this.errors,"yellow")}if(this.failures.length>0){res+=this.formatResume("Failures:",this.failures,"red")}if(this.skipped.length>0){res+=this.formatResume("Skipped:",this.skipped,"magenta")}if(this.pending.length>0){res+=this.formatResume("Pending:",this.pending,"yellow")}promise.resolve(res);return promise};ResumeFormatter.prototype.formatResume=function(desc,array,color){var res;res=" "+desc+"\n\n";res+=array.map(function(e,i){return" "+(i+1)+". "+e.fullDescription}).join("\n");return""+spectacular.utils.colorize(res,color,this.options.colors)+"\n\n"};return ResumeFormatter}();spectacular.formatters.console.SeedFormatter=function(){function SeedFormatter(runner){this.runner=runner;this.options=this.runner.options;this.seed=this.options.seed}SeedFormatter.prototype.format=function(){var promise;promise=new spectacular.Promise;promise.resolve(" Seed "+spectacular.utils.colorize(this.seed.toString(),"cyan",this.options.colors)+"\n\n");return promise};return SeedFormatter}();spectacular.formatters.browser={};spectacular.widgets={};_ref1=spectacular.formatters,CHAR_MAP=_ref1.CHAR_MAP,COLOR_MAP=_ref1.COLOR_MAP,BADGE_MAP=_ref1.BADGE_MAP;utils=spectacular.utils;escapeHTML=function(str){return str.replace(/</g,"&lt;").replace(/>/g,"&gt;")};stripHTML=function(str){var n;n=document.createElement("span");n.innerHTML=str;return n.textContent};selfAndAncestors=function(node,block){block.call(this,node);return ancestors(node,block)};ancestors=function(node,block){var parent;parent=node.parentNode;if(hasClass(parent,"example-group")){block.call(this,parent);return ancestors(parent,block)}};wrapNode=function(node){if(node==null){return[]}if(node.length!=null){return node}else{return[node]}};hasClass=function(nl,cls){nl=wrapNode(nl);return Array.prototype.every.call(nl,function(n){return RegExp("(\\s|^)"+cls+"(\\s|$)").test(n.className)})};addClass=function(nl,cls){nl=wrapNode(nl);return Array.prototype.forEach.call(nl,function(node){if(!hasClass(node,cls)){return node.className+=" "+cls}})};removeClass=function(nl,cls){nl=wrapNode(nl);return Array.prototype.forEach.call(nl,function(node){return node.className=node.className.replace(cls,"")})};toggleClass=function(nl,cls){nl=wrapNode(nl);return Array.prototype.forEach.call(nl,function(node){if(hasClass(node,cls)){return removeClass(node,cls)}else{return addClass(node,cls)}})};fixNodeHeight=function(nl){nl=wrapNode(nl);return Array.prototype.forEach.call(nl,function(node){return node.style.height=""+node.clientHeight+"px"})};tag=function(tag,inner,attrs,block){var node,_ref2,_ref3;if(inner==null){inner=""}if(attrs==null){attrs={}}if(typeof inner==="object"){_ref2=["",inner,attrs],inner=_ref2[0],attrs=_ref2[1],block=_ref2[2]}if(typeof inner==="function"){_ref3=["",{},inner],inner=_ref3[0],attrs=_ref3[1],block=_ref3[2]}if(typeof block==="function"){inner=block()}node=document.createElement(tag);for(k in attrs){v=attrs[k];node.setAttribute(k,v)}if(typeof inner==="string"){node.innerHTML=inner}else{node.appendChild(inner)}return node};buildHTML=function(html){var res;res=tag("div",html).children;if(res.length===1){return res[0]}else{return res}};icon=function(icon){return tag("i",{"class":"icon-"+icon})};spectacular.widgets.ExampleViewer=function(){function ExampleViewer(){}ExampleViewer.prototype.init=function(runner,reporter){this.runner=runner;this.reporter=reporter;this.container=buildHTML(spectacular.templates.viewer());this.view=this.container.querySelector("div");return this.reporter.container.appendChild(this.container)};ExampleViewer.prototype.displayCard=function(example){var _this=this;this.view.innerHTML=this.getCard(example);this.stack=this.view.querySelector(".stack");this.expectationMessage=this.view.querySelector(".expectation-message");this.expectations=this.view.querySelectorAll(".expectation");if(this.expectations.length>0){return this.each(this.expectations,function(node,i){var expectation,index;index=node.attributes["data-expectation"].value;expectation=example.result.expectations[index];node.onclick=function(){return _this.displayExpectationDetails(node,expectation)};if(i===0){return _this.displayExpectationDetails(node,expectation)}})}else{if(example.result.expectations.length===0&&example.examplePromise.reason){return this.displayStack(example.examplePromise.reason.stack)}}};ExampleViewer.prototype.displayExpectationDetails=function(node,expectation){this.each(this.expectations,function(el){return removeClass(el,"active")});this.expectationMessage.innerHTML=expectation.message;this.expectationMessage.setAttribute("class",expectation.success?"expectation-message success":"expectation-message failure");this.clearStack();if(expectation.trace!=null){this.displayStack(expectation.trace.stack)}return addClass(node,"active")};ExampleViewer.prototype.clearStack=function(){return this.stack.innerHTML=""};ExampleViewer.prototype.displayStack=function(stack){var parser,_this=this;parser=new spectacular.errors.ErrorParser(stack);return parser.lines.forEach(function(stackLine,i){var column,div,file,line,method,_ref2;_ref2=parser.details(stackLine),file=_ref2.file,line=_ref2.line,column=_ref2.column,method=_ref2.method;div=tag("div",function(){return tag("a",escapeHTML(stackLine))});div.onclick=function(){if(hasClass(div,"has-source")){return _this.hideSource(div)}else{return _this.displayLineSource(div,file,line,column)}};_this.stack.appendChild(div);if(i===0){return _this.displayLineSource(div,file,line,column)}})};ExampleViewer.prototype.hideSource=function(div){div.removeChild(div.children[1]);return removeClass(div,"has-source")};ExampleViewer.prototype.displayLineSource=function(div,file,line,column){var f,w;f=new spectacular.formatters.console.ErrorSourceFormatter(this.runner.options,file,line,column);w=function(s,c){return"<span class='"+c+"'>"+s+"</span>"};return f.format().then(function(result){div.appendChild(tag("pre",function(){var lines;lines=result.replace(/^\n|\n$/g,"").split("\n");lines=lines.map(function(line){line=line.replace(/^\s+(\d+\s)*\|/gm,w("$&","line-number"));return tag("span",line).outerHTML});return lines.join("\n")}));return addClass(div,"has-source")})};ExampleViewer.prototype.each=function(nodes,block){return Array.prototype.forEach.call(nodes,block)};ExampleViewer.prototype.getCard=function(example){return spectacular.templates.card({example:example})};ExampleViewer.prototype.onStart=function(event){};ExampleViewer.prototype.onResult=function(event){};ExampleViewer.prototype.onEnd=function(event){};return ExampleViewer}();spectacular.widgets.ExamplesList=function(){function ExamplesList(){}ExamplesList.prototype.init=function(runner,reporter){var btn,html,openLeft,openRight,_this=this;this.runner=runner;this.reporter=reporter;this.examples=[];this.container=buildHTML(spectacular.templates.list({chars:CHAR_MAP}));this.list=this.container.querySelector("div");this.totalValue=this.container.querySelector(".all .total");this.allValue=this.container.querySelector(".all .value");this.viewer=this.reporter.widgets.filter(function(w){return w.constructor===spectacular.widgets.ExampleViewer})[0];btn=this.container.querySelector(".btn-collapse");btn.onclick=function(){toggleClass(_this.container,"collapse");if(hasClass(_this.container,"collapse")){return Array.prototype.forEach.call(_this.list.children,function(el){return addClass(el,"collapse")})}else{return Array.prototype.forEach.call(_this.list.children,function(el){return removeClass(el,"collapse")})}};html=document.querySelector("html");openLeft=this.container.querySelector(".btn-open-left");openLeft.onclick=function(){if(hasClass(html,"snapjs-left")){return _this.reporter.snapper.close()}else{return _this.reporter.snapper.open("left")}};openRight=this.container.querySelector(".btn-open-right");openRight.onclick=function(){if(hasClass(html,"snapjs-right")){return _this.reporter.snapper.close()}else{return _this.reporter.snapper.open("right")}};return this.reporter.container.appendChild(this.container)};ExamplesList.prototype.onStart=function(){return this.totalValue.textContent=this.runner.examples.length};ExamplesList.prototype.onResult=function(event){var example,state,_ref2;example=event.target;state=example.result.state;if((state==="failure"||state==="errored")&&!hasClass(this.reporter.container,"hide-success")){addClass(this.container,"fail");addClass(this.reporter.container,"hide-success");this.reporter.snapper.open("right");if((_ref2=this.viewer)!=null){_ref2.displayCard(example)}}this.buildExample(example);this.examples.push(example);return this.allValue.textContent=this.examples.length};ExamplesList.prototype.onEnd=function(event){if(hasClass(this.container,"fail")){return addClass(this.container,"failure")}else{return addClass(this.container,"success")}};ExamplesList.prototype.buildExample=function(example){var node;node=this.getParent(example);if(example.failed){selfAndAncestors(node,function(node){if(hasClass(node,"success")){removeClass(node,"success");return addClass(node,"failure")}})}return node.appendChild(this.getExample(example))};ExamplesList.prototype.getExample=function(example){var node,state,_this=this;state=example.result.state;node=tag("article",example.ownDescriptionWithExpectations,{"class":"example "+state,id:this.examples.length,title:example.fullDescription,"data-index":stripHTML(example.fullDescription.toLowerCase())});node.onclick=function(){_this.viewer.displayCard(_this.examples[node.attributes.id.value]);return _this.reporter.snapper.open("right")};return node};ExamplesList.prototype.getParent=function(example){var a,ancestor,elders,id,n,node,parent,reversed,_i,_j,_len,_len1;elders=example.ancestors;elders.pop();reversed=[];for(_i=0,_len=elders.length;_i<_len;_i++){a=elders[_i];reversed.unshift(a)}node=this.list;n=0;for(_j=0,_len1=reversed.length;_j<_len1;_j++){ancestor=reversed[_j];id=ancestor.ownDescription.replace(/^[\s\W]+|[\s\W]+$/g,"").replace(/[^\w\d]+/g,"-").toLowerCase();if(id===""){continue}parent=node;node=node.querySelector("#"+id);if(node==null){node=this.buildParent(ancestor,id,n);parent.appendChild(node)}n++}return node};ExamplesList.prototype.buildParent=function(ancestor,id,n){var content,header,index,node;content="<header title='"+ancestor.description+"'>\n"+ancestor.ownDescription+"\n</header>";index=ancestor.allExamples.map(function(ex){return stripHTML(ex.description.toLowerCase())}).join();node=tag("section",content,{id:id,"class":"example-group "+(ancestor.failed?"failure":"success")+" level"+n,"data-index":index});header=node.querySelector("header");header.onclick=function(){return toggleClass(node,"collapse")};return node};return ExamplesList}();spectacular.widgets.ExamplesSearch=function(){function ExamplesSearch(){}ExamplesSearch.prototype.init=function(runner,reporter){var _ref2,_this=this;this.runner=runner;this.reporter=reporter;this.container=buildHTML(spectacular.templates.search());this.form=this.container.querySelector("form");this.input=this.container.querySelector("input");this.style=this.container.querySelector("style");if((_ref2=this.reporter.container.querySelector("#examples header"))!=null){_ref2.appendChild(this.container)}return this.form.onsubmit=function(){var e,value;try{value=spectacular.utils.strip(_this.input.value);if(value===""){_this.style.innerHTML=""}else{_this.style.innerHTML='[data-index]:not([data-index*="'+value.toLowerCase()+'"]) { display: none; }'}}catch(_error){e=_error;console.log(e);console.log(e.stack)}return false}};ExamplesSearch.prototype.onStart=function(e){};ExamplesSearch.prototype.onResult=function(e){};ExamplesSearch.prototype.onEnd=function(e){};return ExamplesSearch}();Plurals={failure:"failures",errored:"errored",skipped:"skipped",pending:"pending",success:"success"};spectacular.widgets.RunnerProgress=function(){function RunnerProgress(){}RunnerProgress.prototype.init=function(runner,reporter){var state;this.runner=runner;this.reporter=reporter;this.container=buildHTML(spectacular.templates.progress({seed:this.runner.options.seed,chars:CHAR_MAP}));this.totalValue=this.container.querySelector(".all .total");this.timeValue=this.container.querySelector(".time .value");this.allValue=this.container.querySelector(".all .value");for(state in CHAR_MAP){this[state+"Value"]=this.container.querySelector("."+state+" .value");this[state+"Text"]=this.container.querySelector("."+state+" .symbol")}return this.reporter.container.appendChild(this.container)};RunnerProgress.prototype.onStart=function(){var btn,self,state,_results,_this=this;this.counters={all:0,failure:0,errored:0,skipped:0,pending:0,success:0};this.totalValue.textContent=this.runner.examples.length;this.interval=setInterval(function(){var t;t=new Date(new Date-_this.runner.specsStartedAt);return _this.timeValue.textContent=""+t.getSeconds()+"."+t.getMilliseconds()+"s"},100);self=this;_results=[];for(state in CHAR_MAP){btn=this.container.querySelector("."+state);_results.push(btn.onclick=function(){return toggleClass(document.body,"hide-"+this.attributes["data-state"].value)})}return _results};RunnerProgress.prototype.update=function(){var c,key,_results;this.allValue.textContent=this.counters.all;_results=[];for(key in CHAR_MAP){c=CHAR_MAP[key];this[""+key+"Value"].textContent=this.counters[key];this[""+key+"Text"].textContent=" "+(this.counters[key]>1?Plurals[key]:key);if(this.counters[key]&&!hasClass(this[key],"not-zero")){_results.push(addClass(this[key],"not-zero"))}else{_results.push(void 0)}}return _results};RunnerProgress.prototype.onResult=function(e){var example,_ref2;example=e.target;this.counters.all++;this.counters[example.result.state]++;if((_ref2=example.result.state)==="failure"||_ref2==="errored"){addClass(this.container,"fail")}return this.update()};RunnerProgress.prototype.onEnd=function(e){var results,t;clearInterval(this.interval);results=e.target;t=new Date(results.specsEndedAt-results.specsStartedAt);this.timeValue.textContent=""+t.getSeconds()+"."+t.getMilliseconds()+"s";if(this.counters.failure===0&&this.counters.errored===0){return addClass(this.container,"success")}else{return addClass(this.container,"failure")}};return RunnerProgress}();spectacular.ConsoleReporter=function(){ConsoleReporter.include(spectacular.EventDispatcher);ConsoleReporter.getDefault=function(options){var f,reporter;reporter=new ConsoleReporter(options);f=spectacular.formatters.console;if(options.resume){reporter.resultFormatters.push(f.ResumeFormatter)}if(options.profile){reporter.resultFormatters.push(f.ProfileFormatter)}reporter.resultFormatters.push(f.DurationFormatter);reporter.resultFormatters.push(f.SeedFormatter);reporter.resultFormatters.push(f.ResultsFormatter);reporter.progressFormatters["documentation"]=f.DocumentationFormatter;reporter.progressFormatters["progress"]=f.ProgressFormatter;reporter.exampleResultsFormatters.push(f.ExampleResultsFormatter);return reporter};function ConsoleReporter(options){this.options=options;this.printExampleResult=__bind(this.printExampleResult,this);this.onEnd=__bind(this.onEnd,this);this.onResult=__bind(this.onResult,this);this.onMessage=__bind(this.onMessage,this);this.resultFormatters=[];this.exampleResultsFormatters=[];this.progressFormatters={}}ConsoleReporter.prototype.onMessage=function(event){return this.dispatch(event)};ConsoleReporter.prototype.onResult=function(event){var example;example=event.target;return this.printExampleResult(example)};ConsoleReporter.prototype.onEnd=function(event){var allResults,errors,failures,options,printResult,promise,runner,runnerResults,_this=this;runnerResults=event.target;runner=runnerResults.runner;options=this.options;printResult=function(example,i){var promise,res;res="";promise=spectacular.Promise.unit("");_this.exampleResultsFormatters.forEach(function(formatter){return promise=promise.then(function(result){res+=result;return new formatter(example,options,i+1).format()})});return promise.then(function(result){return res+result})};errors=runnerResults.errors.map(printResult);failures=runnerResults.failures.map(printResult);allResults=["\n\n"];promise=spectacular.Promise.unit([]);if(errors.length>0){promise=promise.then(function(){return spectacular.Promise.all(errors)})}if(failures.length>0){promise=promise.then(function(results){allResults=allResults.concat(results);return spectacular.Promise.all(failures)})}if(this.resultFormatters.length>0){promise=promise.then(function(results){allResults=allResults.concat(results);return spectacular.Promise.all(_this.resultFormatters.map(function(formatter){return new formatter(runner,runnerResults).format()}))})}return promise.then(function(results){allResults=allResults.concat(results);return _this.dispatch(new spectacular.Event("report",allResults.join("")+"\n\n"))}).fail(function(reason){return console.log(reason.stack)})};ConsoleReporter.prototype.printExampleResult=function(example){var res,state;state=example.result.state;res=new this.progressFormatters[this.options.format](example,this.options).format();if(res!=null){return this.dispatch(new spectacular.Event("message",res))}};return ConsoleReporter}();spectacular.BrowserReporter=function(){function BrowserReporter(runner,widgets){this.runner=runner;this.widgets=widgets;this.onEnd=__bind(this.onEnd,this);this.onResult=__bind(this.onResult,this);this.onStart=__bind(this.onStart,this);this.options=this.runner.options;this.registerEvents()}BrowserReporter.prototype.registerEvents=function(){this.runner.on("start",this.onStart);this.runner.on("result",this.onResult);return this.runner.on("end",this.onEnd)};BrowserReporter.prototype.unregisterEvents=function(){this.runner.off("start",this.onStart);this.runner.off("result",this.onResult);return this.runner.off("end",this.onEnd)};BrowserReporter.prototype.init=function(){var _this=this;this.container=tag("div",{id:"container"});document.body.appendChild(this.container);this.widgets.forEach(function(w){return w.init(_this.runner,_this)});return this.initSnapper()};BrowserReporter.prototype.initSnapper=function(){var previousOnResize,_this=this;this.snapper=new Snap({element:this.container.querySelector("#examples"),minPosition:-viewerSize()});this.container.querySelector("#viewer").setAttribute("style","width: "+viewerSize()+"px;");this.snapper.open("left");previousOnResize=document.body.onresize;return document.body.onresize=function(){_this.snapper.close();_this.snapper.settings({minPosition:-viewerSize()});return _this.container.querySelector("#viewer").setAttribute("style","width: "+viewerSize()+"px;")}};BrowserReporter.prototype.onStart=function(e){var _this=this;return this.widgets.forEach(function(w){return w.onStart(e)})};BrowserReporter.prototype.onResult=function(e){return this.widgets.forEach(function(w){return w.onResult(e)})};BrowserReporter.prototype.onEnd=function(e){return this.widgets.forEach(function(w){return w.onEnd(e)})};return BrowserReporter}();spectacular.BrowserMethods=function(options){var cache,loaders;cache={};loaders={};if(options.valueOutput==null){options.valueOutput=function(value){return"<span class='value'>"+options.htmlSafe(String(value))+"</span>"}}if(options.htmlSafe==null){options.htmlSafe=function(str){return str.replace(/</g,"&lt;").replace(/>/g,"&gt;")}}if(options.loadFile==null){options.loadFile=function(file){var failure,promise,req,success;promise=new spectacular.Promise;success=function(data){return promise.resolve(data)};failure=function(reason){return promise.reject(reason)};if(file in cache){setTimeout(function(){return success(cache[file])},0);return promise}if(file in loaders){loaders[file].push({success:success,failure:failure});return promise}req=new XMLHttpRequest;req.onload=function(){var data;data=this.responseText;cache[file]=data;if(req.status>=400){return loaders[file].forEach(function(f){return f.failure(new Error(data))})}else{return loaders[file].forEach(function(f){return f.success(data)})}};loaders[file]=[{success:success,failure:failure}];req.open("get",file,true);req.send();return promise}}if(options.getOriginalSourceFor==null){options.getOriginalSourceFor=function(file,line,column){var fileSource,promise,_this=this;promise=new spectacular.Promise;fileSource=null;this.loadFile(this.getSourceURLFor(file)).then(function(source){fileSource=source;return _this.loadFile(_this.getSourceMapURLFor(file))}).then(function(sourceMap){var consumer,_ref2;consumer=new window.sourceMap.SourceMapConsumer(sourceMap);_ref2=consumer.originalPositionFor({line:line,column:column}),line=_ref2.line,column=_ref2.column;return promise.resolve({content:fileSource,line:line,column:column})}).fail(function(){return _this.loadFile(file).then(function(content){return promise.resolve({content:content,line:line,column:column})})});return promise}}if(options.hasSourceMap==null){options.hasSourceMap=function(file){return false}}if(options.getSourceURLFor==null){options.getSourceURLFor=function(file){}}if(options.getSourceMapURLFor==null){return options.getSourceMapURLFor=function(file){}}};spectacular.URLParameters=function(){function URLParameters(parameters){var tuples,_this=this;tuples=String(parameters).split("&").map(function(tuple){return tuple.split("=")});tuples.forEach(function(_arg){var key,value;key=_arg[0],value=_arg[1];return _this.consumeKeys(_this,_this.parseKey(key),_this.parseValue(value))})}URLParameters.prototype.parseKey=function(key){if(key.substr(-1)==="]"){key=key.slice(0,-1)}return key.split(/\]*\[/g)};URLParameters.prototype.parseValue=function(value){switch(true){case this.isBoolean(value):return/true|on|yes/.test(value);case this.isFloat(value):return parseFloat(value);case this.isInteger(value):return parseInt(value);default:return value}};URLParameters.prototype.isBoolean=function(value){return/^(true|false|on|off|yes|no)$/.test(String(value))};URLParameters.prototype.isFloat=function(value){return/^\d+\.\d+$/.test(String(value))};URLParameters.prototype.isInteger=function(value){return/^\d+$/.test(String(value))};URLParameters.prototype.isArray=function(a){return Object.prototype.toString.call(a)==="[object Array]"};URLParameters.prototype.consumeKeys=function(target,keys,value){var previousKey,targets,_this=this;previousKey=null;targets=[this];return keys.forEach(function(key,index){var keysRemains,o;
5
+ keysRemains=keys.length-index>1;if(_this.isInteger(key)){if(target[key]!=null){if(keysRemains){target=target[key]}else{target[key].push(value)}}else{if(keysRemains){o={};target[key]=o;target=o}else{target[key]=[value]}}}else if(key===""){target=targets[targets.length-2];if(_this.isArray(target[previousKey])){if(keysRemains){target=targets[previousKey]}else{target[previousKey].push(value)}}else{if(keysRemains){target=target[previousKey]=[]}else{target[previousKey]=[value]}}}else{if(target[key]!=null){if(keysRemains){target=target[key]}else{target[key]=value}}else{if(keysRemains){target=target[key]={}}else{target[key]=value}}}targets.push(target);return previousKey=key})};return URLParameters}();spectacular.paths=spectacular.paths||[];spectacular.options=spectacular.options||{};defaults={coffee:false,verbose:false,profile:false,trace:true,longTrace:false,showSource:true,format:"progress",matchersRoot:"./specs/support/matchers",helpersRoot:"./specs/support/helpers",fixturesRoot:"./specs/support/fixtures",noMatchers:false,noHelpers:false,colors:true,random:true,seed:null,server:false,globs:[]};for(k in defaults){v=defaults[k];if(!k in spectacular.options){spectacular.options[k]=v}}a=document.createElement("a");a.href=window.location;if(a.search&&a.search.length>1){params=new spectacular.URLParameters(decodeURI(a.search.slice(1)))}for(k in params){v=params[k];if(params.hasOwnProperty(k)){spectacular.options[k]=v}}spectacular.BrowserMethods(spectacular.options);spectacular.env=new spectacular.Environment(spectacular.options);spectacular.env.globalize();spectacular.env.runner.loadStartedAt=new Date;viewerSize=function(){return Math.min(document.body.clientWidth-60,500)};window.env=spectacular.env;displayErrors=function(msg,file,line){var formatter;formatter=new spectacular.formatters.console.ErrorSourceFormatter(spectacular.options,file,line);return formatter.format().then(function(src){var node;node=document.createElement("div");node.innerHTML=spectacular.templates.error({message:msg,source:src});return document.body.appendChild(node)})};hasErrors=false;errors=[];window.onerror=function(e){hasErrors=true;displayErrors.apply(null,arguments);return true};currentWindowOnload=window.onload;window.onload=function(){var filter,n,reporter,s,scripts,_i,_len,_ref2;if(currentWindowOnload!=null){currentWindowOnload()}if(hasErrors){return}utils=spectacular.utils;if(spectacular.options.verbose){console.log(utils.indent(utils.inspect(spectacular.options)));console.log(utils.indent(utils.inspect(spectacular.paths)));console.log("\n Scripts loaded:");scripts=document.querySelectorAll("script[src]");for(_i=0,_len=scripts.length;_i<_len;_i++){s=scripts[_i];console.log(" "+((_ref2=s.attributes.getNamedItem("src"))!=null?_ref2.value:void 0))}console.log("")}reporter=new spectacular.BrowserReporter(spectacular.env.runner,[new spectacular.widgets.RunnerProgress,new spectacular.widgets.ExamplesList,new spectacular.widgets.ExampleViewer,new spectacular.widgets.ExamplesSearch]);if(spectacular.options.filter){filter=spectacular.options.filter;n=document.createElement("div");if(spectacular.options.verbose){console.log("Example Filter: '"+filter+"'")}spectacular.env.rootExampleGroup.allExamples.forEach(function(example){var desc;n.innerHTML=example.description;desc=n.textContent;if(desc.indexOf(filter)!==-1){return example.exclusive=true}})}reporter.init();spectacular.env.runner.loadEndedAt=new Date;spectacular.env.runner.specsStartedAt=new Date;return spectacular.env.run().fail(function(reason){return console.log(reason.stack)})}}).call(this);
@@ -0,0 +1,103 @@
1
+
2
+ spectacular.templates['card'] = function anonymous(locals) {
3
+ var buf = [];
4
+ var locals_ = (locals || {}),example = locals_.example,icons = locals_.icons;var result = (example.result);
5
+ var state = (result.state);
6
+ var hasExpectations = (result.expectations.length > 0);
7
+ icons = { success: 'ok', failure: 'remove', errored: 'remove', pending: 'ellipsis', skipped: 'remove' }
8
+ buf.push("<div" + (jade.attrs({ "class": [('example'),(state)] }, {"class":true})) + "><div class=\"details\"><section><span class=\"state\"><i" + (jade.attrs({ "class": [("icon-" + (icons[state]) + "")] }, {"class":true})) + "></i><span>" + (jade.escape(null == (jade.interp = state) ? "" : jade.interp)) + "</span></span><span class=\"time\"><i class=\"icon-time\"></i><span>" + (null == (jade.interp = (example.duration / 1000) + "s") ? "" : jade.interp) + "</span></span><a" + (jade.attrs({ 'href':("/?filter=" + (example.description) + ""), "class": [('refresh')] }, {"href":true})) + "><i class=\"icon-refresh\"></i><span>Rerun it!</span></a></section><header><h3>" + (null == (jade.interp = example.fullDescription) ? "" : jade.interp) + "</h3></header>");
9
+ if ( hasExpectations)
10
+ {
11
+ buf.push("<ul class=\"expectations\">");
12
+ // iterate result.expectations
13
+ ;(function(){
14
+ var $$obj = result.expectations;
15
+ if ('number' == typeof $$obj.length) {
16
+
17
+ for (var i = 0, $$l = $$obj.length; i < $$l; i++) {
18
+ var expectation = $$obj[i];
19
+
20
+ if ( expectation.success)
21
+ {
22
+ buf.push("<li" + (jade.attrs({ 'data-expectation':(i), "class": [('expectation'),('success')] }, {"data-expectation":true})) + ">" + (null == (jade.interp = expectation.description) ? "" : jade.interp) + "</li>");
23
+ }
24
+ else
25
+ {
26
+ buf.push("<li" + (jade.attrs({ 'data-expectation':(i), "class": [('expectation'),('failure')] }, {"data-expectation":true})) + ">" + (null == (jade.interp = expectation.description) ? "" : jade.interp) + "</li>");
27
+ }
28
+ }
29
+
30
+ } else {
31
+ var $$l = 0;
32
+ for (var i in $$obj) {
33
+ $$l++; var expectation = $$obj[i];
34
+
35
+ if ( expectation.success)
36
+ {
37
+ buf.push("<li" + (jade.attrs({ 'data-expectation':(i), "class": [('expectation'),('success')] }, {"data-expectation":true})) + ">" + (null == (jade.interp = expectation.description) ? "" : jade.interp) + "</li>");
38
+ }
39
+ else
40
+ {
41
+ buf.push("<li" + (jade.attrs({ 'data-expectation':(i), "class": [('expectation'),('failure')] }, {"data-expectation":true})) + ">" + (null == (jade.interp = expectation.description) ? "" : jade.interp) + "</li>");
42
+ }
43
+ }
44
+
45
+ }
46
+ }).call(this);
47
+
48
+ buf.push("</ul>");
49
+ }
50
+ else if ( state != 'success' && state != 'pending')
51
+ {
52
+ buf.push("<div class=\"message\">" + (jade.escape(null == (jade.interp = example.examplePromise.reason.message) ? "" : jade.interp)) + "</div>");
53
+ }
54
+ buf.push("</div><div class=\"expectation-message\"></div><div class=\"stack\"></div></div>");;return buf.join("");
55
+ }
56
+
57
+ spectacular.templates['error'] = function anonymous(locals) {
58
+ var buf = [];
59
+ var locals_ = (locals || {}),message = locals_.message,source = locals_.source;buf.push("<div class=\"error\"><div class=\"message\">" + (jade.escape(null == (jade.interp = message) ? "" : jade.interp)) + "</div><pre class=\"source\">" + (jade.escape(null == (jade.interp = source) ? "" : jade.interp)) + "</pre></div>");;return buf.join("");
60
+ }
61
+
62
+ spectacular.templates['list'] = function anonymous(locals) {
63
+ var buf = [];
64
+ buf.push("<div id=\"examples\"><header class=\"header\"><button class=\"btn-open-left\"><i class=\"icon-reorder\"></i></button><span class=\"all\"><span class=\"value\">0</span>/<span class=\"total\">0</span></span><button class=\"btn-open-right\"><i class=\"icon-plus\"></i></button><button class=\"btn-collapse\"><i class=\"icon-ellipsis-horizontal\"></i></button></header><div></div></div>");;return buf.join("");
65
+ }
66
+
67
+ spectacular.templates['progress'] = function anonymous(locals) {
68
+ var buf = [];
69
+ var locals_ = (locals || {}),seed = locals_.seed,chars = locals_.chars;buf.push("<div id=\"progress\"><section><span class=\"seed\"><i class=\"icon-random\"></i><span class=\"value\">" + (jade.escape(null == (jade.interp = seed) ? "" : jade.interp)) + "</span></span><span class=\"time\"><i class=\"icon-time\"></i><span class=\"value\">0s</span></span></section><span class=\"all\"><span class=\"value\">0</span>/<span class=\"total\">0</span></span><ul>");
70
+ // iterate chars
71
+ ;(function(){
72
+ var $$obj = chars;
73
+ if ('number' == typeof $$obj.length) {
74
+
75
+ for (var state = 0, $$l = $$obj.length; state < $$l; state++) {
76
+ var chr = $$obj[state];
77
+
78
+ buf.push("<li" + (jade.attrs({ 'data-state':(state), "class": [(state)] }, {"class":true,"data-state":true})) + "><span class=\"value\">0</span><span class=\"symbol\">" + (jade.escape(null == (jade.interp = ' ' + state) ? "" : jade.interp)) + "</span></li>");
79
+ }
80
+
81
+ } else {
82
+ var $$l = 0;
83
+ for (var state in $$obj) {
84
+ $$l++; var chr = $$obj[state];
85
+
86
+ buf.push("<li" + (jade.attrs({ 'data-state':(state), "class": [(state)] }, {"class":true,"data-state":true})) + "><span class=\"value\">0</span><span class=\"symbol\">" + (jade.escape(null == (jade.interp = ' ' + state) ? "" : jade.interp)) + "</span></li>");
87
+ }
88
+
89
+ }
90
+ }).call(this);
91
+
92
+ buf.push("</ul></div>");;return buf.join("");
93
+ }
94
+
95
+ spectacular.templates['search'] = function anonymous(locals) {
96
+ var buf = [];
97
+ buf.push("<div id=\"search\"><form action=\"/\" method=\"get\"><input id=\"search-input\" type=\"text\" name=\"filter\"/><button type=\"submit\"><i class=\"icon-search\"></i></button></form><style id=\"search-style\"></style></div>");;return buf.join("");
98
+ }
99
+
100
+ spectacular.templates['viewer'] = function anonymous(locals) {
101
+ var buf = [];
102
+ buf.push("<div id=\"viewer\"><div></div></div>");;return buf.join("");
103
+ }
@@ -0,0 +1 @@
1
+ spectacular.templates["card"]=function anonymous(locals){var buf=[];var locals_=locals||{},example=locals_.example,icons=locals_.icons;var result=example.result;var state=result.state;var hasExpectations=result.expectations.length>0;icons={success:"ok",failure:"remove",errored:"remove",pending:"ellipsis",skipped:"remove"};buf.push("<div"+jade.attrs({"class":["example",state]},{"class":true})+'><div class="details"><section><span class="state"><i'+jade.attrs({"class":["icon-"+icons[state]+""]},{"class":true})+"></i><span>"+jade.escape(null==(jade.interp=state)?"":jade.interp)+'</span></span><span class="time"><i class="icon-time"></i><span>'+(null==(jade.interp=example.duration/1e3+"s")?"":jade.interp)+"</span></span><a"+jade.attrs({href:"/?filter="+example.description+"","class":["refresh"]},{href:true})+'><i class="icon-refresh"></i><span>Rerun it!</span></a></section><header><h3>'+(null==(jade.interp=example.fullDescription)?"":jade.interp)+"</h3></header>");if(hasExpectations){buf.push('<ul class="expectations">');(function(){var $$obj=result.expectations;if("number"==typeof $$obj.length){for(var i=0,$$l=$$obj.length;i<$$l;i++){var expectation=$$obj[i];if(expectation.success){buf.push("<li"+jade.attrs({"data-expectation":i,"class":["expectation","success"]},{"data-expectation":true})+">"+(null==(jade.interp=expectation.description)?"":jade.interp)+"</li>")}else{buf.push("<li"+jade.attrs({"data-expectation":i,"class":["expectation","failure"]},{"data-expectation":true})+">"+(null==(jade.interp=expectation.description)?"":jade.interp)+"</li>")}}}else{var $$l=0;for(var i in $$obj){$$l++;var expectation=$$obj[i];if(expectation.success){buf.push("<li"+jade.attrs({"data-expectation":i,"class":["expectation","success"]},{"data-expectation":true})+">"+(null==(jade.interp=expectation.description)?"":jade.interp)+"</li>")}else{buf.push("<li"+jade.attrs({"data-expectation":i,"class":["expectation","failure"]},{"data-expectation":true})+">"+(null==(jade.interp=expectation.description)?"":jade.interp)+"</li>")}}}}).call(this);buf.push("</ul>")}else if(state!="success"&&state!="pending"){buf.push('<div class="message">'+jade.escape(null==(jade.interp=example.examplePromise.reason.message)?"":jade.interp)+"</div>")}buf.push('</div><div class="expectation-message"></div><div class="stack"></div></div>');return buf.join("")};spectacular.templates["error"]=function anonymous(locals){var buf=[];var locals_=locals||{},message=locals_.message,source=locals_.source;buf.push('<div class="error"><div class="message">'+jade.escape(null==(jade.interp=message)?"":jade.interp)+'</div><pre class="source">'+jade.escape(null==(jade.interp=source)?"":jade.interp)+"</pre></div>");return buf.join("")};spectacular.templates["list"]=function anonymous(locals){var buf=[];buf.push('<div id="examples"><header class="header"><button class="btn-open-left"><i class="icon-reorder"></i></button><span class="all"><span class="value">0</span>/<span class="total">0</span></span><button class="btn-open-right"><i class="icon-plus"></i></button><button class="btn-collapse"><i class="icon-ellipsis-horizontal"></i></button></header><div></div></div>');return buf.join("")};spectacular.templates["progress"]=function anonymous(locals){var buf=[];var locals_=locals||{},seed=locals_.seed,chars=locals_.chars;buf.push('<div id="progress"><section><span class="seed"><i class="icon-random"></i><span class="value">'+jade.escape(null==(jade.interp=seed)?"":jade.interp)+'</span></span><span class="time"><i class="icon-time"></i><span class="value">0s</span></span></section><span class="all"><span class="value">0</span>/<span class="total">0</span></span><ul>');(function(){var $$obj=chars;if("number"==typeof $$obj.length){for(var state=0,$$l=$$obj.length;state<$$l;state++){var chr=$$obj[state];buf.push("<li"+jade.attrs({"data-state":state,"class":[state]},{"class":true,"data-state":true})+'><span class="value">0</span><span class="symbol">'+jade.escape(null==(jade.interp=" "+state)?"":jade.interp)+"</span></li>")}}else{var $$l=0;for(var state in $$obj){$$l++;var chr=$$obj[state];buf.push("<li"+jade.attrs({"data-state":state,"class":[state]},{"class":true,"data-state":true})+'><span class="value">0</span><span class="symbol">'+jade.escape(null==(jade.interp=" "+state)?"":jade.interp)+"</span></li>")}}}).call(this);buf.push("</ul></div>");return buf.join("")};spectacular.templates["search"]=function anonymous(locals){var buf=[];buf.push('<div id="search"><form action="/" method="get"><input id="search-input" type="text" name="filter"/><button type="submit"><i class="icon-search"></i></button></form><style id="search-style"></style></div>');return buf.join("")};spectacular.templates["viewer"]=function anonymous(locals){var buf=[];buf.push('<div id="viewer"><div></div></div>');return buf.join("")};