Commit d5ff74a1 by iivic Committed by Ivan Ivic

[SOL-2194] Bug fix TypeError: seatData is undefined

parent 364b96f6
...@@ -80,6 +80,21 @@ define([ ...@@ -80,6 +80,21 @@ define([
expect(view.updateTotalValue).toHaveBeenCalled(); expect(view.updateTotalValue).toHaveBeenCalled();
expect(view.getSeatData).toHaveBeenCalled(); expect(view.getSeatData).toHaveBeenCalled();
}); });
it('should call updateTotalValue when catalog_type "Single course"', function () {
spyOn(view, 'updateTotalValue');
view.changeTotalValue();
expect(view.updateTotalValue).toHaveBeenCalled();
expect(view.model.get('catalog_type')).toBe('Single course');
});
it('should not call updateTotalValue when catalog_type not "Single course"', function () {
spyOn(view, 'updateTotalValue');
view.model.set('catalog_type', 'Not single course');
view.changeTotalValue();
expect(view.updateTotalValue).not.toHaveBeenCalled();
expect(view.model.get('catalog_type')).not.toBe('Single course');
});
}); });
describe('enrollment code', function () { describe('enrollment code', function () {
......
...@@ -572,7 +572,9 @@ define([ ...@@ -572,7 +572,9 @@ define([
}, },
changeTotalValue: function () { changeTotalValue: function () {
this.updateTotalValue(this.getSeatData()); if (this.model.get('catalog_type') === 'Single course' && this.getSeatType() !== null) {
this.updateTotalValue(this.getSeatData());
}
}, },
updateTotalValue: function (seatData) { updateTotalValue: function (seatData) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment