feat: remove support for discussion mfe in iframe (#308)
Co-authored-by: adeel.tajamul <adeel.tajamul@arbisoft.com>
This commit is contained in:
committed by
GitHub
parent
52550149ea
commit
8eb3143c7e
@@ -46,7 +46,6 @@ export default function DiscussionsHome() {
|
||||
learnerUsername,
|
||||
} = params;
|
||||
const inContext = new URLSearchParams(location.search).get('inContext') !== null;
|
||||
const inIframe = new URLSearchParams(location.search).get('inIframe')?.toLowerCase() === 'true';
|
||||
// Display the content area if we are currently viewing/editing a post or creating one.
|
||||
const displayContentArea = postId || postEditorVisible || (learnerUsername && postId);
|
||||
let displaySidebar = useSidebarVisible();
|
||||
@@ -82,10 +81,9 @@ export default function DiscussionsHome() {
|
||||
learnerUsername,
|
||||
}}
|
||||
>
|
||||
{!inIframe && <Header courseOrg={org} courseNumber={courseNumber} courseTitle={courseTitle} />}
|
||||
<Header courseOrg={org} courseNumber={courseNumber} courseTitle={courseTitle} />
|
||||
<main className="container-fluid d-flex flex-column p-0 w-100" id="main" tabIndex="-1">
|
||||
{!inIframe
|
||||
&& <CourseTabsNavigation activeTab="discussion" courseId={courseId} />}
|
||||
<CourseTabsNavigation activeTab="discussion" courseId={courseId} />
|
||||
<div className="header-action-bar" ref={postActionBarRef}>
|
||||
<div
|
||||
className="d-flex flex-row justify-content-between navbar fixed-top"
|
||||
@@ -120,7 +118,7 @@ export default function DiscussionsHome() {
|
||||
)}
|
||||
</div>
|
||||
</main>
|
||||
{!inIframe && <Footer />}
|
||||
<Footer />
|
||||
</DiscussionContext.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -88,35 +88,10 @@ describe('DiscussionsHome', () => {
|
||||
window.parent = parent;
|
||||
});
|
||||
|
||||
describe.each([
|
||||
{
|
||||
queryParam: 'inIframe=True',
|
||||
iframeView: true,
|
||||
},
|
||||
{
|
||||
queryParam: 'inIframe=False',
|
||||
iframeView: false,
|
||||
},
|
||||
{
|
||||
queryParam: '',
|
||||
iframeView: false,
|
||||
},
|
||||
])(
|
||||
'Header/Footer visibility',
|
||||
({
|
||||
queryParam,
|
||||
iframeView,
|
||||
}) => {
|
||||
test(`inIframe query param ${queryParam}`, async () => {
|
||||
renderComponent(`/${courseId}/topics?${queryParam}`);
|
||||
if (iframeView) {
|
||||
expect(screen.queryByRole('banner')).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole('contentinfo')).not.toBeInTheDocument();
|
||||
} else {
|
||||
expect(screen.queryByRole('banner')).toBeInTheDocument();
|
||||
expect(screen.queryByRole('contentinfo')).toBeInTheDocument();
|
||||
}
|
||||
});
|
||||
},
|
||||
);
|
||||
test('header, course navigation bar and footer are visible', async () => {
|
||||
renderComponent();
|
||||
expect(screen.queryByRole('banner')).toBeInTheDocument();
|
||||
expect(document.getElementById('courseTabsNavigation')).toBeInTheDocument();
|
||||
expect(screen.queryByRole('contentinfo')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user