Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

started fixing specs for IE8; wip

  • Loading branch information...
commit 54d05101d3d33e0536fd240fce28be920608c64a 1 parent bc4c709
@endor endor authored
View
4 test2/application_spec.js
@@ -546,11 +546,11 @@ describe('Application', function() {
it('sets additional params from a query string after the hash', function(done) {
app.get('#/boosh/:test/:test2', function() {
- expect(this.params.with).to.eql('some');
+ expect(this.params.including).to.eql('some');
expect(this.params.nifty).to.eql('params');
done();
});
- app.runRoute('get', '#/boosh/farg/wow?with=some&nifty=params');
+ app.runRoute('get', '#/boosh/farg/wow?including=some&nifty=params');
});
it('sets value-less params to an empty string', function(done) {
View
6 test2/event_context_spec.js
@@ -160,7 +160,7 @@ describe('EventContext', function() {
},
onChange: function() {
expect(contents).to.eql('<div class="test_template"><span>TEMPLATE!</span></div>');
- expect(app.$element().html()).to.eql('<div class="test_template"><span>TEMPLATE!</span></div>');
+ expect(app.$element()).to.have.sameHTMLAs('<div id="main"><div class="test_template"><span>TEMPLATE!</span></div></div>');
app.unload();
done();
}
@@ -175,7 +175,7 @@ describe('EventContext', function() {
context.partial('fixtures/partial.mustache', {name: 'TEMPLATE!', class_name: 'test_template'}, {item: 'fixtures/item.mustache'});
},
onChange: function() {
- expect(app.$element().html()).to.eql('<div class="test_template"><span>TEMPLATE!</span></div>');
+ expect(app.$element()).to.have.sameHTMLAs('<div id="main"><div class="test_template"><span>TEMPLATE!</span></div></div>');
app.unload();
done();
}
@@ -195,7 +195,7 @@ describe('EventContext', function() {
},
onChange: function() {
expect(contents).to.eql('<div class="blah"><span>my name</span></div>');
- expect(app.$element().html()).to.eql('<div class="blah"><span>my name</span></div>');
+ expect(app.$element()).to.have.sameHTMLAs('<div id="main"><div class="blah"><span>my name</span></div></div>');
app.unload();
done();
}
View
41 vendor/mocha/helpers.js
@@ -6,8 +6,8 @@
function bind(fn, scope) {
return function() {
return fn.apply(scope, arguments);
- }
-};
+ };
+}
/**
* Disables the Sammy trigger mechanism by
@@ -20,11 +20,11 @@ function bind(fn, scope) {
*/
function disableTrigger(app, callback, done) {
var origElement = app.$element;
- app.$element = function() { return $('.doesNotExist'); }
+ app.$element = function() { return $('.doesNotExist'); };
callback();
app.$element = origElement;
done();
-};
+}
/**
* Sets up an environment where it is possible
@@ -36,7 +36,7 @@ function listenToChanged(app, callbacks) {
app.run('#/');
app.bind('changed', callbacks.onChange);
callbacks.setup();
-};
+}
/**
* Runs the callback the second time the
@@ -52,7 +52,7 @@ function evaluateSecondCall(callback) {
i += 1;
};
-};
+}
/**
* Test if a jquery element has the same HTML
@@ -68,4 +68,31 @@ expect.Assertion.prototype.sameHTMLAs = function(obj) {
, 'expected ' + strippedHTML(this.obj) + ' to have the same html as ' + strippedHTML(obj)
, 'expected ' + strippedHTML(this.obj) + ' to not have the same html as ' + strippedHTML(obj));
return this;
-};
+};
+
+
+/**
+ * IE8 fixes
+ */
+if (!Array.prototype.indexOf) {
+ Array.prototype.indexOf = function(elt /*, from*/) {
+ var len = this.length >>> 0;
+
+ var from = Number(arguments[1]) || 0;
+ from = (from < 0)
+ ? Math.ceil(from)
+ : Math.floor(from);
+ if (from < 0) {
+ from += len;
+ }
+
+ for (; from < len; from++) {
+ if (from in this &&
+ this[from] === elt) {
+ return from;
+ }
+ }
+
+ return -1;
+ };
+}
Please sign in to comment.
Something went wrong with that request. Please try again.