Skip to content

Commit a9e4d0f

Browse files
committed
chore: fix imports/tests, correct eslint offenses
- These are functionally the same chore: update imports for ModalContainerProvider chore: add garden shadow package and update imports - Garden shadow will be removed in a follow up, this first phase is just a lift and shift to ensure everything is imported correctly feat: add package for new-requests-list chore: remove the dist folder chore: add locales folder chore: continue fixing imports chore: add mocks folder for svgs to pass tests chore: satisfy dependency chore: remove ErrorBoundary duplicate chore: use settings instead of themesettings dup chore: fix test ts error by adding default fallback chore: add default fallback colors to fix ts test error chore: make ts happy ensuring return is never undefined with fallback value fix: replace linkColor with primaryEmphasis - linkColor was specific to themeSettings and only used here as far as I could see, garden contains primaryEmphasis which is the color used for links, so have replaced linkColor with this. fix: add fallbacks&correct further eslint offenses - Fallback to "pending" status color and label if status is undefined fix: organizations map return value branch missing - the else statement of of the subscriptions map function was missing resulting in a test / TS error. Have replaced the if statement with a slice to make sure we are only working with the first elements up to amountShowing. fix: typescript potential undefined errors Address 3 ts errors in file 1. allowing for data to be returned as any due to potential undefined 2. adding undefined to return type of getDefaultOrganization 3. handleTabSelect not invoking id if default org is undefined fix: ts undefined in FieldTags and DateFilter - Add fallback to empty string in datefilter - FilterValues in fieldTags had multiple ts warning errors for potential undefined values, these were addressed by restructuring conditionals and adding extra undefined checks chore: correct eslint offenses - Allow the same any types that we did in new request list - Remove unused React imports - Make shadow root container kebab case fix: yarn build circular dependency fix: fix ts undefined calendar errors fix: add default en translation to jest setup fix: data-test-id not being found and clearAllMocks - Replaced `getByTestId` with `getByRole` to correctly target checkboxes by their accessible names - Added `jest.clearAllMocks()` in the afterEach hook to reset mock states because otherwise the mock calls were accumulating across the test suite fix: filter modal tests not finding data-test-ids Replaced the data test id finders with clicks on Start textbox to get the datepicker to show up, then traversed the DOM to find the calendar items. fix: organization data test id not being found fix: find by role instead of data test id fix: ensure tests always run in UTC zone chore: remove uneeded types from HCData.ts - These types can be derived from settings, so when initialising the newrequest list app we only need: <div class="container"> <header class="my-activities-header"> <h1>{{t "requests"}}</h1> </header> <div id="main-content"> </div> </div> <script type="module"> const requestListSettings = {{json settings}}; const themeProps = { settings: requestListSettings }; const userProps = { locale:{{json help_center.base_locale}}, } const dataProps = { user: userProps, theme: themeProps, }; import { renderRequestList } from "request-list"; const container = document.getElementById("main-content"); renderRequestList(container,dataProps); </script> fix: translations folder location chore: address review - Removed unused - Use files from shared - Locales fixed, had accidentally rebased and dropped the correct commit - Use same rendering method as the remaining apps - Use strings lookup in STATUS_MAPPING to avoid extra eslint fixes - Rebase with master and update yarn.lock app can by tested by modifying the requests_page.hbs i.e: <div class="container"> <header class="my-activities-header"> <h1>{{t "requests"}}</h1> </header> <div id="main-content"> </div> </div> <script type="module"> const requestListSettings = {{json settings}}; const themeProps = { settings: requestListSettings }; const userProps = { locale:{{json help_center.base_locale}}, } const dataProps = { user: userProps, theme: themeProps, }; import { renderNewRequestList } from "new-request-list"; const container = document.getElementById("main-content"); renderNewRequestList(container,dataProps); </script> chore: rename new request list to request list chore: address review part 2
1 parent ab0b0ea commit a9e4d0f

213 files changed

Lines changed: 21029 additions & 354 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

__mocks__/svg.mock.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = () => null;

assets/request-list-bundle.js

Lines changed: 118 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/request-list-translations-bundle.js

Lines changed: 10202 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jest.config.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ const config = {
77
},
88
transformIgnorePatterns: ["node_modules/(?!(react-merge-refs)/)"],
99
setupFilesAfterEnv: ["@testing-library/jest-dom", "<rootDir>/jest.setup.js"],
10+
moduleNameMapper: {
11+
"\\.svg$": "<rootDir>/__mocks__/svg.mock.js",
12+
},
1013
};
1114

1215
export default config;

jest.setup.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
import { jest } from "@jest/globals";
22

3+
import i18n from "i18next";
4+
import { initReactI18next } from "react-i18next";
5+
6+
i18n.use(initReactI18next).init({
7+
resources: {
8+
en: {},
9+
},
10+
lng: "en",
11+
interpolation: {
12+
escapeValue: false,
13+
},
14+
keySeparator: false,
15+
pluralSeparator: ".",
16+
});
17+
318
Object.defineProperty(window, "matchMedia", {
419
writable: true,
520
value: jest.fn().mockImplementation((query) => ({

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"eslint": "eslint src",
1010
"prepare": "husky install",
1111
"download-locales": "node ./bin/update-translations",
12-
"test": "jest",
12+
"test": "TZ=UTC jest",
1313
"test-a11y": "node bin/lighthouse/index.js",
1414
"i18n:extract": "node bin/extract-strings.mjs",
1515
"i18n:update-translations": "node bin/update-modules-translations.mjs",
@@ -25,13 +25,15 @@
2525
"@zendeskgarden/react-buttons": "9.12.0",
2626
"@zendeskgarden/react-datepickers": "9.12.0",
2727
"@zendeskgarden/react-dropdowns": "9.12.0",
28+
"@zendeskgarden/react-dropdowns.legacy": "9.12.0",
2829
"@zendeskgarden/react-forms": "9.12.0",
2930
"@zendeskgarden/react-grid": "9.12.0",
3031
"@zendeskgarden/react-loaders": "9.12.0",
3132
"@zendeskgarden/react-modals": "9.12.0",
3233
"@zendeskgarden/react-notifications": "9.12.0",
3334
"@zendeskgarden/react-pagination": "9.12.0",
3435
"@zendeskgarden/react-tables": "9.12.0",
36+
"@zendeskgarden/react-tabs": "9.12.0",
3537
"@zendeskgarden/react-tags": "9.12.0",
3638
"@zendeskgarden/react-theming": "9.12.0",
3739
"@zendeskgarden/react-tooltips": "9.12.0",

rollup.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export default defineConfig([
3434
context: "this",
3535
input: {
3636
"new-request-form": "src/modules/new-request-form/index.tsx",
37+
"request-list": "src/modules/request-list/index.tsx",
3738
"flash-notifications": "src/modules/flash-notifications/index.ts",
3839
"service-catalog": "src/modules/service-catalog/index.tsx",
3940
"approval-requests": "src/modules/approval-requests/index.tsx",

src/modules/new-request-list/components/error-boundary/ErrorBoundary.tsx

Lines changed: 0 additions & 34 deletions
This file was deleted.

src/modules/new-request-list/components/error-boundary/ErrorScreen.tsx

Lines changed: 0 additions & 57 deletions
This file was deleted.

src/modules/new-request-list/i18n/index.ts

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)