Skip to content

Commit

Permalink
Update jquery
Browse files Browse the repository at this point in the history
  • Loading branch information
GilbertCherrie committed Jan 29, 2025
1 parent 3d293ed commit cb16651
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 25 deletions.
3 changes: 1 addition & 2 deletions app/javascript/oldjs/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ window.ImportSetup = {
listenForGitPostMessages: function() {
window.addEventListener('message', function(event) {
var messageData = event.data.message;

if (messageData.level === 'error') {
if (messageData && messageData.level === 'error') {
showErrorMessage(messageData.message);
$('#git-url-import').prop('disabled', null);
} else if (event.data.git_branches || event.data.git_tags) {
Expand Down
3 changes: 3 additions & 0 deletions app/javascript/spec/ops-tenant-form/ops-tenant-form.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ describe('OpstTenantForm', () => {
});

it('should mount and set initialValues', async(done) => {
fetchMock.getOnce('/api/tenants?filter[]=name=&expand=resources', {
resources: [],
});
fetchMock.getOnce('/api/tenants/123?expand=resources&attributes=name,description,use_config_for_attributes,ancestry,divisible', {
name: 'foo',
});
Expand Down
6 changes: 5 additions & 1 deletion config/jest.setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ ManageIQ.redux.store.injectReducers();

Object.defineProperty(Array.prototype, 'flat', {
value: function(depth = 1) {
return this.reduce(function (flat, toFlatten) {
let array = this;
if (typeof this === 'object') {
array = Object.keys(this).map((key) => this[key])
}
return array.reduce(function (flat, toFlatten) {
return flat.concat((Array.isArray(toFlatten) && (depth>1)) ? toFlatten.flat(depth-1) : toFlatten);
}, []);
}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"eonasdan-bootstrap-datetimepicker": "~4.17.49",
"es6-shim": "~0.35.3",
"history": "^4.7.2",
"jquery": "~2.2.4",
"jquery": "~3.7.1",
"jquery-ui": "~1.13.2",
"jquery-ujs": "~1.2.2",
"jquery.hotkeys": "~0.1.0",
Expand Down Expand Up @@ -186,6 +186,7 @@
"bootstrap-select": "~1.13.18",
"decode-uri-component": "^0.2.2",
"express": "^4.18.2",
"jquery": "~3.7.1",
"lodash": "~4.17.21",
"minimatch": "~3.1.2",
"moment": "^2.29.2",
Expand Down
4 changes: 2 additions & 2 deletions spec/javascripts/automate_import_export_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ describe('Automate', function() {
it('refreshes the selectpicker for git-branches and git-tags', function() {
Automate.renderGitImport(['branches'], ['tags'], '123', {message: 'the message', level: 'warning'});
expect($.fn.selectpicker.calls.allArgs()).toEqual([['refresh'], ['refresh']]);
expect($.fn.selectpicker.calls.first().object.selector).toEqual('select.git-branches');
expect($.fn.selectpicker.calls.mostRecent().object.selector).toEqual('select.git-tags');
expect($.fn.selectpicker.calls.first().object[0].className).toEqual('git-branches');
expect($.fn.selectpicker.calls.mostRecent().object[0].className).toEqual('git-tags');
});
});

Expand Down
1 change: 0 additions & 1 deletion spec/javascripts/import_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ describe('import.js', function() {

it('disables the git-url-import', function() {
expect($.fn.prop).toHaveBeenCalledWith('disabled', null);
expect($.fn.prop.calls.mostRecent().object.selector).toEqual('#git-url-import');
});

it('turns the spinner off', function() {
Expand Down
2 changes: 1 addition & 1 deletion spec/javascripts/miq_application_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('miq_application.js', function() {
});

it('verify serialize method doesnt convert line feed value to windows line feed', function() {
expect(miqSerializeForm('form_div')).toEqual("method_data=new+line+added%0A%0A");
expect(miqSerializeForm('form_div')).toEqual('method_data=new%20line%20added%0A%0A');
});
});

Expand Down
1 change: 0 additions & 1 deletion spec/javascripts/services/miq_service_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ describe('miqService', function() {

it('refreshes all selects', function() {
testService.refreshSelectpicker();
expect($.fn.selectpicker.calls.mostRecent().object.selector).toEqual('select');
expect($.fn.selectpicker.calls.mostRecent().args[0]).toEqual('refresh');
});
});
Expand Down
18 changes: 2 additions & 16 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10709,27 +10709,13 @@ __metadata:
languageName: node
linkType: hard

"jquery@npm:1.8 - 4, jquery@npm:>=1.7, jquery@npm:>=1.7.0, jquery@npm:>=1.8.0 <4.0.0, jquery@npm:>=1.9.0, jquery@npm:>=3.4.0 <4.0.0, jquery@npm:^3.4.1, jquery@npm:^3.5.1":
"jquery@npm:~3.7.1":
version: 3.7.1
resolution: "jquery@npm:3.7.1"
checksum: 10/17be9929f5fa37697d9848284f0d108c543318ef79ec794e130cd0c49f6c050d60c803a69e8cfa16fa19f5ff7cdb814a6905cceab0831186560c65ed113cd579
languageName: node
linkType: hard

"jquery@npm:^2.2.4, jquery@npm:~2.2.4":
version: 2.2.4
resolution: "jquery@npm:2.2.4"
checksum: 10/fe1bb90423eda61255b969fed0420dfb09dc055793b83ad380a2fbe5b5ce3bc747029d010e580bf39c95bdd07fb309ef8c0fc22a700ca97015311626881db152
languageName: node
linkType: hard

"jquery@npm:~3.4.1":
version: 3.4.1
resolution: "jquery@npm:3.4.1"
checksum: 10/c40dcf94f6d1427b8d28b8f6b9d32f368b01e77cc24095c66c02de146faf0e633ef7c7f5d5815c52367b400f32d7c7f9c87e66d372488ffdd3276b4aeb6e0cef
languageName: node
linkType: hard

"js-base64@npm:^2.1.9":
version: 2.6.4
resolution: "js-base64@npm:2.6.4"
Expand Down Expand Up @@ -11673,7 +11659,7 @@ __metadata:
jasmine-jquery: "npm:~2.1.1"
jest: "npm:~24.9.0"
jest-cli: "npm:~24.9.0"
jquery: "npm:~2.2.4"
jquery: "npm:~3.7.1"
jquery-ui: "npm:~1.13.2"
jquery-ujs: "npm:~1.2.2"
jquery.hotkeys: "npm:~0.1.0"
Expand Down

0 comments on commit cb16651

Please sign in to comment.