476e2d53 by Adam Heath

First bug found with jasmine, Ordering.items was a globally shared

instance.
1 parent 2225231f
......@@ -3,9 +3,11 @@ define(function(require) {
var Backbone = require('backbone');
var Ordering = Backbone.Model.extend({
defaults: {
defaults: function defaults() {
return {
value: null,
items: new Backbone.Collection(),
};
},
initialize: function(data, options) {
if (this.get('value') === null) {
......
define(function(require) {
'use strict';
var Backbone = require('backbone');
var Ordering = require('solr/model/Ordering');
describe('Ordering', function() {
it('loads', function() {
expect(Ordering).toBeDefined();
});
it('items are different instances', function() {
var o1 = new Ordering(), o2 = new Ordering();
expect(o1.get('items')).not.toBe(o2.get('items'));
});
});
});