Commit e851c8e5 authored by Akihiro Ota's avatar Akihiro Ota Committed by Commit Bot

ChromeVox Tutorial: Directly load lesson.

This change immediately shows a lesson if it is the only one in its
curriculum. For example, if I'm on the main menu of the tutorial and
choose 'Resources' (which only has one lesson), then we should show the
lesson instead of the 'All lessons' page.

This change also adds a test to confirm behavior and visibility of
relevant buttons.

This change is motivated by UXR feedback.

Fixed: 1142051
AX-Relnotes: N/A
Change-Id: Ie074a9e8597d4143edc9bee08ee1b6c03a15360d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2527346
Commit-Queue: Akihiro Ota <akihiroota@chromium.org>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826568}
parent a0b24e39
......@@ -443,9 +443,15 @@ Polymer({
/** @private */
showLessonMenu() {
this.activeScreen = Screen.LESSON_MENU;
this.createLessonShortcuts();
this.$.lessonMenuHeader.focus();
if (this.includedLessons.length === 1) {
// If there's only one lesson, immediately show it.
this.showLesson(0);
this.activeScreen = Screen.LESSON;
} else {
this.activeScreen = Screen.LESSON_MENU;
this.createLessonShortcuts();
this.$.lessonMenuHeader.focus();
}
},
/** @private */
......@@ -532,7 +538,8 @@ Polymer({
shouldHideLessonMenuButton(activeScreen) {
return !this.curriculum || this.curriculum === Curriculum.NONE ||
activeScreen === Screen.MAIN_MENU ||
activeScreen === Screen.LESSON_MENU;
activeScreen === Screen.LESSON_MENU ||
this.includedLessons.length === 1;
},
/**
......
......@@ -605,3 +605,38 @@ TEST_F('ChromeVoxTutorialTest', 'ResourcesTest', function() {
.replay();
});
});
// Tests that choosing a curriculum with only 1 lesson automatically opens the
// lesson.
TEST_F('ChromeVoxTutorialTest', 'OnlyLessonTest', function() {
const mockFeedback = this.createMockFeedback();
this.runWithLoadedTree(this.simpleDoc, async function(root) {
await this.launchAndWaitForTutorial();
const tutorial = this.getPanel().iTutorial;
mockFeedback.expectSpeech('ChromeVox tutorial')
.call(doCmd('nextObject'))
.expectSpeech('Quick orientation')
.call(doCmd('nextObject'))
.expectSpeech('Essential keys')
.call(doCmd('nextObject'))
.expectSpeech('Navigation')
.call(doCmd('nextObject'))
.expectSpeech('Command references')
.call(doCmd('nextObject'))
.expectSpeech('Sounds and settings')
.call(doCmd('nextObject'))
.expectSpeech('Resources')
.call(doCmd('forceClickOnCurrentItem'))
.expectSpeech('Learn More', 'Heading 1')
.expectSpeech(
' Press Search + Right Arrow, or Search + Left Arrow to' +
' navigate this lesson ')
// The 'All lessons' button should be hidden since this is the only
// lesson for the curriculum.
.call(doCmd('nextButton'))
.expectSpeech('Main menu')
.call(doCmd('nextButton'))
.expectSpeech('Exit tutorial')
.replay();
});
});
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment