Skip to content

Commit ddf8b50

Browse files
committed
feat: add start:with-theme command
1 parent 14cc32f commit ddf8b50

File tree

66 files changed

+1077
-960
lines changed

Some content is hidden

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

66 files changed

+1077
-960
lines changed

.husky/pre-commit

Lines changed: 0 additions & 1 deletion
This file was deleted.

package-lock.json

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

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
"i18n_extract": "fedx-scripts formatjs extract",
1616
"lint": "fedx-scripts eslint --ext .js --ext .jsx --ext .ts --ext .tsx .",
1717
"lint:fix": "fedx-scripts eslint --fix --ext .js --ext .jsx --ext .ts --ext .tsx .",
18-
"prepare": "husky",
1918
"postinstall": "patch-package",
2019
"snapshot": "fedx-scripts jest --updateSnapshot",
2120
"start": "fedx-scripts webpack-dev-server --progress",
21+
"start:with-theme": "paragon install-theme && npm start && npm install",
2222
"dev": "PUBLIC_PATH=/learning/ MFE_CONFIG_API_URL='http://localhost:8000/api/mfe_config/v1' fedx-scripts webpack-dev-server --progress --host apps.local.openedx.io",
2323
"test": "fedx-scripts jest --coverage --passWithNoTests",
2424
"test:watch": "fedx-scripts jest --watch --passWithNoTests",
@@ -37,7 +37,7 @@
3737
"@edx/brand": "npm:@openedx/brand-openedx@^1.2.2",
3838
"@edx/browserslist-config": "1.5.0",
3939
"@edx/frontend-component-header": "^5.8.0",
40-
"@edx/frontend-lib-learning-assistant": "^2.19.1",
40+
"@edx/frontend-lib-learning-assistant": "^2.19.2",
4141
"@edx/frontend-lib-special-exams": "^3.1.3",
4242
"@edx/frontend-platform": "^8.0.0",
4343
"@edx/openedx-atlas": "^0.6.0",
@@ -55,7 +55,6 @@
5555
"buffer": "^6.0.3",
5656
"classnames": "2.5.1",
5757
"copy-webpack-plugin": "^12.0.0",
58-
"husky": "9.1.7",
5958
"joi": "^17.11.0",
6059
"js-cookie": "3.0.5",
6160
"lodash": "^4.17.21",
@@ -84,7 +83,7 @@
8483
"@testing-library/jest-dom": "5.17.0",
8584
"@testing-library/react": "12.1.5",
8685
"@testing-library/react-hooks": "^8.0.1",
87-
"@testing-library/user-event": "14.5.2",
86+
"@testing-library/user-event": "14.6.1",
8887
"axios-mock-adapter": "2.1.0",
8988
"bundlewatch": "^0.4.0",
9089
"eslint-import-resolver-webpack": "^0.13.9",

src/course-home/courseware-search/CoursewareSearch.jsx

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -141,32 +141,32 @@ const CoursewareSearch = ({ ...sectionProps }) => {
141141
</Button>
142142
</div>
143143
</div>
144-
145-
{status === 'loading' ? (
146-
<div className="courseware-search__spinner" data-testid="courseware-search-spinner">
147-
<Spinner animation="border" variant="light" screenReaderText={formatMessage(messages.loading)} />
148-
</div>
149-
) : null}
150-
{status === 'error' && (
151-
<Alert className="mt-4" variant="danger" data-testid="courseware-search-error">
152-
{formatMessage(messages.searchResultsError)}
153-
</Alert>
154-
)}
155-
{status === 'results' ? (
156-
<>
157-
{total > 0 ? (
158-
<div
159-
className="courseware-search__results-summary"
160-
aria-live="polite"
161-
aria-relevant="all"
162-
aria-atomic="true"
163-
data-testid="courseware-search-summary"
164-
>{formatMessage(messages.searchResultsLabel, { total, keyword: lastSearchKeyword })}
165-
</div>
166-
) : null}
167-
<CoursewareSearchResultsFilterContainer />
168-
</>
169-
) : null}
144+
<div className="courseware-search__results" aria-live="polite" data-testid="courseware-search-results">
145+
{status === 'loading' ? (
146+
<div className="courseware-search__spinner" data-testid="courseware-search-spinner">
147+
<Spinner animation="border" variant="light" screenReaderText={formatMessage(messages.loading)} />
148+
</div>
149+
) : null}
150+
{status === 'error' && (
151+
<Alert className="mt-4" variant="danger" data-testid="courseware-search-error">
152+
{formatMessage(messages.searchResultsError)}
153+
</Alert>
154+
)}
155+
{status === 'results' ? (
156+
<>
157+
{total > 0 ? (
158+
<div
159+
className="courseware-search__results-summary"
160+
aria-relevant="all"
161+
aria-atomic="true"
162+
data-testid="courseware-search-summary"
163+
>{formatMessage(messages.searchResultsLabel, { total, keyword: lastSearchKeyword })}
164+
</div>
165+
) : null}
166+
<CoursewareSearchResultsFilterContainer />
167+
</>
168+
) : null}
169+
</div>
170170
</div>
171171
</div>
172172
</dialog>

src/course-home/courseware-search/CoursewareSearch.test.jsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
screen,
1010
waitFor,
1111
fireEvent,
12+
within,
1213
} from '../../setupTest';
1314
import { CoursewareSearch } from './index';
1415
import { useElementBoundingBox, useLockScroll, useCoursewareSearchParams } from './hooks';
@@ -243,14 +244,17 @@ describe('CoursewareSearch', () => {
243244
expect(screen.queryByTestId('courseware-search-summary')).not.toBeInTheDocument();
244245
});
245246

246-
it('should show a summary for the results', () => {
247+
it('should show a summary for the results within a container with aria-live="polite"', () => {
247248
mockModels({
248249
searchKeyword: 'fubar',
249250
total: 1,
250251
});
251252
renderComponent();
252253

253-
expect(screen.queryByTestId('courseware-search-summary').textContent).toBe('Results for "fubar":');
254+
const results = screen.queryByTestId('courseware-search-results');
255+
256+
expect(results).toHaveAttribute('aria-live', 'polite');
257+
expect(within(results).queryByTestId('courseware-search-summary').textContent).toBe('Results for "fubar":');
254258
});
255259
});
256260

0 commit comments

Comments
 (0)