Skip to content

Commit

Permalink
Upgrade jQuery to 3.5.1.
Browse files Browse the repository at this point in the history
It appears that setting val(undefined) now blanks out a select rather
than just ignoring it, so make sure we do not do that.
  • Loading branch information
dracos committed May 20, 2021
1 parent 167b724 commit f72db98
Show file tree
Hide file tree
Showing 26 changed files with 221 additions and 217 deletions.
20 changes: 10 additions & 10 deletions .cypress/cypress/integration/around_filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('Around page filtering and push state', function() {
cy.server();
cy.route('/reports/Borsetshire\?ajax*').as('update-results');
cy.contains('1 to 15 of 15');
cy.get('.multi-select-button:first').click();
cy.get('.multi-select-button').first().click();
cy.get('#status_0').click();
cy.get('#status_1').click();
cy.wait('@update-results');
Expand Down Expand Up @@ -40,7 +40,7 @@ describe('Around page filtering and push state', function() {
cy.route('/reports/Borsetshire\?ajax*').as('update-results');
cy.visit('/reports/Borsetshire');
cy.contains('1 to 15 of 15');
cy.get('.multi-select-button:eq(1)').click();
cy.get('.multi-select-button').eq(1).click();
cy.get('input[value=Potholes]').click();
cy.wait('@update-results');
cy.url().should('include', 'filter_category=Potholes');
Expand Down Expand Up @@ -69,16 +69,16 @@ describe('Around page filtering and push state', function() {
cy.get('#sort').select('created-desc');
cy.url().should('include', 'sort=created-desc');
cy.wait('@update-results');
cy.get('.item-list__heading:first').contains('Flytipping on country lane');
cy.get('.item-list__heading').first().contains('Flytipping on country lane');
cy.get('#sort').select('created-asc');
cy.wait('@update-results');
cy.get('.item-list__heading:first').contains('Offensive graffiti');
cy.get('.item-list__heading').first().contains('Offensive graffiti');
cy.get('#sort').select('updated-asc');
cy.wait('@update-results');
cy.get('.item-list__heading:first').contains('Faulty light');
cy.get('.item-list__heading').first().contains('Faulty light');
cy.get('#sort').select('updated-desc');
cy.wait('@update-results');
cy.get('.item-list__heading:first').contains('Pothole in cycle lane');
cy.get('.item-list__heading').first().contains('Pothole in cycle lane');
cy.get('#sort').select('comments-desc');
cy.wait('@update-results');
cy.get('.item-list__heading').contains('Offensive graffiti');
Expand All @@ -91,7 +91,7 @@ describe('Around page filtering and push state', function() {
cy.visit('/reports/Borsetshire');
cy.get('image[id*="OpenLayers_Geometry_Point"]').should('have.length', 15);
cy.get('image[title="Pothole in cycle lane"]').invoke('attr', 'xlink:href').should('not.contain', 'small');
cy.get('.item-list--reports__item:first a').click();
cy.get('.item-list--reports__item').first().find('a').click();
cy.wait('@show-report');
cy.contains('Back to all reports');
// mini pins fo not have shadows but small pins do so we get an extra image
Expand All @@ -114,12 +114,12 @@ describe('Around page filtering and push state', function() {
cy.route('/mapit/area/*').as('get-geometry');
cy.visit('/around?lon=-2.295894&lat=51.526877&zoom=0');
// get the second image which is the pin, first is the shadow
cy.get('image[title="Lights out in tunnel"]:last').invoke('attr', 'xlink:href').should('contain', 'small');
cy.get('image[title="Lights out in tunnel"]').last().invoke('attr', 'xlink:href').should('contain', 'small');
// force to hopefully work around apparent Cypress SVG issue
cy.get('image[title="Lights out in tunnel"]:last').click({force: true});
cy.get('image[title="Lights out in tunnel"]').last().click({force: true});
cy.wait('@show-report');
cy.contains('Back to all reports');
cy.get('image[title="Lights out in tunnel"]:last').invoke('attr', 'xlink:href').should('not.contain', 'small');
cy.get('image[title="Lights out in tunnel"]').last().invoke('attr', 'xlink:href').should('not.contain', 'small');
cy.contains('pitch black');
cy.url().should('include', 'report');
cy.go('back');
Expand Down
4 changes: 2 additions & 2 deletions .cypress/cypress/integration/duplicates.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ describe('Duplicate tests', function() {
cy.get('[name=sign_in_by_password]').last().click();
cy.url().should('include', '/my');
cy.visit('http://borsetshire.localhost:3001/reports');
cy.get('[href$="/report/1"]:last').click();
cy.get('[href$="/report/1"]').last().click();
cy.get('#report_inspect_form #state').select('Duplicate');
cy.get('#js-duplicate-reports li h3 a').should('have.attr', 'href', '/report/1');
});
Expand All @@ -80,7 +80,7 @@ describe('Duplicate tests', function() {
});
cy.visit('http://borsetshire.localhost:3001/report/1');
cy.contains('Back to all').click();
cy.get('[href$="/report/1"]:last').click();
cy.get('[href$="/report/1"]').last().click();
cy.get('#report_inspect_form #state').select('Duplicate');
cy.get('#js-duplicate-reports li h3 a').should('have.attr', 'href', '/report/1');
});
Expand Down
2 changes: 1 addition & 1 deletion .cypress/cypress/integration/regressions.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('Regression tests', function() {
cy.route('/report/*').as('show-report');
cy.visit('/around?lon=-2.295894&lat=51.526877&zoom=0');
// force to hopefully work around apparent Cypress SVG issue
cy.get('image[title="Lights out in tunnel"]:last').click({force: true});
cy.get('image[title="Lights out in tunnel"]').last().click({force: true});
cy.wait('@show-report');
// TODO as report-a-problem-btn not printed on around at the mo
cy.get('.big-green-banner').click({ force: true });
Expand Down
14 changes: 7 additions & 7 deletions .cypress/cypress/integration/simple_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ describe('Clicking the map', function() {
describe('Leaving updates', function() {
function leave_update() {
cy.get('[name=update]').type('Update');
cy.get('.js-new-report-user-show:last').click();
cy.get('.js-new-report-show-sign-in:last').should('be.visible').click();
// [id=]:last due to #2341
cy.get('[id=form_username_sign_in]:last').type('user@example.org');
cy.get('[name=password_sign_in]:last').type('password');
cy.get('[name=password_sign_in]:last').parents('form:first').submit();
cy.get('.js-new-report-user-show').last().click();
cy.get('.js-new-report-show-sign-in').last().should('be.visible').click();
// [id=].last() due to #2341
cy.get('[id=form_username_sign_in]').last().type('user@example.org');
cy.get('[name=password_sign_in]').last().type('password');
cy.get('[name=password_sign_in]').last().parents('form').first().submit();
cy.get('#map_sidebar').should('contain', 'check and confirm your details');
cy.get('[name=submit_register]').parents('form').submit();
cy.get('body').should('contain', 'Thank you for updating this issue');
Expand All @@ -70,7 +70,7 @@ describe('Leaving updates', function() {
cy.route('/mapit/area/*').as('get-geometry');
cy.visit('/around?lon=-2.295894&lat=51.526877&zoom=0');
// force to hopefully work around apparent Cypress SVG issue
cy.get('image[title="Lights out in tunnel"]:last').click({force: true});
cy.get('image[title="Lights out in tunnel"]').last().click({force: true});
cy.wait('@show-report');
leave_update();
});
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
- Consistent protected field ordering.
- Security:
- Increase minimum password length to eight.
- Development improvements:
- Drop support for IE8, upgrade jQuery. #3017

* v3.1 (16th November 2020)
- Security:
Expand Down
2 changes: 1 addition & 1 deletion templates/web/base/common_header_tags.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
[% IF bodyclass.match('frontpage') %]
<link rel="prefetch" href="[% version('/js/validation_rules.js') %]">
[%~ IF NOT c.user_exists OR NOT (c.user.from_body OR c.user.is_superuser) %]
<link rel="prefetch" href="[% version('/vendor/jquery-2.2.4.min.js') %]">
<link rel="prefetch" href="[% version('/vendor/jquery-3.5.1.min.js') %]">
[%~ END %]
<link rel="prefetch" href="[% version('/vendor/jquery.multi-select.min.js') %]">
<link rel="prefetch" href="[% version('/vendor/jquery.validate.min.js') %]">
Expand Down
4 changes: 2 additions & 2 deletions templates/web/base/common_scripts.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
ELSE;
scripts.push(
version('/js/validation_rules.js'),
version('/vendor/jquery-2.2.4.min.js'),
version('/vendor/jquery-3.5.1.min.js'),
version('/vendor/jquery.multi-select.min.js'),
version('/vendor/jquery.validate.min.js'),
version('/cobrands/fixmystreet/fixmystreet.js'),
Expand All @@ -37,7 +37,7 @@
IF c.user_exists AND (c.user.from_body OR c.user.is_superuser);
scripts.push(
version('/js/geolocation.js'),
version('/vendor/jquery-2.2.4.min.js'),
version('/vendor/jquery-3.5.1.min.js'),
version('/cobrands/fixmystreet/staff.js')
);
IF bodyclass.match('mappage') AND c.cobrand.suggest_duplicates AND NOT login_success AND NOT oauth_need_email;
Expand Down
2 changes: 1 addition & 1 deletion templates/web/bromley/footer_extra_js.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[% scripts.push(
version('/vendor/jquery-2.2.4.min.js'),
version('/vendor/jquery-3.5.1.min.js'),
version('/cobrands/bromley/a-z-nav.js'),
) %]
[% PROCESS 'footer_extra_js_base.html' cobrand_js=1 validation=1 tfl=1 roadworks=1 %]
2 changes: 1 addition & 1 deletion templates/web/tfl/footer_extra_js.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[% scripts.push(
version('/vendor/jquery-2.2.4.min.js'),
version('/vendor/jquery-3.5.1.min.js'),
) %]
[% PROCESS 'footer_extra_js_base.html' highways=1 cobrand_js=1 %]
[%~
Expand Down
2 changes: 1 addition & 1 deletion templates/web/zurich/footer_extra_js.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[% scripts.push(
version('/vendor/jquery-2.2.4.min.js'),
version('/vendor/jquery-3.5.1.min.js'),
version('/cobrands/zurich/validation_rules.js'),
'//ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js',
version('/cobrands/zurich/js.js'),
Expand Down
4 changes: 2 additions & 2 deletions web/cobrands/bromley/a-z-nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
$('.custom-side-nav > ul > li > ul').hide();

// Stops the toggle links going off to their actual link. Make the links actual links though for non js users.
$('.custom-side-nav > ul > li > a').click(function(e) {
$('.custom-side-nav > ul > li > a').on('click', function(e) {
e.preventDefault();
// When an item is clicked this checks to see if any other items are down and strips the class of active and toggles them up.
if( !$(this).hasClass('active') ) {
Expand All @@ -19,4 +19,4 @@
.slideToggle(300);
});
});
})(window.jQuery);
})(window.jQuery);
18 changes: 9 additions & 9 deletions web/cobrands/fixmystreet/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ $(function(){
}

// Some lists of checkboxes have 'select all/none' links at the top
$("a[data-select-none], a[data-select-all]").click(function(e) {
$("a[data-select-none], a[data-select-all]").on('click', function(e) {
e.preventDefault();
var checked = $(this).filter('[data-select-all]').length > 0;
$(this).closest("ul").find('input[type=checkbox]').prop('checked', checked);
Expand Down Expand Up @@ -66,21 +66,21 @@ $(function(){
});
}

$("#start_date").change(function(){
$("#start_date").on('change', function(){
$('#end_date').attr('min', $(this).val());
});
$("#end_date").change(function(){
$("#end_date").on('change', function(){
$('#start_date').attr('max', $(this).val());
});

// On user edit page, hide the area/categories fields if body changes
$("form#user_edit select#body").change(function() {
$("form#user_edit select#body").on('change', function() {
var show_area = $(this).val() == $(this).find("[data-originally-selected]").val();
$("form#user_edit select#area_ids").closest("li").toggle(show_area);
$("form#user_edit .js-user-categories").toggle(show_area);
});

$('form#user_edit select#roles').change(function() {
$('form#user_edit select#roles').on('change', function() {
var $perms = $('.permissions-checkboxes');
if ($(this).val()) {
var selected_perms = {};
Expand All @@ -103,12 +103,12 @@ $(function(){
});
$perms.find('input').prop('disabled', false);
}
}).change();
}).trigger('change');

// Bits for the report extra fields form builder:

// Reveal the UI when 'show' link is clicked
$(".js-show-extra-fields").click(function(e) {
$(".js-show-extra-fields").on('click', function(e) {
e.preventDefault();
$(this).hide();
$(".js-extra-fields-ui").removeClass("hidden-js");
Expand All @@ -121,7 +121,7 @@ $(function(){
var $new_item = $template_item.clone();
$new_item.removeClass("hidden-js js-group-item-template");
$new_item.insertBefore($template_item);
$new_item.focus();
$new_item.trigger('focus');
return true;
});

Expand Down Expand Up @@ -194,7 +194,7 @@ $(function(){
// On the manifest theme editing page we have tickboxes for deleting individual
// icons - ticking one of these should grey out that row to indicate it will be
// deleted upon form submission.
$("input[name=delete_icon]").change(function() {
$("input[name=delete_icon]").on('change', function() {
$(this).closest("tr").toggleClass("is-deleted", this.checked);
});
});
Expand Down

0 comments on commit f72db98

Please sign in to comment.