-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Exam mode: Remove the footer during an exam (#9134)
- Loading branch information
Showing
10 changed files
with
99 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ebapp/app/exam/participate/exam-navigation-sidebar/exam-navigation-sidebar.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
src/test/javascript/spec/component/shared/main.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { TranslateTestingModule } from '../../helpers/mocks/service/mock-translate.service'; | ||
import { ArtemisTestModule } from '../../test.module'; | ||
import { By } from '@angular/platform-browser'; | ||
import { JhiMainComponent } from 'app/shared/layouts/main/main.component'; | ||
import { MockSyncStorage } from '../../helpers/mocks/service/mock-sync-storage.service'; | ||
import { MockTranslateService } from '../../helpers/mocks/service/mock-translate.service'; | ||
import { LocalStorageService, SessionStorageService } from 'ngx-webstorage'; | ||
import { TranslateService } from '@ngx-translate/core'; | ||
import { ThemeService } from 'app/core/theme/theme.service'; | ||
import { of } from 'rxjs'; | ||
import { MockComponent } from 'ng-mocks'; | ||
import { AlertOverlayComponent } from 'app/shared/alert/alert-overlay.component'; | ||
import { PageRibbonComponent } from 'app/shared/layouts/profiles/page-ribbon.component'; | ||
import { NotificationPopupComponent } from 'app/shared/notification/notification-popup/notification-popup.component'; | ||
import { RouterTestingModule } from '@angular/router/testing'; | ||
|
||
// Mock the initialize method | ||
class MockThemeService { | ||
initialize() { | ||
return of(); | ||
} | ||
} | ||
|
||
describe('JhiMainComponent', () => { | ||
let fixture: ComponentFixture<JhiMainComponent>; | ||
let comp: JhiMainComponent; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [ArtemisTestModule, TranslateTestingModule, RouterTestingModule], | ||
declarations: [JhiMainComponent, MockComponent(AlertOverlayComponent), MockComponent(PageRibbonComponent), MockComponent(NotificationPopupComponent)], | ||
providers: [ | ||
{ provide: LocalStorageService, useClass: MockSyncStorage }, | ||
{ provide: SessionStorageService, useClass: MockSyncStorage }, | ||
{ provide: TranslateService, useClass: MockTranslateService }, | ||
{ provide: ThemeService, useClass: MockThemeService }, | ||
], | ||
}) | ||
.compileComponents() | ||
.then(() => { | ||
fixture = TestBed.createComponent(JhiMainComponent); | ||
comp = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
}); | ||
|
||
afterEach(() => { | ||
jest.restoreAllMocks(); | ||
}); | ||
|
||
it('should display footer if there is no exam', () => { | ||
comp.isExamStarted = false; | ||
comp.showSkeleton = true; | ||
fixture.detectChanges(); | ||
|
||
const footerElement = fixture.debugElement.query(By.css('jhi-footer')); | ||
|
||
expect(footerElement).not.toBeNull(); | ||
}); | ||
|
||
it('should not display footer during an exam', () => { | ||
comp.isExamStarted = true; | ||
comp.showSkeleton = true; | ||
fixture.detectChanges(); | ||
|
||
const footerElement = fixture.debugElement.query(By.css('jhi-footer')); | ||
|
||
expect(footerElement).toBeNull(); | ||
}); | ||
}); |