Skip to content

Commit

Permalink
Fixes correctness footer issue in diagnostic test (oppia#20984)
Browse files Browse the repository at this point in the history
* Fixes correctness footer issue.

* Updates variable name.

* Adds banner, updates css

* Fixes frontend tests
  • Loading branch information
Nik-09 authored Oct 1, 2024
1 parent 808775c commit b6175c4
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<div class="diagnostic-test-container">
<background-banner></background-banner>
<div class="diagnostic-test-container position-relative">
<div class="oppia-diagnostic-test-page-header">
<button class="btn oppia-back-to-classroom-button">
<a class="oppia-anchor-tag-under-button" [href]="'/learn/' + classroomUrlFragment">
Expand Down Expand Up @@ -112,15 +113,16 @@ <h3 class="oppia-no-recommendation-header-text">
.oppia-diagnostic-test-page-header {
align-items: center;
display: flex;
margin: 3%;
justify-content: center;
padding: 3% 3% 0 3%;
position: relative;
}
.oppia-back-to-classroom-button {
align-items: center;
background-color: #00645c;
color: #fff;
display: flex;
float: right;
font-family: "Capriola", "Roboto", Arial, sans-serif;
left: 5%;
position: absolute;
text-transform: uppercase;
}
.oppia-back-button-text-class {
Expand Down Expand Up @@ -260,7 +262,11 @@ <h3 class="oppia-no-recommendation-header-text">
@media(max-width: 500px) {
.oppia-introductory-card {
margin-left: auto;
width: 100%;
width: 90%;
}
.oppia-back-to-classroom-button {
left: 1%;
position: relative;
}
.oppia-image {
align-items: center;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,20 +210,6 @@ describe('Diagnostic test player component', () => {
);
});

it("should be able to get Oppia's avatar image URL after initialization", () => {
windowRef.nativeWindow.location.search = '?classroom=math';
spyOn(preventPageUnloadEventService, 'addListener');

expect(component.OPPIA_AVATAR_IMAGE_URL).toEqual('');

const avatarImageLocation =
'/assets/copyrighted-images/avatar/oppia_avatar_100px.svg';

component.ngOnInit();

expect(component.OPPIA_AVATAR_IMAGE_URL).toEqual(avatarImageLocation);
});

it('should get classroomData after initialization', fakeAsync(() => {
windowRef.nativeWindow.location.search = '?classroom=math';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ import {AlertsService} from 'services/alerts.service';
templateUrl: './diagnostic-test-player.component.html',
})
export class DiagnosticTestPlayerComponent implements OnInit {
OPPIA_AVATAR_IMAGE_URL: string = '';
OPPIA_AVATAR_IMAGE_URL: string =
this.urlInterpolationService.getStaticCopyrightedImageUrl(
'/avatar/oppia_avatar_100px.svg'
);
diagnosticTestTopicTrackerModel!: DiagnosticTestTopicTrackerModel;
diagnosticTestIsStarted: boolean = false;
diagnosticTestIsFinished = false;
Expand Down Expand Up @@ -81,11 +84,6 @@ export class DiagnosticTestPlayerComponent implements OnInit {
return this.diagnosticTestIsStarted && !this.diagnosticTestIsFinished;
});

this.OPPIA_AVATAR_IMAGE_URL =
this.urlInterpolationService.getStaticCopyrightedImageUrl(
'/avatar/oppia_avatar_100px.svg'
);

this.componentSubscription.add(
this.diagnosticTestPlayerStatusService.onDiagnosticTestSessionCompleted.subscribe(
(recommendedTopicIds: string[]) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export class ConversationSkinComponent {
displayedCard: StateCard;
upcomingInlineInteractionHtml;
responseTimeout: NodeJS.Timeout | null = null;
correctnessFooterIsShown: boolean = true;
DEFAULT_TWITTER_SHARE_MESSAGE_PLAYER =
AppConstants.DEFAULT_TWITTER_SHARE_MESSAGE_EDITOR;

Expand Down Expand Up @@ -260,6 +261,7 @@ export class ConversationSkinComponent {
this.navigationThroughCardHistoryIsEnabled = false;
this.checkpointCelebrationModalIsEnabled = false;
this.skipButtonIsShown = true;
this.correctnessFooterIsShown = false;
}

if (!this.contextService.isInExplorationPlayerPage()) {
Expand Down Expand Up @@ -456,7 +458,8 @@ export class ConversationSkinComponent {
if (
!this.isIframed &&
!this._editorPreviewMode &&
!this.explorationPlayerStateService.isInQuestionPlayerMode()
!this.explorationPlayerStateService.isInQuestionPlayerMode() &&
!this.explorationPlayerStateService.isInDiagnosticTestPlayerMode()
) {
// For the first state which is always a checkpoint.
let firstStateName: string;
Expand Down Expand Up @@ -567,6 +570,7 @@ export class ConversationSkinComponent {

isCorrectnessFooterEnabled(): boolean {
return (
this.correctnessFooterIsShown &&
this.answerIsCorrect &&
this.playerPositionService.hasLearnerJustSubmittedAnAnswer()
);
Expand Down Expand Up @@ -1147,7 +1151,8 @@ export class ConversationSkinComponent {
if (
!this.isIframed &&
!this._editorPreviewMode &&
!this.explorationPlayerStateService.isInQuestionPlayerMode()
!this.explorationPlayerStateService.isInQuestionPlayerMode() &&
!this.explorationPlayerStateService.isInDiagnosticTestPlayerMode()
) {
// Navigate the learner to the most recently reached checkpoint state.
this._navigateToMostRecentlyReachedCheckpoint();
Expand Down

0 comments on commit b6175c4

Please sign in to comment.