Skip to content
Permalink
Browse files

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

  • Loading branch information...
stronk7 committed Oct 18, 2016
2 parents 3fdbba0 + 4f1f2a3 commit 881e611c33f7411164dcae151467aba826ec374b
@@ -154,7 +154,7 @@ function book_get_chapter_title($chid, $chapters, $book, $context) {
}
if ($numbers) {
$title = implode('.', $numbers).' '.$title;
$title = implode('.', $numbers) . '. ' . $title;
}
return $title;
@@ -241,12 +241,12 @@ function book_get_toc($chapters, $chapter, $book, $cm, $edit) {
$nch++;
$ns = 0;
if ($book->numbering == BOOK_NUM_NUMBERS) {
$title = "$nch $title";
$title = "$nch. $title";
$titleout = $title;
}
} else {
if ($book->numbering == BOOK_NUM_NUMBERS) {
$title = "x $title";
$title = "x. $title";
}
$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) {
$ns++;
if ($book->numbering == BOOK_NUM_NUMBERS) {
$title = "$nch.$ns $title";
$title = "$nch.$ns. $title";
$titleout = $title;
}
} else {
if ($book->numbering == BOOK_NUM_NUMBERS) {
if (empty($chapters[$ch->parent]->hidden)) {
$title = "$nch.x $title";
$title = "$nch.x. $title";
} else {
$title = "x.x $title";
$title = "x.x. $title";
}
}
$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) {
$title = "$nch $title";
$title = "$nch. $title";
}
} else {
$ns++;
@@ -360,7 +360,7 @@ function book_get_toc($chapters, $chapter, $book, $cm, $edit) {
}
if ($book->numbering == BOOK_NUM_NUMBERS) {
$title = "$nch.$ns $title";
$title = "$nch.$ns. $title";
}
}
if ($ch->id == $chapter->id) {
@@ -28,37 +28,37 @@ Feature: In a book, create chapters and sub chapters
| Chapter title | Dummy first chapter |
| Content | Dream is the start of a journey |
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 set the following fields to these values:
| Chapter title | Dummy second chapter |
| Content | The path is the second part |
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 set the following fields to these values:
| Chapter title | Dummy first subchapter |
| Content | The path is the second part |
| Subchapter | true |
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 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 "Table of contents" "block"
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 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 "strong" "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 not see "Next" in the ".book_content" "css_element"
And I click on "Exit book" "link"
And I should see "Test book" in the "Topic 1" "section"
And I follow "Test book"
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"
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"
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 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 "strong" "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"

Scenario: Change editing mode for an individual chapter
Given I follow "Test book"
@@ -67,13 +67,13 @@ Feature: In a book, create chapters and sub chapters
| Chapter title | Dummy first chapter |
| Content | Dream is the start of a journey |
And I press "Save changes"
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 "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 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 "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 "Add new chapter" "link" should exist in the "Table of contents" "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"
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 "Add new 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 "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"
@@ -30,27 +30,27 @@ Feature: In a book, change the navigation options
| Content | Lorem ipsum dolor sit amet |
And I press "Save changes"
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 set the following fields to these values:
| Chapter title | Test chapter 2 |
| Content | consectetur adipiscing elit |
And I press "Save changes"
And I should see "Test book"
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 should see "2. Test chapter 2"
And I click on "1. Test chapter 1" "link" in the "Table of contents" "block"
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 I click on "Edit settings" "link" in the "Administration" "block"
And I set the field "Style of navigation" to "Images"
And I press "Save and display"
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
When I click on "Edit settings" "link" in the "Administration" "block"
And I set the field "Style of navigation" to "Text"
And I press "Save and display"
Then "Next" "link" should exist
And I click on "2 Test chapter 2" "link" in the "Table of contents" "block"
And "Previous" "link" should exist
And I click on "2. Test chapter 2" "link" in the "Table of contents" "block"
And "Previous" "link" should exist
@@ -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 click on "Chapter viewed" "link" in the "#report_log_r2_c5" "css_element"
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 click on "Chapter viewed" "link" in the "#report_log_r3_c5" "css_element"
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 click on "Chapter updated" "link" in the "#report_log_r5_c5" "css_element"
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 click on "Chapter created" "link" in the "#report_log_r7_c5" "css_element"
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 click on "Chapter created" "link" in the "#report_log_r9_c5" "css_element"
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
@@ -50,8 +50,8 @@ Feature: Book activity chapter visibility management

@javascript
Scenario: Show/hide chapters and subchapters
When I follow "Hide chapter \"2 Second chapter\""
And I follow "Hide chapter \"2 Third chapter\""
When I follow "Hide chapter \"2. Second chapter\""
And I follow "Hide chapter \"2. Third chapter\""
And I follow "Turn editing off"
And I am on homepage
And I follow "Course 1"

0 comments on commit 881e611

Please sign in to comment.
You can’t perform that action at this time.