/*jsl:declare jasmine*/ /*jsl:declare Sizzle*/ /*jsl:declare Prototype*/ /*jsl:declare jQuery*/ jasmine.DOM = {}; jasmine.DOM.browserTagCaseIndependentHtml = function(html) { var div= document.createElement('div'); div.innerHTML= html; return div.innerHTML; } jasmine.DOM.elementToString = function(element) { var div= document.createElement('div'); div.appendChild(element.cloneNode(true)); return div.innerHTML; } jasmine.DOM.trim= function(string) { var str= string.replace(/^\s+/, ''); for (var i = str.length - 1; i > 0; --i) if (/\S/.test(str.charAt(i))) { str = str.substring(0, i + 1); break; } return str; } jasmine.DOM.slice= function(arrayLike, startIndex) { return [].slice.call(arrayLike, startIndex||0); } jasmine.DOM.uniqueId= 1; jasmine.DOM.assignId= function(element) { return element.id || (element.id=('jasmine_id_' + jasmine.DOM.uniqueId++)); }; /** jasmine.DOM.queryAll(selector[, scope]) -> array */ jasmine.DOM.queryAll= (function(){ if ('undefined'!==typeof(Sizzle)) return Sizzle; if ('undefined'!==typeof(Prototype)) return function(selector, node) { return Element.getElementsBySelector(node||document, selector); }; if ('undefined'!==typeof(jQuery)) return function(selector, node) { var result= jQuery(selector, node); var nodes= []; var len= result.length; for (var i=0; i 0; } }; function comparePropertyValues(actualValue, expectedValue) { if (void(0) === expectedValue) return void(0) !== actualValue; return actualValue == expectedValue; } function bindMatcher(methodName) { var originalMatcher = jasmine.Matchers.prototype[methodName]; jasmine.DOM.matchers[methodName] = function() { // If the actual value is a DOM node... if (this.actual && this.actual.nodeType) { var result = matchers[methodName].apply(this, arguments); this.actual = jasmine.DOM.elementToString(this.actual); return result; } if (originalMatcher) return originalMatcher.apply(this, arguments); return false; } } for (var methodName in matchers) bindMatcher(methodName); })(); beforeEach(function() { this.addMatchers(jasmine.DOM.matchers); }); afterEach(function() { jasmine.getFixtures().cleanUp(); });