diff --git a/pages/app/index.tsx b/pages/app/index.tsx index a5b0b16aaa..f6ea0d8b87 100644 --- a/pages/app/index.tsx +++ b/pages/app/index.tsx @@ -24,8 +24,7 @@ function App() { urlParams: { density, motionDisabled }, } = useContext(AppContext); - const isAppLayout = - pageId !== undefined && (pageId.indexOf('app-layout') > -1 || pageId.indexOf('content-layout') > -1); + const isAppLayout = pageId !== undefined && (pageId.includes('app-layout') || pageId.includes('content-layout')); // AppLayout already contains
// Also, AppLayout pages should resemble the ConsoleNav 2.0 styles const ContentTag = isAppLayout ? 'div' : 'main'; diff --git a/pages/cards/selection.page.tsx b/pages/cards/selection.page.tsx index 0c699f0ccc..3ec389b931 100644 --- a/pages/cards/selection.page.tsx +++ b/pages/cards/selection.page.tsx @@ -13,7 +13,7 @@ interface Item { const ariaLabels: CardsProps['ariaLabels'] = { selectionGroupLabel: 'group label', itemSelectionLabel: ({ selectedItems }, item) => - `${item.text} is ${selectedItems.indexOf(item) < 0 ? 'not ' : ''}selected`, + `${item.text} is ${!selectedItems.includes(item) ? 'not ' : ''}selected`, }; function createSimpleItems(count: number) { diff --git a/pages/tsconfig.json b/pages/tsconfig.json index edf008d36e..5c14178b3d 100644 --- a/pages/tsconfig.json +++ b/pages/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "lib": ["ES2015", "DOM"], + "lib": ["ES2020", "DOM"], "target": "ES2015", "declaration": false, "declarationMap": false, diff --git a/src/__a11y__/run-a11y-tests.ts b/src/__a11y__/run-a11y-tests.ts index 007c72d11b..f9760033b0 100644 --- a/src/__a11y__/run-a11y-tests.ts +++ b/src/__a11y__/run-a11y-tests.ts @@ -6,7 +6,7 @@ import useBrowser from '@cloudscape-design/browser-test-tools/use-browser'; import { findAllPages } from '../__integ__/utils'; import A11yPageObject from './a11y-page-object'; -type Theme = string; +type Theme = 'default' | 'visual-refresh'; type Mode = 'light' | 'dark'; function setupTest(url: string, testFn: (page: A11yPageObject) => Promise) { @@ -19,21 +19,20 @@ function setupTest(url: string, testFn: (page: A11yPageObject) => Promise) } function urlFormatter(inputUrl: string, theme: Theme, mode: Mode) { - return `#/${mode}/${inputUrl}?visualRefresh=${theme.indexOf('visual-refresh') !== -1 ? 'true' : 'false'}`; + return `#/${mode}/${inputUrl}?visualRefresh=${theme === 'visual-refresh' ? 'true' : 'false'}`; } export default function runA11yTests(theme: Theme, mode: Mode, skip: string[] = []) { describe(`A11y checks for ${mode} ${theme}`, () => { findAllPages().forEach(inputUrl => { - const testFunction = - [ - ...skip, - 'theming/tokens', - // this page intentionally has issues to test the helper - 'undefined-texts', - ].indexOf(inputUrl) === -1 - ? test - : test.skip; + const testFunction = [ + ...skip, + 'theming/tokens', + // this page intentionally has issues to test the helper + 'undefined-texts', + ].includes(inputUrl) + ? test + : test.skip; const url = urlFormatter(inputUrl, theme, mode); testFunction( url, diff --git a/src/__tests__/form-field-controls-integration.test.tsx b/src/__tests__/form-field-controls-integration.test.tsx index 213cae8a81..94c80a551d 100644 --- a/src/__tests__/form-field-controls-integration.test.tsx +++ b/src/__tests__/form-field-controls-integration.test.tsx @@ -82,7 +82,7 @@ formFieldControlComponents.forEach(({ componentName, findNativeElement }) => { } describe(`${componentName}`, () => { - const isGroupComponent = ['radio-group', 'tiles'].indexOf(componentName) !== -1; + const isGroupComponent = ['radio-group', 'tiles'].includes(componentName); if (!isGroupComponent) { describe('controlId', () => { test('applies controlId from FormField when controlId is not set on itself', () => { diff --git a/src/multiselect/__integ__/page-objects/multiselect-page.ts b/src/multiselect/__integ__/page-objects/multiselect-page.ts index 5dcebbef28..48ecdeccc2 100644 --- a/src/multiselect/__integ__/page-objects/multiselect-page.ts +++ b/src/multiselect/__integ__/page-objects/multiselect-page.ts @@ -1,10 +1,8 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -import { strict as assert } from 'assert'; import { MultiselectWrapper } from '../../../../lib/components/test-utils/selectors'; import SelectPageObject from '../../../select/__integ__/page-objects/select-page'; import optionStyles from '../../../../lib/components/internal/components/option/styles.selectors.js'; -import selectableItemStyles from '../../../../lib/components/internal/components/selectable-item/styles.selectors.js'; export default class MultiselectPageObject extends SelectPageObject { getOptionInGroup(groupNumber: number, optionNumber: number) { @@ -15,15 +13,6 @@ export default class MultiselectPageObject extends SelectPageObject