Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fec/fec/static/js/modules/audit-category-sub-category.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { buildUrl } from './helpers.js';

export function auditCategorySubcategory() {
$('#primary_category_id').change(function() { // TODO: jQuery deprecation
$('#primary_category_id').on('change', function() {
var $select = $('#sub_category_id');
$.getJSON(
buildUrl(['audit-category'], {
Expand Down
4 changes: 2 additions & 2 deletions fec/fec/static/js/modules/audit_tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { default as auditCategoryTemplate } from '../templates/audit_tags.hbs';
export default function auditTags() {
$('.data-container__tags').prepend(auditCategoryTemplate);
$('.tag__category.sub').css('visibility', 'hidden');
$('#primary_category_id').change(function() { // TODO: jQuery deprecation
$('#primary_category_id').on('change', function() {
const current_category = $('#primary_category_id option:selected').text();
$('.tag__category.sub').css('visibility', 'hidden');
$('.tag__item.primary').contents()[0].nodeValue = `Findings and issue category: ${current_category}`;
Expand All @@ -15,7 +15,7 @@ export default function auditTags() {
: $('.tag__item.primary button').show();
});

$('#sub_category_id').change(function() { // TODO: jQuery deprecation
$('#sub_category_id').on('change', function() {
const current_sub = $('#sub_category_id option:selected').text();
$('.tag__item.sub').contents()[0].nodeValue = `Sub Category: ${current_sub}`;
});
Expand Down
2 changes: 1 addition & 1 deletion fec/fec/static/js/modules/dropdowns.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ Dropdown.prototype.handleCheckKeyup = function(e) {
if (e.keyCode === KEYCODE_ENTER) {
$(e.target)
.prop('checked', true)
.change(); // TODO: jQuery deprecation
.trigger('change');
}
};

Expand Down
2 changes: 1 addition & 1 deletion fec/fec/static/js/modules/election-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ ElectionSearch.prototype.getUpcomingElections = function() {
* Handle a change event on the zip code fields
*/
ElectionSearch.prototype.handleZipChange = function() {
this.$state.val('').change(); // TODO: jQuery deprecation
this.$state.val('').trigger('change');
this.$district.val('');
};

Expand Down
10 changes: 5 additions & 5 deletions fec/fec/static/js/modules/filters/date-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ DateFilter.prototype.fromQuery = function(query) {

DateFilter.prototype.setValue = function(value) {
value = ensureArray(value);
this.$minDate.val(value[0]).change(); // TODO: jQuery deprecation
this.$maxDate.val(value[1]).change(); // TODO: jQuery deprecation
this.$minDate.val(value[0]).trigger('change');
this.$maxDate.val(value[1]).trigger('change');
};

DateFilter.prototype.handleModifyEvent = function(e, opts) {
Expand All @@ -146,12 +146,12 @@ DateFilter.prototype.handleModifyEvent = function(e, opts) {
if (opts.filterName === this.name) {
this.maxYear = parseInt(opts.filterValue);
this.minYear = this.maxYear - 1;
this.$minDate.val('01/01/' + this.minYear.toString()).change(); // TODO: jQuery deprecation
this.$minDate.val('01/01/' + this.minYear.toString()).trigger('change');
if (this.maxYear === today.getFullYear()) {
today = moment(today).format('MM/DD/YYYY');
this.$maxDate.val(today).change(); // TODO: jQuery deprecation
this.$maxDate.val(today).trigger('change');
} else {
this.$maxDate.val('12/31/' + this.maxYear.toString()).change(); // TODO: jQuery deprecation
this.$maxDate.val('12/31/' + this.maxYear.toString()).trigger('change');
}
this.validate();
}
Expand Down
8 changes: 4 additions & 4 deletions fec/fec/static/js/modules/filters/election-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ ElectionFilter.prototype.fromQuery = function(query) {
this.$cycles
.find('input[value="' + cycle + ':' + full + '"]')
.prop('checked', true)
.change(); // TODO: jQuery deprecation
.trigger('change');
}
return this;
};
Expand Down Expand Up @@ -80,7 +80,7 @@ ElectionFilter.prototype.handleElectionChange = function(e) {
.find('input')
.eq(0)
.prop('checked', true)
.change(); // TODO: jQuery deprecation
.trigger('change');
};

ElectionFilter.prototype.handleCycleChange = function(e) {
Expand All @@ -89,9 +89,9 @@ ElectionFilter.prototype.handleCycleChange = function(e) {
.split(':');
this.$cycle
.val(selected[0])
.change() // TODO: jQuery deprecation
.trigger('change')
.attr('checked', true);
this.$full.val(selected[1]).change(); // TODO: jQuery deprecation
this.$full.val(selected[1]).trigger('change');
this.setTag();
};

Expand Down
2 changes: 1 addition & 1 deletion fec/fec/static/js/modules/filters/filter-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Filter.prototype.setValue = function(value) {
const $input = this.$input.data('temp')
? this.$elm.find('#' + this.$input.data('temp'))
: this.$input;
$input.val(prepareValue($input, value)).change(); // TODO: jQuery deprecation
$input.val(prepareValue($input, value)).trigger('change');
return this;
};

Expand Down
2 changes: 1 addition & 1 deletion fec/fec/static/js/modules/filters/filter-typeahead.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ FilterTypeahead.prototype.appendCheckbox = function(opts) {
} else {
const checkbox = $(template_checkbox(data));
checkbox.appendTo(this.$selected);
checkbox.find('input').change(); // TODO: jQuery deprecation
checkbox.find('input').trigger('change');
this.clearInput();
}
};
Expand Down
2 changes: 1 addition & 1 deletion fec/fec/static/js/modules/filters/select-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ SelectFilter.prototype.fromQuery = function(query) {
SelectFilter.prototype.setValue = function(value) {
this.$input.find('option[selected]').prop('selected', false);
this.$input.find('option[value="' + value + '"]').prop('selected', true);
this.$input.change(); // TODO: jQuery deprecation
this.$input.trigger('change');
};

SelectFilter.prototype.handleChange = function(e) {
Expand Down
2 changes: 1 addition & 1 deletion fec/fec/static/js/modules/filters/text-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ TextFilter.prototype.appendCheckbox = function(value) {
};
const checkbox = $(template_checkbox(opts));
checkbox.appendTo(this.checkboxList.$elm);
checkbox.find('input').change();
checkbox.find('input').trigger('change');
this.$input.val('');
this.checkboxIndex++;
};
Expand Down
2 changes: 1 addition & 1 deletion fec/fec/static/js/modules/filters/toggle-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ToggleFilter.prototype.fromQuery = function(query) {
this.$elm
.find('input[value="' + query[this.name] + '"]')
.prop('checked', true)
.change(); // TODO: jQuery deprecation
.trigger('change');
};

ToggleFilter.prototype.handleChange = function(e) {
Expand Down
4 changes: 2 additions & 2 deletions fec/fec/static/js/modules/filters/validate-date-filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ ValidateDateFilter.prototype.fromQuery = function(query) {
? query['min_' + this.name]
: defaultStart;
var maxDate = query['max_' + this.name] ? query['max_' + this.name] : now;
this.$minDate.val(minDate).change(); // TODO: jQuery deprecation
this.$maxDate.val(maxDate).change(); // TODO: jQuery deprecation
this.$minDate.val(minDate).trigger('change');
this.$maxDate.val(maxDate).trigger('change');
return this;
};

Expand Down
4 changes: 2 additions & 2 deletions fec/fec/static/js/modules/tables.js
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ DataTable_FEC.prototype.checkFromQuery = function() {
// …if they are not already checked
for (let box of queryBoxes) {
if (!($(box).is(':checked'))) {
$(box).prop('checked', true).change(); // TODO: jQuery deprecation
$(box).prop('checked', true).trigger('change');
}
}
$('button.is-loading, label.is-loading').removeClass('is-loading');
Expand All @@ -673,7 +673,7 @@ DataTable_FEC.prototype.checkFromQuery = function() {
// …if they are not already checked
for (let box of queryBoxes) {
if (!($(box).is(':checked'))) {
$(box).prop('checked', true).change(); // TODO: jQuery deprecation
$(box).prop('checked', true).trigger('change');
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion fec/fec/static/js/modules/top-entities.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ TopEntities.prototype.updateElectionYearOptions = function(office) {
if (currentOption.css('display') == 'none') {
$('#election-year')
.val(minFutureYear)
.change(); // TODO: jQuery deprecation
.trigger('change');
}
} else {
// show all options/enable for Safari!
Expand Down
10 changes: 5 additions & 5 deletions fec/fec/tests/js/checkbox-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,19 @@ describe('checkbox filters', function() {
});

it('sets loaded-once on the input after loading', function() {
this.$input.prop('checked', true).change(); // TODO: jQuery deprecation
this.$input.prop('checked', true).trigger('change');
expect(this.$input.data('loaded-once')).to.be.true;
expect(this.$label.attr('class')).to.not.equal('is-loading');
});

it('adds the loading class if it has loaded once', function() {
this.$input.prop('checked', true).change(); // TODO: jQuery deprecation
this.$input.prop('checked', false).change(); // TODO: jQuery deprecation
this.$input.prop('checked', true).trigger('change');
this.$input.prop('checked', false).trigger('change');
expect(this.$label.attr('class')).to.equal('is-loading');
});

it('triggers the add event on checking a checkbox', function() {
this.$input.prop('checked', true).change(); // TODO: jQuery deprecation
this.$input.prop('checked', true).trigger('change');
expect(this.trigger).to.have.been.calledWith('filter:added', [
{
key: 'president',
Expand All @@ -104,7 +104,7 @@ describe('checkbox filters', function() {
});

it('triggers remove event on unchecking a checkbox', function() {
this.$input.prop('checked', false).change(); // TODO: jQuery deprecation
this.$input.prop('checked', false).trigger('change');
expect(this.trigger).to.have.been.calledWith('filter:removed', [
{
key: 'president',
Expand Down
4 changes: 2 additions & 2 deletions fec/fec/tests/js/contact-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ describe('Contact form', function() {
});

it('shows the other reason box when other is selected', function() {
this.form.category.val('other').change(); // TODO: jQuery deprecation
this.form.category.val('other').trigger('change');
expect(this.form.otherReason.is(':visible')).to.be.true;
});

it('hides the other reason box when another value is selected', function() {
this.form.category.val('option-1').change(); // TODO: jQuery deprecation
this.form.category.val('option-1').trigger('change');
expect(this.form.otherReason.is(':visible')).to.be.false;
});

Expand Down
6 changes: 3 additions & 3 deletions fec/fec/tests/js/cycle-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe('cycle select', function() {
});

it('changes the query string on change', function() {
this.cycleSelect.$elm.val('2014').change(); // TODO: jQuery deprecation
this.cycleSelect.$elm.val('2014').trigger('change');
expect(CycleSelect.prototype.setUrl).to.have.been.calledWith(window.location.href + '?cycle=2014');
});
});
Expand Down Expand Up @@ -88,7 +88,7 @@ describe('cycle select', function() {
});

it('changes the query string on change', function() {
this.cycleSelect.$cycles.find('[name="cycle-toggle-cycle-1"]').val('2014').change(); // TODO: jQuery deprecation
this.cycleSelect.$cycles.find('[name="cycle-toggle-cycle-1"]').val('2014').trigger('change');
expect(
CycleSelect.prototype.setUrl
).to.have.been.calledWith(
Expand Down Expand Up @@ -128,7 +128,7 @@ describe('cycle select', function() {
});

it('changes the query string on change', function() {
this.cycleSelect.$elm.val('2014').change(); // TODO: jQuery deprecation
this.cycleSelect.$elm.val('2014').trigger('change');
var url = URI(window.location.href);
url.path('2014/');
expect(CycleSelect.prototype.setUrl).to.have.been.calledWith(url.toString());
Expand Down
6 changes: 3 additions & 3 deletions fec/fec/tests/js/date-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ describe('date filter', function() {
});

it('triggers an add event with all the right properties', function() {
this.filter.$minDate.val('01/01/2015').change(); // TODO: jQuery deprecation
this.filter.$minDate.val('01/01/2015').trigger('change');
expect(this.trigger).to.have.been.calledWith('filter:added', [
{
key: 'min_date',
Expand All @@ -139,14 +139,14 @@ describe('date filter', function() {

it('triggers a remove event if the field has no value', function() {
this.filter.$minDate.val('01/01/2015');
this.filter.$minDate.val('').change(); // TODO: jQuery deprecation
this.filter.$minDate.val('').trigger('change');
expect(this.trigger).to.have.been.calledWith('filter:removed');
});

it('triggers a rename event if the field had a value', function() {
this.filter.$minDate.val('01/01/2015');
this.filter.$minDate.data('had-value', true);
this.filter.$minDate.val('02/01/2015').change(); // TODO: jQuery deprecation
this.filter.$minDate.val('02/01/2015').trigger('change');
expect(this.trigger).to.have.been.calledWith('filter:renamed');
expect(this.filter.$minDate.data('loaded-once')).to.be.true;
});
Expand Down
10 changes: 5 additions & 5 deletions fec/fec/tests/js/election-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,22 +67,22 @@ describe('election search', function() {
});

it('should disable the district select when state is not set', function() {
this.el.$state.val('').change(); // TODO: jQuery deprecation
this.el.$state.val('').trigger('change');
expect(this.el.$district.prop('disabled')).to.be.true;
});

it('should disable the district select when state is set and the state does not have districts', function() {
this.el.$state.val('AS').change(); // TODO: jQuery deprecation
this.el.$state.val('AS').trigger('change');
expect(this.el.$district.prop('disabled')).to.be.true;
});

it('should enable the district select when state is set and the state has districts', function() {
this.el.$state.val('VA').change(); // TODO: jQuery deprecation
this.el.$state.val('VA').trigger('change');
expect(this.el.$district.prop('disabled')).to.be.false;
});

it('should clear the state select and disable the district select when the zip select is set', function() {
this.el.$zip.val('19041').change(); // TODO: jQuery deprecation
this.el.$zip.val('19041').trigger('change');
expect(this.el.$state.val()).to.equal('');
expect(this.el.$district.prop('disabled')).to.be.true;
});
Expand All @@ -93,7 +93,7 @@ describe('election search', function() {
});

it('should serialize state and district inputs', function() {
this.el.$state.val('VA').change(); // TODO: jQuery deprecation
this.el.$state.val('VA').trigger('change');
this.el.$district.val('01');
expect(this.el.serialize()).to.deep.equal({
cycle: '2016',
Expand Down
4 changes: 2 additions & 2 deletions fec/fec/tests/js/statistical-summary-archive.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ describe('Tablefilter', function() {
describe('disableNonPresYears', function() {
beforeEach(function() {
this.disableNonPresYears = spy(Tablefilter.prototype, 'disableNonPresYears');
this.chooseYear.val('1982').change(); // TODO: jQuery deprecation
this.chooseFiler.val('presidential').change(); // TODO: jQuery deprecation
this.chooseYear.val('1982').trigger('change');
this.chooseFiler.val('presidential').trigger('change');
this.filter.showTable();

});
Expand Down
4 changes: 2 additions & 2 deletions fec/fec/tests/js/toggle-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('toggle filters', function() {
});

it('calls handleChange() on change', function() {
this.filter.$elm.find('#efiling').prop('checked', true).change(); // TODO: jQuery deprecation
this.filter.$elm.find('#efiling').prop('checked', true).trigger('change');
expect(this.handleChange).to.have.been.called;
});

Expand Down Expand Up @@ -94,7 +94,7 @@ describe('toggle filters', function() {
});

it('triggers rename event on changing the toggle', function() {
this.$fixture.find('#efiling').prop('checked', true).change(); // TODO: jQuery deprecation
this.$fixture.find('#efiling').prop('checked', true).trigger('change');
expect(this.trigger).to.have.been.calledWith('filter:renamed', [
{
key: 'data_type-toggle',
Expand Down
4 changes: 2 additions & 2 deletions fec/fec/tests/js/typeahead-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ describe('FilterTypeahead', function() {
var enableButton = spy(this.FilterTypeahead, 'enableButton');
var disableButton = spy(this.FilterTypeahead, 'disableButton');

// this.FilterTypeahead.$field.typeahead('val', 'FAKE CANDIDATE').change(); // TODO: jQuery deprecation
// this.FilterTypeahead.$field.typeahead('val', 'FAKE CANDIDATE').trigger('change');
// expect(enableButton).to.have.been.called;

// this.FilterTypeahead.$field.typeahead('val', '').change(); // TODO: jQuery deprecation
// this.FilterTypeahead.$field.typeahead('val', '').trigger('change');
// expect(disableButton).to.have.been.called;

// this.FilterTypeahead.enableButton.restore();
Expand Down
2 changes: 1 addition & 1 deletion fec/legal/templates/legal-search-results-murs.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@
// ...if they are not already checked
for (let box of queryBoxes) {
if (!($(box).is(':checked'))) {
$(box).trigger('click');
$(box).prop('checked', true).trigger('change')
}
}
})();
Expand Down