Run phpunit tests
Log in as admin
Navigate to Site admin > Appearance > AJAX and JavaScript
Uncheck "Enable AJAX" and save settings
Navigate to a course or create a new one
Edit the course settings and set the course format to Topics
Add some content to sections so you can track their movement
Highlight a section somewhere in the middle
Click the up icon to shift the highlighted section up
VERIFY: highlighted section is moved up
Click the down icon to shift the highlighted section down
VERIFY: highlighted section is moved down
Navigate to Site admin > Appearance > AJAX and JavaScript
Check "Enable AJAX" and save settings
Navigate to the same course
Drag the highlighted course section up
VERIFY: turn editing off and verify that the highlighted section has moved
Drag the highlighted course section down
VERIFY: turn editing off and verify that the highlighted section has moved
Drag the a non-highlighted section from below the highlighted section to a place above it
VERIFY: turn editing off and verify that the highlighted section has now changed, it is the same section.
Drag the a non-highlighted section from above the highlighted section to a place below it
VERIFY: turn editing off and verify that the highlighted section has now changed, it is the same section.

Description

I discovered a peculiar error when shifting sections while testing. When I highlighted a section and shifted that section up, the highlighting shifted to the section that took its place (formerly above, now below). When I shifted a highlighted section down, the highlighting stayed with the topic section. This seems to happen only with AJAX turned off.

This reminded me of a case that Raj mentioned recently where unit tests were only testing section moving in one direction, but not the other. It might be worth checking the unit tests for this as well.

Replication steps:

Log in as admin

Navigate to Site admin > Appearance > AJAX and JavaScript

Uncheck "Enable AJAX" and save settings

Navigate to a course or create a new one

Edit the course settings and set the course format to Topics

Add some content to sections so you can track their movement

Highlight a section somewhere in the middle

Click the up icon to shift the highlighted section up

Click the down icon to shift the highlighted section down

Navigate to Site admin > Appearance > AJAX and JavaScript

Check "Enable AJAX" and save settings

Navigate to the same course

Drag the highlighted course section up

Drag the highlighted course section down

Expected result: The highlighting stays with the same topic section

Actual result: When moving the highlighted section upwards, with AJAX off, highlighting shifts to another section

I discovered a peculiar error when shifting sections while testing. When I highlighted a section and shifted that section up, the highlighting shifted to the section that took its place (formerly above, now below). When I shifted a highlighted section down, the highlighting stayed with the topic section. This seems to happen with AJAX turned on or off.

This reminded me of a case that Raj mentioned recently where unit tests were only testing section moving in one direction, but not the other. It might be worth checking the unit tests for this as well.

*Replication steps:*
# Log in as admin
# Navigate to Site admin > Appearance > AJAX and JavaScript
# Uncheck "Enable AJAX" and save settings
# Navigate to a course or create a new one
# Edit the course settings and set the course format to Topics
# Add some content to sections so you can track their movement
# Highlight a section somewhere in the middle
# Click the up icon to shift the highlighted section up
# Click the down icon to shift the highlighted section down
# Navigate to Site admin > Appearance > AJAX and JavaScript
# Check "Enable AJAX" and save settings
# Navigate to the same course
# Drag the highlighted course section up
# Drag the highlighted course section down

Expected result: The highlighting stays with the same topic section

Actual result: When moving the highlighted section upwards, highlighting shifts to another section

I discovered a peculiar error when shifting sections while testing. When I highlighted a section and shifted that section up, the highlighting shifted to the section that took its place (formerly above, now below). When I shifted a highlighted section down, the highlighting stayed with the topic section. This seems to happen only with AJAX turned off.

This reminded me of a case that Raj mentioned recently where unit tests were only testing section moving in one direction, but not the other. It might be worth checking the unit tests for this as well.

*Replication steps:*
# Log in as admin
# Navigate to Site admin > Appearance > AJAX and JavaScript
# Uncheck "Enable AJAX" and save settings
# Navigate to a course or create a new one
# Edit the course settings and set the course format to Topics
# Add some content to sections so you can track their movement
# Highlight a section somewhere in the middle
# Click the up icon to shift the highlighted section up
# Click the down icon to shift the highlighted section down
# Navigate to Site admin > Appearance > AJAX and JavaScript
# Check "Enable AJAX" and save settings
# Navigate to the same course
# Drag the highlighted course section up
# Drag the highlighted course section down

