Merge branch 'MDL-53752-master' of git://github.com/andrewnicols/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2016-10-18 19:06:26 +02:00
commit 881e611c33
5 changed files with 42 additions and 42 deletions

View file

@ -154,7 +154,7 @@ function book_get_chapter_title($chid, $chapters, $book, $context) {
} }
if ($numbers) { if ($numbers) {
$title = implode('.', $numbers).' '.$title; $title = implode('.', $numbers) . '. ' . $title;
} }
return $title; return $title;
@ -241,12 +241,12 @@ function book_get_toc($chapters, $chapter, $book, $cm, $edit) {
$nch++; $nch++;
$ns = 0; $ns = 0;
if ($book->numbering == BOOK_NUM_NUMBERS) { if ($book->numbering == BOOK_NUM_NUMBERS) {
$title = "$nch $title"; $title = "$nch. $title";
$titleout = $title; $titleout = $title;
} }
} else { } else {
if ($book->numbering == BOOK_NUM_NUMBERS) { if ($book->numbering == BOOK_NUM_NUMBERS) {
$title = "x $title"; $title = "x. $title";
} }
$titleout = html_writer::tag('span', $title, array('class' => 'dimmed_text')); $titleout = html_writer::tag('span', $title, array('class' => 'dimmed_text'));
} }
@ -263,15 +263,15 @@ function book_get_toc($chapters, $chapter, $book, $cm, $edit) {
if (!$ch->hidden) { if (!$ch->hidden) {
$ns++; $ns++;
if ($book->numbering == BOOK_NUM_NUMBERS) { if ($book->numbering == BOOK_NUM_NUMBERS) {
$title = "$nch.$ns $title"; $title = "$nch.$ns. $title";
$titleout = $title; $titleout = $title;
} }
} else { } else {
if ($book->numbering == BOOK_NUM_NUMBERS) { if ($book->numbering == BOOK_NUM_NUMBERS) {
if (empty($chapters[$ch->parent]->hidden)) { if (empty($chapters[$ch->parent]->hidden)) {
$title = "$nch.x $title"; $title = "$nch.x. $title";
} else { } else {
$title = "x.x $title"; $title = "x.x. $title";
} }
} }
$titleout = html_writer::tag('span', $title, array('class' => 'dimmed_text')); $titleout = html_writer::tag('span', $title, array('class' => 'dimmed_text'));
@ -346,7 +346,7 @@ function book_get_toc($chapters, $chapter, $book, $cm, $edit) {
} }
if ($book->numbering == BOOK_NUM_NUMBERS) { if ($book->numbering == BOOK_NUM_NUMBERS) {
$title = "$nch $title"; $title = "$nch. $title";
} }
} else { } else {
$ns++; $ns++;
@ -360,7 +360,7 @@ function book_get_toc($chapters, $chapter, $book, $cm, $edit) {
} }
if ($book->numbering == BOOK_NUM_NUMBERS) { if ($book->numbering == BOOK_NUM_NUMBERS) {
$title = "$nch.$ns $title"; $title = "$nch.$ns. $title";
} }
} }
if ($ch->id == $chapter->id) { if ($ch->id == $chapter->id) {

View file

@ -28,37 +28,37 @@ Feature: In a book, create chapters and sub chapters
| Chapter title | Dummy first chapter | | Chapter title | Dummy first chapter |
| Content | Dream is the start of a journey | | Content | Dream is the start of a journey |
And I press "Save changes" And I press "Save changes"
And I should see "1 Dummy first chapter" in the "Table of contents" "block" And I should see "1. Dummy first chapter" in the "Table of contents" "block"
And I click on "Add new chapter" "link" in the "Table of contents" "block" And I click on "Add new chapter" "link" in the "Table of contents" "block"
And I set the following fields to these values: And I set the following fields to these values:
| Chapter title | Dummy second chapter | | Chapter title | Dummy second chapter |
| Content | The path is the second part | | Content | The path is the second part |
And I press "Save changes" And I press "Save changes"
And I should see "2 Dummy second chapter" in the "Table of contents" "block" And I should see "2. Dummy second chapter" in the "Table of contents" "block"
And I click on "Add new chapter" "link" in the "Table of contents" "block" And I click on "Add new chapter" "link" in the "Table of contents" "block"
And I set the following fields to these values: And I set the following fields to these values:
| Chapter title | Dummy first subchapter | | Chapter title | Dummy first subchapter |
| Content | The path is the second part | | Content | The path is the second part |
| Subchapter | true | | Subchapter | true |
And I press "Save changes" And I press "Save changes"
And I should see "1.1 Dummy first subchapter" in the "Table of contents" "block" And I should see "1.1. Dummy first subchapter" in the "Table of contents" "block"
And I should see "1 Dummy first chapter" in the ".book_content" "css_element" And I should see "1. Dummy first chapter" in the ".book_content" "css_element"
And I should see "1.1 Dummy first subchapter" in the ".book_content" "css_element" And I should see "1.1. Dummy first subchapter" in the ".book_content" "css_element"
And I click on "Next" "link" And I click on "Next" "link"
And I should see "2 Dummy second chapter" in the ".book_content" "css_element" And I should see "2. Dummy second chapter" in the ".book_content" "css_element"
And I should see "2 Dummy second chapter" in the "strong" "css_element" And I should see "2. Dummy second chapter" in the "strong" "css_element"
And I should not see "Next" in the ".book_content" "css_element" And I should not see "Next" in the ".book_content" "css_element"
And I click on "Exit book" "link" And I click on "Exit book" "link"
And I should see "Test book" in the "Topic 1" "section" And I should see "Test book" in the "Topic 1" "section"
And I follow "Test book" And I follow "Test book"
And I should not see "Previous" in the ".book_content" "css_element" And I should not see "Previous" in the ".book_content" "css_element"
And I should see "1 Dummy first chapter" in the "strong" "css_element" And I should see "1. Dummy first chapter" in the "strong" "css_element"
When I click on "Next" "link" When I click on "Next" "link"
Then I should see "1.1 Dummy first subchapter" in the ".book_content" "css_element" Then I should see "1.1. Dummy first subchapter" in the ".book_content" "css_element"
And I should see "1.1 Dummy first subchapter" in the "strong" "css_element" And I should see "1.1. Dummy first subchapter" in the "strong" "css_element"
And I click on "Previous" "link" And I click on "Previous" "link"
And I should see "1 Dummy first chapter" in the ".book_content" "css_element" And I should see "1. Dummy first chapter" in the ".book_content" "css_element"
And I should see "1 Dummy first chapter" in the "strong" "css_element" And I should see "1. Dummy first chapter" in the "strong" "css_element"
Scenario: Change editing mode for an individual chapter Scenario: Change editing mode for an individual chapter
Given I follow "Test book" Given I follow "Test book"
@ -67,13 +67,13 @@ Feature: In a book, create chapters and sub chapters
| Chapter title | Dummy first chapter | | Chapter title | Dummy first chapter |
| Content | Dream is the start of a journey | | Content | Dream is the start of a journey |
And I press "Save changes" And I press "Save changes"
And I should see "1 Dummy first chapter" in the "Table of contents" "block" And I should see "1. Dummy first chapter" in the "Table of contents" "block"
And "Edit chapter \"1 Dummy first chapter\"" "link" should exist in the "Table of contents" "block" And "Edit chapter \"1. Dummy first chapter\"" "link" should exist in the "Table of contents" "block"
And "Delete chapter \"1 Dummy first chapter\"" "link" should exist in the "Table of contents" "block" And "Delete chapter \"1. Dummy first chapter\"" "link" should exist in the "Table of contents" "block"
And "Hide chapter \"1 Dummy first chapter\"" "link" should exist in the "Table of contents" "block" And "Hide chapter \"1. Dummy first chapter\"" "link" should exist in the "Table of contents" "block"
And "Add new chapter" "link" should exist in the "Table of contents" "block" And "Add new chapter" "link" should exist in the "Table of contents" "block"
When I click on "Turn editing off" "link" in the "Administration" "block" When I click on "Turn editing off" "link" in the "Administration" "block"
Then "Edit chapter \"1 Dummy first chapter\"" "link" should not exist in the "Table of contents" "block" Then "Edit chapter \"1. Dummy first chapter\"" "link" should not exist in the "Table of contents" "block"
And "Delete chapter \"1 Dummy first chapter\"" "link" should not exist in the "Table of contents" "block" And "Delete chapter \"1. Dummy first chapter\"" "link" should not exist in the "Table of contents" "block"
And "Hide chapter \"1 Dummy first chapter\"" "link" should not exist in the "Table of contents" "block" And "Hide chapter \"1. Dummy first chapter\"" "link" should not exist in the "Table of contents" "block"
And "Add new chapter" "link" should not exist in the "Table of contents" "block" And "Add new chapter" "link" should not exist in the "Table of contents" "block"

View file

@ -30,27 +30,27 @@ Feature: In a book, change the navigation options
| Content | Lorem ipsum dolor sit amet | | Content | Lorem ipsum dolor sit amet |
And I press "Save changes" And I press "Save changes"
And I should see "Test book" And I should see "Test book"
And I should see "1 Test chapter 1" And I should see "1. Test chapter 1"
And I click on "Add new chapter" "link" in the "Table of contents" "block" And I click on "Add new chapter" "link" in the "Table of contents" "block"
And I set the following fields to these values: And I set the following fields to these values:
| Chapter title | Test chapter 2 | | Chapter title | Test chapter 2 |
| Content | consectetur adipiscing elit | | Content | consectetur adipiscing elit |
And I press "Save changes" And I press "Save changes"
And I should see "Test book" And I should see "Test book"
And I should see "2 Test chapter 2" And I should see "2. Test chapter 2"
And I click on "1 Test chapter 1" "link" in the "Table of contents" "block" And I click on "1. Test chapter 1" "link" in the "Table of contents" "block"
And "Next" "link" should not exist And "Next" "link" should not exist
And I click on "2 Test chapter 2" "link" in the "Table of contents" "block" And I click on "2. Test chapter 2" "link" in the "Table of contents" "block"
And "Previous" "link" should not exist And "Previous" "link" should not exist
And I click on "Edit settings" "link" in the "Administration" "block" And I click on "Edit settings" "link" in the "Administration" "block"
And I set the field "Style of navigation" to "Images" And I set the field "Style of navigation" to "Images"
And I press "Save and display" And I press "Save and display"
And "//a/child::img[contains(@src, 'nav_next')]" "xpath_element" should exist And "//a/child::img[contains(@src, 'nav_next')]" "xpath_element" should exist
And I click on "2 Test chapter 2" "link" in the "Table of contents" "block" And I click on "2. Test chapter 2" "link" in the "Table of contents" "block"
And "//a/child::img[contains(@src, 'nav_prev')]" "xpath_element" should exist And "//a/child::img[contains(@src, 'nav_prev')]" "xpath_element" should exist
When I click on "Edit settings" "link" in the "Administration" "block" When I click on "Edit settings" "link" in the "Administration" "block"
And I set the field "Style of navigation" to "Text" And I set the field "Style of navigation" to "Text"
And I press "Save and display" And I press "Save and display"
Then "Next" "link" should exist Then "Next" "link" should exist
And I click on "2 Test chapter 2" "link" in the "Table of contents" "block" And I click on "2. Test chapter 2" "link" in the "Table of contents" "block"
And "Previous" "link" should exist And "Previous" "link" should exist

View file

@ -47,21 +47,21 @@ Feature: In a book, verify log entries
And I should see "Chapter created" in the "#report_log_r9_c5" "css_element" And I should see "Chapter created" in the "#report_log_r9_c5" "css_element"
And I click on "Chapter viewed" "link" in the "#report_log_r2_c5" "css_element" And I click on "Chapter viewed" "link" in the "#report_log_r2_c5" "css_element"
And I switch to "action" window And I switch to "action" window
And I should see "1 First chapter edited" in the ".book_content" "css_element" And I should see "1. First chapter edited" in the ".book_content" "css_element"
And I switch to the main window And I switch to the main window
And I click on "Chapter viewed" "link" in the "#report_log_r3_c5" "css_element" And I click on "Chapter viewed" "link" in the "#report_log_r3_c5" "css_element"
And I switch to "action" window And I switch to "action" window
And I should see "2 Second chapter" in the ".book_content" "css_element" And I should see "2. Second chapter" in the ".book_content" "css_element"
And I switch to the main window And I switch to the main window
And I click on "Chapter updated" "link" in the "#report_log_r5_c5" "css_element" And I click on "Chapter updated" "link" in the "#report_log_r5_c5" "css_element"
And I switch to "action" window And I switch to "action" window
And I should see "1 First chapter edited" in the ".book_content" "css_element" And I should see "1. First chapter edited" in the ".book_content" "css_element"
And I switch to the main window And I switch to the main window
And I click on "Chapter created" "link" in the "#report_log_r7_c5" "css_element" And I click on "Chapter created" "link" in the "#report_log_r7_c5" "css_element"
And I switch to "action" window And I switch to "action" window
And I should see "2 Second chapter" in the ".book_content" "css_element" And I should see "2. Second chapter" in the ".book_content" "css_element"
And I switch to the main window And I switch to the main window
And I click on "Chapter created" "link" in the "#report_log_r9_c5" "css_element" And I click on "Chapter created" "link" in the "#report_log_r9_c5" "css_element"
And I switch to "action" window And I switch to "action" window
And I should see "1 First chapter edited" in the ".book_content" "css_element" And I should see "1. First chapter edited" in the ".book_content" "css_element"
And I switch to the main window And I switch to the main window

View file

@ -50,8 +50,8 @@ Feature: Book activity chapter visibility management
@javascript @javascript
Scenario: Show/hide chapters and subchapters Scenario: Show/hide chapters and subchapters
When I follow "Hide chapter \"2 Second chapter\"" When I follow "Hide chapter \"2. Second chapter\""
And I follow "Hide chapter \"2 Third chapter\"" And I follow "Hide chapter \"2. Third chapter\""
And I follow "Turn editing off" And I follow "Turn editing off"
And I am on homepage And I am on homepage
And I follow "Course 1" And I follow "Course 1"