setter: function(v) { _$jscoverage['/swf.js'].functionData[5]++; _$jscoverage['/swf.js'].lineData[276]++; if (visit34_276_1(typeof v == 'string')) { _$jscoverage['/swf.js'].lineData[277]++; v = Dom.get(v, this.get('document')); } _$jscoverage['/swf.js'].lineData[279]++; return v; },
initialize: function(obj, options) { var self = this; this._obj = DOM.get(obj); //缩放对象 this._styleWidth = this._styleHeight = this._styleLeft = this._styleTop = 0; //样式参数 this._sideRight = this._sideDown = this._sideLeft = this._sideUp = 0; //坐标参数 this._fixLeft = this._fixTop = 0; //定位参数 this._scaleLeft = this._scaleTop = 0; //定位坐标 this._mxSet = function() {}; //范围设置程序 this._mxRightWidth = this._mxDownHeight = this._mxUpHeight = this._mxLeftWidth = 0; //范围参数 this._mxScaleWidth = this._mxScaleHeight = 0; //比例范围参数 this._fun = function() {}; //缩放执行程序 //获取边框宽度 this._borderX = parseInt(DOM.css(this._obj, "border-left-width"), 10) + parseInt(DOM.css(this._obj, "border-right-width"), 10); this._borderY = parseInt(DOM.css(this._obj, "border-top-width"), 10) + parseInt(DOM.css(this._obj, "border-bottom-width"), 10); this.setOptions(options); //范围限制 this.Max = !!this.options.Max; this._mxContainer = DOM.get(this.options.mxContainer) || null; this.mxLeft = Math.round(this.options.mxLeft); this.mxRight = Math.round(this.options.mxRight); this.mxTop = Math.round(this.options.mxTop); this.mxBottom = Math.round(this.options.mxBottom); //宽高限制 this.Min = !!this.options.Min; this.minWidth = Math.round(this.options.minWidth); this.minHeight = Math.round(this.options.minHeight); //按比例缩放 this.Scale = !!this.options.Scale; this.Ratio = Math.max(this.options.Ratio, 0); this._obj.style.position = "absolute"; if (this._mxContainer) { DOM.css(this._mxContainer, 'position', 'relative'); } // 给触点注册事件 S.each(this.options.Points, function(point, dir) { (function(point, dir) { Event.on(point, "mousedown", function(e) { e.funName = dir; self.start(e); }); })(point, dir); }); },
it('should do nothing else to event\'s propagation if using "return false;".', function () { var liE = Dom.get('#li-e'), e1 = Dom.get('#link-e1'), e2 = Dom.get('#link-e2'); var result = []; Event.on(e1, 'click', function () { result.push(FIRST); }); Event.on(e1, 'click', function () { result.push(SECOND); }); Event.on(e2, 'click', function () { result.push(FIRST); return false; }); Event.on(e2, 'click', function () { result.push(SECOND); }); Event.on(liE, 'click', function () { result.push(HAPPENED); }); // click e1 runs(function () { result = []; simulate(e1, 'click'); }); waits(0); runs(function () { expect(result.join(SEP)).toEqual([FIRST, SECOND, HAPPENED].join(SEP)); }); // click e2 runs(function () { result = []; simulate(e2, 'click'); }); waits(0); runs(function () { expect(result.join(SEP)).toEqual([FIRST, SECOND].join(SEP)); }); });
it("should stop event's propagation immediately.", function () { var liD = Dom.get('#li-d'), d1 = Dom.get('#link-d1'), d2 = Dom.get('#link-d2'); var result = []; Event.on(d1, 'click', function () { result.push(FIRST); }); Event.on(d1, 'click', function () { result.push(SECOND); }); Event.on(d2, 'click', function (evt) { result.push(FIRST); evt.stopImmediatePropagation(); }); Event.on(d2, 'click', function () { result.push(SECOND); }); Event.on(liD, 'click', function () { result.push(HAPPENED); }); // click d1 runs(function () { result = []; simulate(d1, 'click'); }); waits(0); runs(function () { expect(result.join(SEP)).toEqual([FIRST, SECOND, HAPPENED].join(SEP)); }); // click d2 runs(function () { result = []; simulate(d2, 'click'); }); waits(0); runs(function () { expect(result.join(SEP)).toEqual([FIRST].join(SEP)); }); });
it('should support using custom object as the context.', function () { var bar = Dom.get('#bar'), TEST = { foo: 'only for tesing' }; Event.on(bar, 'click', function () { expect(this).toBe(TEST); }, TEST); });
it('should treat the element itself as the context.', function () { var foo = Dom.get('#foo'); Event.on(foo, 'click', function () { expect(this).toBe(foo); }); // click foo simulate(foo, 'click'); });
it("should append/prepend correctly on nodelist", function () { var body = $(document.body); $("<div id='testDiv7' class='test-div'>ok7</div>" + "<div id='testDiv8' class='test-div'>ok8</div>").appendTo(body); expect(Dom.get("#testDiv7")).not.toBe(null); expect(Dom.get("#testDiv8")).not.toBe(null); var newNode = $("<div class='test-nodelist'>test-nodelist</div>" + "<div class='test-nodelist'>test-nodelist2</div>"); var testDivs = $(".test-div"); testDivs = testDivs.append(newNode); expect(testDivs.length * 2).toBe(Dom.query(".test-nodelist").length); testDivs.append("<div class='test-nodelist2'>test-nodelist3</div>" + "<div class='test-nodelist2'>test-nodelist4</div>"); expect(testDivs.length * 2).toBe(Dom.query(".test-nodelist2").length); $("#testDiv7").append($("#testDiv8")); expect($("#testDiv8").parent().equals($('#testDiv7'))).toBe(true); testDivs.prepend("<div class='test-nodelist3-pre'>test-nodelist5-pre</div>" + "<div class='test-nodelist3-last'>test-nodelist6-last</div>"); expect(testDivs.length).toBe(Dom.query(".test-nodelist3-pre").length); expect(testDivs.length).toBe(Dom.query(".test-nodelist3-last").length); var pres = $(".test-nodelist3-pre"), lasts = $(".test-nodelist3-last"); expect(pres.length).toBe(lasts.length); for (var i = 0; i < pres.length; i++) { expect(pres.item(i).parent().attr("class")).toBe("test-div"); expect(pres.item(i).prev()).toBe(null); expect(lasts.item(i).prev().equals(pres.item(i))).toBe(true); } });
getSrc: function (swf) { swf = Dom.get(swf); var srcElement = getSrcElements(swf)[0], nodeName = srcElement && Dom.nodeName(srcElement); if (nodeName === 'embed') { return Dom.attr(srcElement, 'src'); } else if (nodeName === 'object') { return Dom.attr(srcElement, 'data'); } else if (nodeName === 'param') { return Dom.attr(srcElement, 'value'); } return null; },
SWF = Attribute.extend({constructor:function() { var self = this; self.callSuper.apply(self, arguments); var expressInstall = self.get("expressInstall"), swf, html, id, htmlMode = self.get("htmlMode"), flashVars, params = self.get("params"), attrs = self.get("attrs"), doc = self.get("document"), placeHolder = Dom.create("<span>", undefined, doc), elBefore = self.get("elBefore"), installedSrc = self.get("src"), version = self.get("version"); id = attrs.id = attrs.id || S.guid("ks-swf-"); if(!fpv()) { self.set("status", SWF.Status.NOT_INSTALLED); return } if(version && !fpvGTE(version)) { self.set("status", SWF.Status.TOO_LOW); if(expressInstall) { installedSrc = expressInstall; if(!("width" in attrs) || !/%$/.test(attrs.width) && parseInt(attrs.width, 10) < 310) { attrs.width = "310" } if(!("height" in attrs) || !/%$/.test(attrs.height) && parseInt(attrs.height, 10) < 137) { attrs.height = "137" } flashVars = params.flashVars = params.flashVars || {}; S.mix(flashVars, {MMredirectURL:location.href, MMplayerType:OLD_IE ? "ActiveX" : "PlugIn", MMdoctitle:doc.title.slice(0, 47) + " - Flash Player Installation"}) } } if(htmlMode === "full") { html = _stringSWFFull(installedSrc, attrs, params) }else { html = _stringSWFDefault(installedSrc, attrs, params) } self.set("html", html); if(elBefore) { Dom.insertBefore(placeHolder, elBefore) }else { Dom.append(placeHolder, self.get("render")) } if("outerHTML" in placeHolder) { placeHolder.outerHTML = html }else { placeHolder.parentNode.replaceChild(Dom.create(html), placeHolder) } swf = Dom.get("#" + id, doc); self.set("swfObject", swf); if(htmlMode === "full") { if(OLD_IE) { self.set("swfObject", swf) }else { self.set("swfObject", swf.parentNode) } } self.set("el", swf); if(!self.get("status")) { self.set("status", SWF.Status.SUCCESS) } }, callSWF:function(func, args) {
it('siblings works', function () { var t = Dom.get('#test-prev'); // not include itself expect(Dom.siblings(t).length).to.be(5); expect(Dom.siblings(t, '.test-none').length).to.be(0); expect(Dom.siblings(t, function (elem) { return elem.className === 'test-next-p'; }).length).to.be(1); });
_bindDelChosen: function(cOption){ var self = this; var aClose = D.get("a",cOption); E.on(aClose,"click",function(ev){ ev.preventDefault(); D.remove(cOption); var id = D.attr(this,"data-id"); self._data.delData(id); self._autoMatchInputWidth(); self.fire('change', {data: undefined, value:self.getValue()}); }); },
function AnimBase(config) { var self = this; AnimBase.superclass.constructor.call(self); Promise.Defer(self); self.config = config; var node = config.node; if(!S.isPlainObject(node)) { node = Dom.get(config.node) } self.node = self.el = node; self._backupProps = {}; self._propsData = {} }
$(iframe).on('load', function () { var win = iframe.contentWindow; var inner = Dom.get("#test-inner", win.document); var innerOffsetTop = Dom.offset(inner).top - Dom.scrollTop(win); var iframeTop = Dom.offset(iframe).top; var totalTop = Dom.offset(inner, undefined, window).top; expect(innerOffsetTop + iframeTop).toBe(totalTop); setTimeout(function () { div.remove(); ok = 1; }, 100); });
it('works for nested textarea', function () { var input = Dom.create("<div><textarea></textarea></div>"); Dom.append(input, "#test_cases"); input = Dom.get('textarea', input); input.defaultValue = 'y'; input.value = 'x'; var cloned = Dom.clone(input, true); expect(cloned.defaultValue).toBe('y'); expect(cloned.value).toBe('x'); Dom.append(cloned, "#test_cases"); Dom.remove(input); Dom.remove(cloned); });
it('should prevent default behavior (do nothing if using "return false;").', function () { var cb1 = Dom.get('#checkbox-1'), cb2 = Dom.get('#checkbox-2'); // init cb1.checked = false; cb2.checked = false; Event.on(cb1, 'click', function (evt) { evt.preventDefault(); }); Event.on(cb2, 'click', function () { return false; }); // click the checkbox cb1.click(); cb2.click(); waits(0); runs(function () { expect(cb1.checked).toBeFalsy(); expect(cb2.checked).toBeFalsy(); }); });
function AnimBase(node, to, duration, easing, complete) { var self = this; var config; if(node.node) { config = node }else { if(typeof to === "string") { to = S.unparam(String(to), ";", ":"); S.each(to, function(value, prop) { var trimProp = S.trim(prop); if(trimProp) { to[trimProp] = S.trim(value) } if(!trimProp || trimProp !== prop) { delete to[prop] } }) } if(S.isPlainObject(duration)) { config = S.clone(duration) }else { config = {complete:complete}; if(duration) { config.duration = duration } if(easing) { config.easing = easing } } config.node = node; config.to = to } config = S.merge(defaultConfig, config); AnimBase.superclass.constructor.call(self); Promise.Defer(self); self.config = config; node = config.node; if(!S.isPlainObject(node)) { node = Dom.get(config.node) } self.node = self.el = node; self._backupProps = {}; self._propsData = {}; var newTo = {}; to = config.to; for(var prop in to) { newTo[camelCase(prop)] = to[prop] } config.to = newTo }
it('does not mess event with cloned src element', function () { var div = Dom.create("<div><span id='t1'><" + "/span><" + "/div>"); var span = Dom.get("span", div); Dom.append(div, 'body'); var d = { t1: 1, t2: 1 }; Event.on(span, 'click', function () { d[this.id]++; }); var span2 = Dom.clone(span, { withDataAndEvent: true, deep: true, deepWithDataAndEvent: true }); Event.on(span2, 'click', function () { }); span2.id = 't2'; Dom.append(span2, 'body'); jasmine.simulate(span2, 'click'); waits(100); runs(function () { expect(d.t1).toBe(1); expect(d.t2).toBe(2); }); runs(function () { jasmine.simulate(span, 'click'); }); waits(100); runs(function () { expect(d.t1).toBe(2); expect(d.t2).toBe(2); }); });
/** * Normalize operation about stylesheet * @class KISSY.StyleSheet * @param el {HTMLElement} style/link element */ function StyleSheet(el) { /** * style/link element or selector * @cfg {HTMLElement|String} el */ /** * style/link element * @type {HTMLElement} * @property el */ if (el.el) { el = el.el; } el = this.el = Dom.get(el); // http://msdn.microsoft.com/en-us/library/ie/ms535871(v=vs.85).aspx // firefox 跨域时抛出异常 var sheet = el.sheet || el.styleSheet; this.sheet = sheet; var cssRules = {}; this.cssRules = cssRules; var rulesName = sheet && ('cssRules' in sheet) ? 'cssRules' : 'rules'; this.rulesName = rulesName; var domCssRules = sheet[rulesName]; var i, rule, selectorText, styleDeclaration; for (i = domCssRules.length - 1; i >= 0; i--) { rule = domCssRules[i]; selectorText = rule.selectorText; // 去重 if ((styleDeclaration = cssRules[selectorText])) { styleDeclaration.style.cssText += ';' + styleDeclaration.style.cssText; deleteRule(sheet, i); } else { cssRules[selectorText] = rule; } } }
IO.on("start", function(e) { var io = e.io, form, d, dataType, formParam, data, c = io.config, tmpForm = c.form; if(tmpForm) { form = Dom.get(tmpForm); data = c.data; var isUpload = false; var files = {}; var inputs = Dom.query("input", form); for(var i = 0, l = inputs.length;i < l;i++) { var input = inputs[i]; if(input.type.toLowerCase() === "file") { isUpload = true; if(!FormData) { break } var selected = slice.call(input.files, 0); files[Dom.attr(input, "name")] = selected.length > 1 ? selected : selected[0] || null } } if(isUpload && FormData) { c.files = c.files || {}; S.mix(c.files, files); delete c.contentType } if(!isUpload || FormData) { formParam = FormSerializer.getFormData(form); if(c.hasContent) { formParam = S.param(formParam, undefined, undefined, c.serializeArray); if(data) { c.data += "&" + formParam }else { c.data = formParam } }else { c.uri.query.add(formParam) } }else { dataType = c.dataType; d = dataType[0]; if(d === "*") { d = "text" } dataType.length = 2; dataType[0] = "iframe"; dataType[1] = d } } });
}}, document:{value:doc}, status:{}, el:{}, swfObject:{}, html:{}, htmlMode:{value:"default"}}, getSrc:function(swf) { swf = Dom.get(swf); var srcElement = getSrcElements(swf)[0], nodeName = srcElement && Dom.nodeName(srcElement); if(nodeName === "embed") { return Dom.attr(srcElement, "src") }else { if(nodeName === "object") { return Dom.attr(srcElement, "data") }else { if(nodeName === "param") { return Dom.attr(srcElement, "value") } } } return null }, Status:{TOO_LOW:"flash version is too low", NOT_INSTALLED:"flash is not installed", SUCCESS:"success"}, HtmlMode:{DEFAULT:"default", FULL:"full"}, fpv:fpv, fpvGEQ:fpvGEQ, fpvGTE:fpvGTE});
it('prev works', function () { var t = Dom.get('#test-prev'); expect(Dom.prev(t).className).to.be('test-next'); expect(Dom.prev(t, 0)).to.be(t); expect(Dom.prev(t, 1).className).to.be('test-next'); expect(Dom.prev(t, 2).className).to.be('test-next-p'); expect(Dom.prev(t, '.test-none')).to.be(null); expect(Dom.prev(t, function (elem) { return elem.className === 'test-next-p'; }).tagName.toLowerCase()).to.be('p'); });
describe("script", function () { var o1, o2, scriptTestHolder2, o22; div.innerHTML = '<div id="scriptTestHolder">' + '<script>' + 'if (!window.scriptTest1) {' + 'window.scriptTest1 = 1;' + '} else {' + 'window.scriptTest1++;' + '}' + '</script>' + '<script src="../others/scripts-exec/clone-ie-tc.js"></script>' + '</div>'; o1 = window.scriptTest1 = 1; o2 = window.scriptTest2 = 1; var scriptTestHolder = Dom.get("#scriptTestHolder"); it("behave right", function () { expect(o1).to.be(1); expect(o2).to.be(1); scriptTestHolder2 = Dom.clone(scriptTestHolder, true); // inline should not run when clone o1 = window.scriptTest1; expect(o1).to.be(1); // external should not run when clone o22 = o2 = window.scriptTest2; // ie9 bug if (UA.ieMode !== 9) { expect(o2).to.be(1); } // div.prepend(scriptTestHolder2); Dom.prepend(scriptTestHolder2, div); // "inline should not run when insert" o1 = window.scriptTest1; expect(o1).to.be(1); // external should not run when insert o2 = window.scriptTest2; expect(o2).to.be(o22); Dom.remove(div); }); });
/** * superclass for transition anim and js anim * @class KISSY.Anim.Base * @extend KISSY.Promise * @private */ function AnimBase(config) { var self = this; AnimBase.superclass.constructor.call(self); Promise.Defer(self); /** * config object of current anim instance * @type {Object} */ self.config = config; var node = config.node; if (!S.isPlainObject(node)) { node = Dom.get(config.node); } self.node = self.el = node; self._backupProps = {}; self._propsData = {}; }
Hash( function( actionID, arg1, arg2, arg3 ) { if( actionID == 'refresh' ) { location.hash = arg1; return; } var action = findAction( actionID, arg1, arg2, arg3 ); if( !action ) return; Data.set( "arg0", actionID ); Data.set( "arg1", arg1 ); Data.set( "arg2", arg2 ); Data.set( "arg3", arg3 ); console.log( "----------------------------------------" ); console.info("[app] actionID=...", actionID, Data.get( "arg0" )); Data.log(); if( typeof action === 'undefined' ) { console.error( 'Unknown action: "' + actionID + '"' ); console.error( Object.keys( Actions ) ); location.hash = "#main"; return; } var type = action[0].trim().toLowerCase(); var children = action[1]; document.body.className = type; try { switch( type ) { case 'story': actionDemo( children ); break; case 'demo': actionDemo( children ); break; case 'app': actionApp( children ); break; case 'msg': actionMsg( children ); break; } } catch( ex ) { console.error( "Error in " + type.toUpperCase() + ":", children ); console.error( "Action:", action ); alert( "There is an error!" ); } $.get( '#HEADER' ).innerHTML = Data.parse( "Open Hackathon 2016 - Team 3 - <b>{{$today|datetime}}</b>" ); Data.log(); Data.save(); });
it('works for iframe', function (done) { $('#scroll-iframe-holder')[0].innerHTML = iframeTpl; var iframe = Dom.get('#test-iframe'); var ok = 0; $(iframe).on('load', function () { var inner = Dom.get('#test-inner', iframe.contentWindow.document); Dom.scrollIntoView(inner, iframe.contentWindow); var nt = Math.round(Dom.offset(inner).top); expect(nt - Dom.scrollTop(iframe.contentWindow)).to.be.within(-5, 5); setTimeout(function () { ok = 1; done(); }, 100); }); });
function StyleSheet(el) { _$jscoverage['/stylesheet.js'].functionData[1]++; _$jscoverage['/stylesheet.js'].lineData[27]++; if (visit1_27_1(el.el)) { _$jscoverage['/stylesheet.js'].lineData[28]++; el = el.el; } _$jscoverage['/stylesheet.js'].lineData[31]++; el = this.el = Dom.get(el); _$jscoverage['/stylesheet.js'].lineData[34]++; var sheet = visit2_34_1(el.sheet || el.styleSheet); _$jscoverage['/stylesheet.js'].lineData[36]++; this.sheet = sheet; _$jscoverage['/stylesheet.js'].lineData[38]++; var cssRules = {}; _$jscoverage['/stylesheet.js'].lineData[40]++; this.cssRules = cssRules; _$jscoverage['/stylesheet.js'].lineData[42]++; var rulesName = visit3_42_1(sheet && ('cssRules' in sheet)) ? 'cssRules' : 'rules'; _$jscoverage['/stylesheet.js'].lineData[44]++; this.rulesName = rulesName; _$jscoverage['/stylesheet.js'].lineData[46]++; var domCssRules = sheet[rulesName]; _$jscoverage['/stylesheet.js'].lineData[48]++; var i, rule, selectorText, styleDeclaration; _$jscoverage['/stylesheet.js'].lineData[50]++; for (i = domCssRules.length - 1; visit4_50_1(i >= 0); i--) { _$jscoverage['/stylesheet.js'].lineData[51]++; rule = domCssRules[i]; _$jscoverage['/stylesheet.js'].lineData[52]++; selectorText = rule.selectorText; _$jscoverage['/stylesheet.js'].lineData[54]++; if ((styleDeclaration = cssRules[selectorText])) { _$jscoverage['/stylesheet.js'].lineData[55]++; styleDeclaration.style.cssText += ';' + styleDeclaration.style.cssText; _$jscoverage['/stylesheet.js'].lineData[56]++; deleteRule(sheet, i); } else { _$jscoverage['/stylesheet.js'].lineData[58]++; cssRules[selectorText] = rule; } } }
function StyleSheet(el) { _$jscoverage['/stylesheet.js'].functionData[1]++; _$jscoverage['/stylesheet.js'].lineData[28]++; if (visit1_28_1(el.el)) { _$jscoverage['/stylesheet.js'].lineData[29]++; el = el.el; } _$jscoverage['/stylesheet.js'].lineData[32]++; el = this['el'] = Dom.get(el); _$jscoverage['/stylesheet.js'].lineData[35]++; var sheet = visit2_35_1(el.sheet || el.styleSheet); _$jscoverage['/stylesheet.js'].lineData[37]++; this.sheet = sheet; _$jscoverage['/stylesheet.js'].lineData[39]++; var cssRules = {}; _$jscoverage['/stylesheet.js'].lineData[41]++; this.cssRules = cssRules; _$jscoverage['/stylesheet.js'].lineData[43]++; var rulesName = visit3_43_1(sheet && ('cssRules' in sheet)) ? 'cssRules' : 'rules'; _$jscoverage['/stylesheet.js'].lineData[45]++; this.rulesName = rulesName; _$jscoverage['/stylesheet.js'].lineData[47]++; var domCssRules = sheet[rulesName]; _$jscoverage['/stylesheet.js'].lineData[49]++; var i, rule, selectorText, styleDeclaration; _$jscoverage['/stylesheet.js'].lineData[51]++; for (i = domCssRules.length - 1; visit4_51_1(i >= 0); i--) { _$jscoverage['/stylesheet.js'].lineData[52]++; rule = domCssRules[i]; _$jscoverage['/stylesheet.js'].lineData[53]++; selectorText = rule.selectorText; _$jscoverage['/stylesheet.js'].lineData[55]++; if (visit5_55_1(styleDeclaration = cssRules[selectorText])) { _$jscoverage['/stylesheet.js'].lineData[56]++; styleDeclaration.style.cssText += ";" + styleDeclaration.style.cssText; _$jscoverage['/stylesheet.js'].lineData[57]++; deleteRule(sheet, i); } else { _$jscoverage['/stylesheet.js'].lineData[59]++; cssRules[selectorText] = rule; } } }
it('contains works', function () { expect(Dom.contains(document, '#test-prev')).to.be(true); expect(Dom.contains(document.documentElement, document.body)).to.be(true); expect(Dom.contains(document, document.body)).to.be(true); expect(Dom.contains(document.body, document.documentElement)).to.be(false); // test text node var tn = Dom.get('#test-contains').firstChild; expect(tn.nodeType).to.be(3); expect(Dom.contains('#test-contains', tn)).to.be(true); expect(Dom.contains(document.body, document.body)).to.be(false); expect(Dom.contains(document, document)).to.be(false); expect(Dom.contains(document.body, document)).to.be(false); });
it('should remove all the event handlers of the specified event type.', function () { var g = Dom.get('#link-g'); var result = []; Event.on(g, 'click', function () { result.push(FIRST); }); Event.on(g, 'click', function () { result.push(SECOND); }); Event.remove(g, 'click'); // click g result = []; simulate(g, 'click'); waits(0); runs(function () { expect(result.join(SEP)).toEqual([].join(SEP)); }); });
it('should execute in order.', function () { var a = Dom.get('#link-a'); var result = []; Event.on(a, 'click', function () { result.push(FIRST); }); Event.on(a, 'click', function () { result.push(SECOND); }); // click a result = []; simulate(a, 'click'); waits(0); runs(function () { expect(result.join(SEP)).toEqual([FIRST, SECOND].join(SEP)); Event.remove(a); }); });