Expected result: The highlighting stays with the same topic section

Actual result: When moving the highlighted section upwards, with AJAX off, highlighting shifts to another section

Hmm, well this is very weird because it seemed to be a line of code doing exactly the wrong thing. I've pondered for a while if i'm missing something, but I don't think I am. I expect it was made incorrect by the changes in MDL-33212.

I have added unit tests to prove my theories in moving sections and ensuring the marker is kept correctly.

Dan Poltawski
added a comment - 11/Jun/12 11:50 AM Hmm, well this is very weird because it seemed to be a line of code doing exactly the wrong thing. I've pondered for a while if i'm missing something, but I don't think I am. I expect it was made incorrect by the changes in MDL-33212 .
I have added unit tests to prove my theories in moving sections and ensuring the marker is kept correctly.

# Log in as admin
# Navigate to Site admin > Appearance > AJAX and JavaScript
# Uncheck "Enable AJAX" and save settings
# Navigate to a course or create a new one
# Edit the course settings and set the course format to Topics
# Add some content to sections so you can track their movement
# Highlight a section somewhere in the middle
# Click the up icon to shift the highlighted section up
# VERIFY: highlighted section is moved up
# Click the down icon to shift the highlighted section down
# VERIFY: highlighted section is moved down
# Navigate to Site admin > Appearance > AJAX and JavaScript
# Check "Enable AJAX" and save settings
# Navigate to the same course
# Drag the highlighted course section up
# VERIFY: turn editing off and verify that the highlighted section has moved
# Drag the highlighted course section down
# VERIFY: turn editing off and verify that the highlighted section has moved
# Drag the a non-highlighted section from below the highlighted section to a place above it
# VERIFY: turn editing off and verify that the highlighted section has now changed, it is the same section.
# Drag the a non-highlighted section from above the highlighted section to a place below it
# VERIFY: turn editing off and verify that the highlighted section has now changed, it is the same section.

# Log in as admin
# Navigate to Site admin > Appearance > AJAX and JavaScript
# Uncheck "Enable AJAX" and save settings
# Navigate to a course or create a new one
# Edit the course settings and set the course format to Topics
# Add some content to sections so you can track their movement
# Highlight a section somewhere in the middle
# Click the up icon to shift the highlighted section up
# VERIFY: highlighted section is moved up
# Click the down icon to shift the highlighted section down
# VERIFY: highlighted section is moved down
# Navigate to Site admin > Appearance > AJAX and JavaScript
# Check "Enable AJAX" and save settings
# Navigate to the same course
# Drag the highlighted course section up
# VERIFY: turn editing off and verify that the highlighted section has moved
# Drag the highlighted course section down
# VERIFY: turn editing off and verify that the highlighted section has moved
# Drag the a non-highlighted section from below the highlighted section to a place above it
# VERIFY: turn editing off and verify that the highlighted section has now changed, it is the same section.
# Drag the a non-highlighted section from above the highlighted section to a place below it
# VERIFY: turn editing off and verify that the highlighted section has now changed, it is the same section.

# Run phpunit tests

# Log in as admin
# Navigate to Site admin > Appearance > AJAX and JavaScript
# Uncheck "Enable AJAX" and save settings
# Navigate to a course or create a new one
# Edit the course settings and set the course format to Topics
# Add some content to sections so you can track their movement
# Highlight a section somewhere in the middle
# Click the up icon to shift the highlighted section up
# VERIFY: highlighted section is moved up
# Click the down icon to shift the highlighted section down
# VERIFY: highlighted section is moved down
# Navigate to Site admin > Appearance > AJAX and JavaScript
# Check "Enable AJAX" and save settings
# Navigate to the same course
# Drag the highlighted course section up
# VERIFY: turn editing off and verify that the highlighted section has moved
# Drag the highlighted course section down
# VERIFY: turn editing off and verify that the highlighted section has moved
# Drag the a non-highlighted section from below the highlighted section to a place above it
# VERIFY: turn editing off and verify that the highlighted section has now changed, it is the same section.
# Drag the a non-highlighted section from above the highlighted section to a place below it
# VERIFY: turn editing off and verify that the highlighted section has now changed, it is the same section.

Eloy Lafuente (stronk7)
added a comment - 25/Jun/12 12:42 AM And this has been incorporated to all the weekly builds and also, to Moodle 2.3 Release Candidate 1, yay!
Many, many thanks for your hard work!
Ciao