From 40e9e3440f6405e062dec2e0366cf0b8cc7ff522 Mon Sep 17 00:00:00 2001 From: Caleb Cox Date: Wed, 6 Nov 2024 15:44:43 -0600 Subject: [PATCH 1/2] Upgrade AngularJS --- package.json | 12 ++-- test/spec/controllers/eventDetails.spec.js | 2 + .../paymentCashCheckReport.spec.js | 22 +++---- test/spec/directives/block.spec.js | 4 ++ yarn.lock | 63 +++++++------------ 5 files changed, 46 insertions(+), 57 deletions(-) diff --git a/package.json b/package.json index 75f2aeb13..47a32795c 100644 --- a/package.json +++ b/package.json @@ -3,12 +3,12 @@ "version": "1.0.0", "dependencies": { "@cruglobal/cru-payments": "^1.2.4", - "angular": "^1.6.4", - "angular-cookies": "^1.6.4", + "angular": "^1.8.3", + "angular-cookies": "^1.8.3", "angular-environment": "^1.0.8", "angular-gettext": "^2.3.8", - "angular-route": "^1.6.4", - "angular-sanitize": "^1.6.4", + "angular-route": "^1.8.3", + "angular-sanitize": "^1.8.3", "angular-ui-bootstrap": "^2.5.0", "angular-ui-tree": "^2.4.0", "angular-wysiwyg": "https://github.com/TerryMooreII/angular-wysiwyg.git#6b7961cc45d150cfb2a215eda0a0b97fd82b8509", @@ -43,7 +43,7 @@ "@testing-library/react": "^12.1.5", "@testing-library/react-hooks": "^8.0.1", "@testing-library/user-event": "^14.4.3", - "@types/angular": "^1.8.2", + "@types/angular": "^1.8.3", "@types/jest": "^29.2.5", "@types/prop-types": "^15.7.4", "@types/react": "^17.0.14", @@ -52,7 +52,7 @@ "@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/parser": "^4.33.0", "angular-gettext-cli": "^1.2.0", - "angular-mocks": "^1.6.4", + "angular-mocks": "^1.8.3", "babel-eslint": "^10.1.0", "babel-loader": "^8.1.0", "babel-plugin-angularjs-annotate": "^0.10.0", diff --git a/test/spec/controllers/eventDetails.spec.js b/test/spec/controllers/eventDetails.spec.js index 21c3d9701..92ac9c0f0 100644 --- a/test/spec/controllers/eventDetails.spec.js +++ b/test/spec/controllers/eventDetails.spec.js @@ -40,6 +40,8 @@ describe('Controller: eventDetails', function () { scope = $rootScope.$new(); $httpBackend = _$httpBackend_; + $httpBackend.whenGET(/^ministries|types$/).respond(200, []); + $controller('eventDetailsCtrl', { $scope: scope, conference: testData.conference, diff --git a/test/spec/controllers/paymentCashCheckReport.spec.js b/test/spec/controllers/paymentCashCheckReport.spec.js index aabfbd988..14265a51f 100644 --- a/test/spec/controllers/paymentCashCheckReport.spec.js +++ b/test/spec/controllers/paymentCashCheckReport.spec.js @@ -18,6 +18,13 @@ describe('Controller: paymentCashCheckReportCtrl', function () { $httpBackend = _$httpBackend_; scope = $rootScope.$new(); + $httpBackend + .whenGET(/^conferences\/[-a-zA-Z0-9]+\/payments\/report\/new\.*/) + .respond(201, testData.report); + $httpBackend + .whenGET(/^conferences\/[-a-zA-Z0-9]+\/payments\/report/) + .respond(201, testData.reports); + $controller('paymentCashCheckReportCtrl', { $scope: scope, report: testData.report, @@ -32,12 +39,6 @@ describe('Controller: paymentCashCheckReportCtrl', function () { it('refresh should call api and refresh scope data', function () { scope.report = {}; scope.reports = []; - $httpBackend - .whenGET(/^conferences\/[-a-zA-Z0-9]+\/payments\/report\/new\.*/) - .respond(201, testData.report); - $httpBackend - .whenGET(/^conferences\/[-a-zA-Z0-9]+\/payments\/report\.*/) - .respond(201, testData.reports); scope.refresh(); $httpBackend.flush(); @@ -99,6 +100,9 @@ describe('Controller: paymentCashCheckReportCtrl', function () { .whenPOST(/^conferences\/[-a-zA-Z0-9]+\/payments\/report\/lock\.*/, {}) .respond(201, 'locked-id'); scope.lock(); + // Flush the lock request + $httpBackend.flush(); + // Flush the refresh request triggered by lock updating the query parameters $httpBackend.flush(); $httpBackend.verifyNoOutstandingExpectation(); @@ -114,14 +118,8 @@ describe('Controller: paymentCashCheckReportCtrl', function () { $httpBackend .expectGET(/^conferences\/[-a-zA-Z0-9]+\/payments\/report\/new.*page=1.*/) .respond(201, testData.report); - $httpBackend - .whenGET(/^conferences\/[-a-zA-Z0-9]+\/payments\/report\.*/) - .respond(201, testData.reports); $httpBackend.flush(); scope.queryParameters.page = 2; - $httpBackend - .whenGET(/^conferences\/[-a-zA-Z0-9]+\/payments\/report.*/) - .respond(201, testData.reports); $httpBackend .expectGET(/^conferences\/[-a-zA-Z0-9]+\/payments\/report\/new.*page=2.*/) .respond(201, testData.reports); diff --git a/test/spec/directives/block.spec.js b/test/spec/directives/block.spec.js index 2050fe553..34bc337d9 100644 --- a/test/spec/directives/block.spec.js +++ b/test/spec/directives/block.spec.js @@ -258,12 +258,14 @@ describe('Directive: blocks', () => { expect($scope.answer.value).toBe(''); $scope.selectedAnswer = 'Option 1'; + $scope.$digest(); $timeout.flush(); expect($scope.answer.value).toBe('Option 1'); $scope.selectedAnswer = '__other__'; $scope.otherAnswer = 'Other'; + $scope.$digest(); $timeout.flush(); expect($scope.answer.value).toBe('Other'); @@ -464,12 +466,14 @@ describe('Directive: blocks', () => { expect($scope.answer.value).toBe(''); $scope.selectedAnswer = 'Option 1'; + $scope.$digest(); $timeout.flush(); expect($scope.answer.value).toBe('Option 1'); $scope.selectedAnswer = '__other__'; $scope.otherAnswer = 'Other'; + $scope.$digest(); $timeout.flush(); expect($scope.answer.value).toBe('Other'); diff --git a/yarn.lock b/yarn.lock index 8f4a63eb3..e78cd4f0c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2002,15 +2002,10 @@ resolved "https://registry.yarnpkg.com/@trysound/sax/-/sax-0.2.0.tgz#cccaab758af56761eb7bf37af6f03f326dd798ad" integrity sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA== -"@types/angular@^1.6.34": - version "1.8.4" - resolved "https://registry.yarnpkg.com/@types/angular/-/angular-1.8.4.tgz#a2cc163e508389c51d4c4119ebff6b9395cec472" - integrity sha512-wPS/ncJWhyxJsndsW1B6Ta8D4mi97x1yItSu+rkLDytU3oRIh2CFAjMuJceYwFAh9+DIohndWM0QBA9OU2Hv0g== - -"@types/angular@^1.6.39", "@types/angular@^1.8.2": - version "1.8.2" - resolved "https://registry.yarnpkg.com/@types/angular/-/angular-1.8.2.tgz#35d357097a853147a1b65ad34670322ca4e56b69" - integrity sha512-V0Hgx2Q3wFNcrrmx8zVepdasDuwnK4lqQFe0Zr9Ll3DoTJIuhKOpyfHC6KuVDBXJGgTkMKtELbvDe9crIkSGzg== +"@types/angular@^1.6.34", "@types/angular@^1.6.39", "@types/angular@^1.8.3": + version "1.8.9" + resolved "https://registry.yarnpkg.com/@types/angular/-/angular-1.8.9.tgz#d1ae3e87a67f72342d55ff26e611df83df0fb176" + integrity sha512-Z0HukqZkx0fotsV3QO00yqU9NzcQI+tMcrum+8MvfB4ePqCawZctF/gz6QiuII+T1ax+LitNoPx/eICTgnF4sg== "@types/aria-query@^5.0.1": version "5.0.1" @@ -2619,10 +2614,10 @@ alphanum-sort@^1.0.1, alphanum-sort@^1.0.2: resolved "https://registry.yarnpkg.com/alphanum-sort/-/alphanum-sort-1.0.2.tgz#97a1119649b211ad33691d9f9f486a8ec9fbe0a3" integrity sha1-l6ERlkmyEa0zaR2fn0hqjsn74KM= -angular-cookies@^1.6.4: - version "1.6.4" - resolved "https://registry.yarnpkg.com/angular-cookies/-/angular-cookies-1.6.4.tgz#c28f3f6aac7a9826c1e45f1d6807240036e5b26d" - integrity sha1-wo8/aqx6mCbB5F8daAckADblsm0= +angular-cookies@^1.8.3: + version "1.8.3" + resolved "https://registry.yarnpkg.com/angular-cookies/-/angular-cookies-1.8.3.tgz#180a41e938926790630245d22c02a8d33d1409cc" + integrity sha512-uRd+zWgqiVnly7+YFRosM8E9tUQeY82dAZdtvonh/CeD/sf5SKN/BNIlMlHxZtoAk72ahTIjqUQGfeHdYcSsRQ== angular-environment@^1.0.8: version "1.0.8" @@ -2656,20 +2651,20 @@ angular-gettext@^2.3.8: resolved "https://registry.yarnpkg.com/angular-gettext/-/angular-gettext-2.3.10.tgz#f7125bf1a27b767037c204de352f3b144db9697c" integrity sha1-9xJb8aJ7dnA3wgTeNS87FE25aXw= -angular-mocks@^1.6.4: - version "1.6.4" - resolved "https://registry.yarnpkg.com/angular-mocks/-/angular-mocks-1.6.4.tgz#47fdf50921cf24fb489f100a8cf2ad99d0538f40" - integrity sha1-R/31CSHPJPtInxAKjPKtmdBTj0A= +angular-mocks@^1.8.3: + version "1.8.3" + resolved "https://registry.yarnpkg.com/angular-mocks/-/angular-mocks-1.8.3.tgz#c0dd05e5c3fc014e07af6289b23f0e817d7a4724" + integrity sha512-vqsT6zwu80cZ8RY7qRQBZuy6Fq5X7/N5hkV9LzNT0c8b546rw4ErGK6muW1u2JnDKYa7+jJuaGM702bWir4HGw== -angular-route@^1.6.4: - version "1.6.4" - resolved "https://registry.yarnpkg.com/angular-route/-/angular-route-1.6.4.tgz#7bb216fcda746a1b8c452054b05900a7074ecc62" - integrity sha1-e7IW/Np0ahuMRSBUsFkApwdOzGI= +angular-route@^1.8.3: + version "1.8.3" + resolved "https://registry.yarnpkg.com/angular-route/-/angular-route-1.8.3.tgz#f24a700ebd462454ca83a8b765df55c87a4edde1" + integrity sha512-kpIcRmDR2+o1FxDVVYy8Rvfab86/7LDbOgTRb9T+X9ewPQiBRuDEnZtM3oJYBiQLvAXDYTJXHV48n/bGE9Mv2g== -angular-sanitize@^1.6.4: - version "1.6.4" - resolved "https://registry.yarnpkg.com/angular-sanitize/-/angular-sanitize-1.6.4.tgz#60a37ea96fb0d4a322a3ccb64ee4a5cf3b154f0c" - integrity sha1-YKN+qW+w1KMio8y2TuSlzzsVTww= +angular-sanitize@^1.8.3: + version "1.8.3" + resolved "https://registry.yarnpkg.com/angular-sanitize/-/angular-sanitize-1.8.3.tgz#51378e990e78c7ecc1fb31cd68655aff690a3bf1" + integrity sha512-2rxdqzlUVafUeWOwvY/FtyWk1pFTyCtzreeiTytG9m4smpuAEKaIJAjYeVwWsoV+nlTOcgpwV4W1OCmR+BQbUg== angular-ui-bootstrap@^2.5.0: version "2.5.0" @@ -2693,20 +2688,10 @@ angular2react@^3.0.2: lodash.kebabcase "^4.1.1" ngimport "^1.0.0" -angular@>=1.4.0: - version "1.7.9" - resolved "https://registry.yarnpkg.com/angular/-/angular-1.7.9.tgz#e52616e8701c17724c3c238cfe4f9446fd570bc4" - integrity sha512-5se7ZpcOtu0MBFlzGv5dsM1quQDoDeUTwZrWjGtTNA7O88cD8TEk5IEKCTDa3uECV9XnvKREVUr7du1ACiWGFQ== - -angular@>=1.5, angular@>=1.5.0: - version "1.8.2" - resolved "https://registry.yarnpkg.com/angular/-/angular-1.8.2.tgz#5983bbb5a9fa63e213cb7749199e0d352de3a2f1" - integrity sha512-IauMOej2xEe7/7Ennahkbb5qd/HFADiNuLSESz9Q27inmi32zB0lnAsFeLEWcox3Gd1F6YhNd1CP7/9IukJ0Gw== - -angular@^1.6.4: - version "1.6.4" - resolved "https://registry.yarnpkg.com/angular/-/angular-1.6.4.tgz#03b7b15c01a0802d7e2cf593240e604054dc77fb" - integrity sha1-A7exXAGggC1+LPWTJA5gQFTcd/s= +angular@>=1.4.0, angular@>=1.5, angular@>=1.5.0, angular@^1.8.3: + version "1.8.3" + resolved "https://registry.yarnpkg.com/angular/-/angular-1.8.3.tgz#851ad75d5163c105a7e329555ef70c90aa706894" + integrity sha512-5qjkWIQQVsHj4Sb5TcEs4WZWpFeVFHXwxEBHUhrny41D8UrBAd6T/6nPPAsLngJCReIOqi95W3mxdveveutpZw== ansi-colors@^3.0.0: version "3.2.4" From eb155a46ab7b6ae125c802d263353d9f810e0310 Mon Sep 17 00:00:00 2001 From: Caleb Cox Date: Thu, 7 Nov 2024 12:52:43 -0600 Subject: [PATCH 2/2] Upgrade angular-gettext Fixes angular.lowercase is not a function error. --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 47a32795c..71adc7e3e 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "angular": "^1.8.3", "angular-cookies": "^1.8.3", "angular-environment": "^1.0.8", - "angular-gettext": "^2.3.8", + "angular-gettext": "^2.4.2", "angular-route": "^1.8.3", "angular-sanitize": "^1.8.3", "angular-ui-bootstrap": "^2.5.0", diff --git a/yarn.lock b/yarn.lock index e78cd4f0c..5e02b3bf5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2646,10 +2646,10 @@ angular-gettext-tools@^2: typescript "~2.0.3" typescript-eslint-parser "^1.0.2" -angular-gettext@^2.3.8: - version "2.3.10" - resolved "https://registry.yarnpkg.com/angular-gettext/-/angular-gettext-2.3.10.tgz#f7125bf1a27b767037c204de352f3b144db9697c" - integrity sha1-9xJb8aJ7dnA3wgTeNS87FE25aXw= +angular-gettext@^2.4.2: + version "2.4.2" + resolved "https://registry.yarnpkg.com/angular-gettext/-/angular-gettext-2.4.2.tgz#e5dde8df91493f826fd7eb8b5d6125a10cc0b681" + integrity sha512-J9Zy76VmN5otw6GyIqJjoLjl+0wwsZSCUPgPfQwM4Mx//hP3leqyS/fgf2MDiMLLyKgoHWkMMzzWbP4iH3+5vQ== angular-mocks@^1.8.3: version "1.8.3"