feat: remove loading on editor pages (#250)

Because we are moving the v2 editor pages to be "fake" modals, which have no z-index, we need to discard the course authoring "loading" wheel for the header and footer. We also need to bump the version of f-l-c-c to bring in the new editor changes.
This commit is contained in:
connorhaugh
2022-02-15 15:06:09 -05:00
committed by GitHub
parent 4047a1c05f
commit 42cb63601e
5 changed files with 94 additions and 9 deletions

View File

@@ -14,6 +14,13 @@ import { executeThunk } from './utils';
import { fetchCourseApps } from './pages-and-resources/data/thunks';
const courseId = 'course-v1:edX+TestX+Test_Course';
let mockPathname = '/evilguy/';
jest.mock('react-router-dom', () => ({
...jest.requireActual('react-router-dom'),
useLocation: () => ({
pathname: mockPathname,
}),
}));
let axiosMock;
let store;
let container;
@@ -61,3 +68,56 @@ describe('DiscussionsSettings', () => {
expect(queryByTestId(container, 'permissionDeniedAlert')).toBeInTheDocument();
});
});
describe('Editor Pages Load no header', () => {
const mockStoreSuccess = async () => {
const apiBaseUrl = getConfig().STUDIO_BASE_URL;
const courseAppsApiUrl = `${apiBaseUrl}/api/course_apps/v1/apps`;
axiosMock.onGet(`${courseAppsApiUrl}/${courseId}`).reply(200, {
response: { status: 200 },
});
await executeThunk(fetchCourseApps(courseId), store.dispatch);
};
beforeEach(() => {
initializeMockApp({
authenticatedUser: {
userId: 3,
username: 'abc123',
administrator: true,
roles: [],
},
});
store = initializeStore();
axiosMock = new MockAdapter(getAuthenticatedHttpClient());
});
test('renders no loading wheel on editor pages', async () => {
mockPathname = '/editor/';
await mockStoreSuccess();
const wrapper = render(
<AppProvider store={store}>
<IntlProvider locale="en">
<CourseAuthoringPage courseId={courseId}>
<PagesAndResources courseId={courseId} />
</CourseAuthoringPage>
</IntlProvider>
</AppProvider>
,
);
expect(wrapper.queryByRole('status')).not.toBeInTheDocument();
});
test('renders loading wheel on non editor pages', async () => {
mockPathname = '/evilguy/';
await mockStoreSuccess();
const wrapper = render(
<AppProvider store={store}>
<IntlProvider locale="en">
<CourseAuthoringPage courseId={courseId}>
<PagesAndResources courseId={courseId} />
</CourseAuthoringPage>
</IntlProvider>
</AppProvider>
,
);
expect(wrapper.queryByRole('status')).toBeInTheDocument();
});
});