Commit efe29694 by Ivan Ivic Committed by GitHub

Merge pull request #1054 from edx/iivic/SOL-2170

[SOL-2170] Unable to change single to multi courses once course id entered
parents 92607fe2 4054917e
......@@ -322,6 +322,18 @@ define([
expect(view.model.get('catalog_query')).toEqual(view._initAttributes.catalog_query);
expect(view.model.get('course_seat_types')).toEqual(view._initAttributes.course_seat_types);
});
it('should unset all single course attributes when multiple courses selected', function () {
view.model.set({
'course_id': 'course id',
'seat_type': 'seat type',
'stock_record_ids': [1]
});
view.$('#multiple-courses').prop('checked', true).trigger('change');
expect(view.model.get('course_id')).toEqual(undefined);
expect(view.model.get('seat_type')).toEqual(undefined);
expect(view.model.get('stock_record_ids')).toEqual(undefined);
});
});
});
}
......
......@@ -429,8 +429,10 @@ define([
this.formGroup('[name=course_seat_types]').removeClass(this.hiddenClass);
this.formGroup('[name=course_id]').addClass(this.hiddenClass);
this.formGroup('[name=seat_type]').addClass(this.hiddenClass);
this.$('[name=seat_type] option').remove();
this.model.unset('course_id');
this.model.unset('seat_type');
this.model.unset('stock_record_ids');
if (!this.model.get('course_seat_types')) {
this.model.set('course_seat_types', []);
......
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