diff --git a/cms/djangoapps/contentstore/features/course-updates.feature b/cms/djangoapps/contentstore/features/course-updates.feature index 41ee785db5..bc73479c5f 100644 --- a/cms/djangoapps/contentstore/features/course-updates.feature +++ b/cms/djangoapps/contentstore/features/course-updates.feature @@ -45,3 +45,25 @@ Feature: Course updates When I modify the handout to "
"
+ # Can only do partial text matches because of the quotes with in quotes (and regexp step matching).
+ Then I should see the update "/c4x/MITx/999/asset/my_img.jpg"
+ And I change the update from "/static/my_img.jpg" to "
"
+ Then I should see the update "/c4x/MITx/999/asset/modified.jpg"
+ And when I reload the page
+ Then I should see the update "/c4x/MITx/999/asset/modified.jpg"
+
+ Scenario: Static links are rewritten when previewing handouts
+ Given I have opened a new course in Studio
+ And I go to the course updates page
+ When I modify the handout to "
"
+ Then I see the handout "/c4x/MITx/999/asset/modified.jpg"
+ And when I reload the page
+ Then I see the handout "/c4x/MITx/999/asset/modified.jpg"
diff --git a/cms/djangoapps/contentstore/features/course-updates.py b/cms/djangoapps/contentstore/features/course-updates.py
index f431af9cf5..3278805a48 100644
--- a/cms/djangoapps/contentstore/features/course-updates.py
+++ b/cms/djangoapps/contentstore/features/course-updates.py
@@ -38,6 +38,16 @@ def modify_update(_step, text):
change_text(text)
+@step(u'I change the update from "([^"]*)" to "([^"]*)"$')
+def change_existing_update(_step, before, after):
+ verify_text_in_editor_and_update('div.post-preview a.edit-button', before, after)
+
+
+@step(u'I change the handout from "([^"]*)" to "([^"]*)"$')
+def change_existing_handout(_step, before, after):
+ verify_text_in_editor_and_update('div.course-handouts a.edit-button', before, after)
+
+
@step(u'I delete the update$')
def click_button(_step):
button_css = 'div.post-preview a.delete-button'
@@ -80,3 +90,10 @@ def change_text(text):
type_in_codemirror(0, text)
save_css = 'a.save-button'
world.css_click(save_css)
+
+
+def verify_text_in_editor_and_update(button_css, before, after):
+ world.css_click(button_css)
+ text = world.css_find(".cm-string").html
+ assert before in text
+ change_text(after)
diff --git a/cms/djangoapps/contentstore/views/course.py b/cms/djangoapps/contentstore/views/course.py
index aad56e4a2e..939286a765 100644
--- a/cms/djangoapps/contentstore/views/course.py
+++ b/cms/djangoapps/contentstore/views/course.py
@@ -18,6 +18,7 @@ from mitxmako.shortcuts import render_to_response
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.inheritance import own_metadata
+from xmodule.contentstore.content import StaticContent
from xmodule.modulestore.exceptions import (
ItemNotFoundError, InvalidLocationError)
@@ -206,7 +207,8 @@ def course_info(request, org, course, name, provided_id=None):
'context_course': course_module,
'url_base': "/" + org + "/" + course + "/",
'course_updates': json.dumps(get_course_updates(location)),
- 'handouts_location': Location(['i4x', org, course, 'course_info', 'handouts']).url() })
+ 'handouts_location': Location(['i4x', org, course, 'course_info', 'handouts']).url(),
+ 'base_asset_url': StaticContent.get_base_url_path_for_course_assets(location) + '/'})
@expect_json
diff --git a/cms/envs/common.py b/cms/envs/common.py
index 29e99b2551..3e3b642b36 100644
--- a/cms/envs/common.py
+++ b/cms/envs/common.py
@@ -246,7 +246,7 @@ PIPELINE_JS = {
'js/models/metadata_model.js', 'js/views/metadata_editor_view.js',
'js/models/uploads.js', 'js/views/uploads.js',
'js/models/textbook.js', 'js/views/textbook.js',
- 'js/views/assets.js', 'js/utility.js',
+ 'js/views/assets.js', 'js/src/utility.js',
'js/models/settings/course_grading_policy.js'],
'output_filename': 'js/cms-application.js',
'test_order': 0
diff --git a/cms/static/coffee/spec/views/course_info_spec.coffee b/cms/static/coffee/spec/views/course_info_spec.coffee
new file mode 100644
index 0000000000..297e78f34a
--- /dev/null
+++ b/cms/static/coffee/spec/views/course_info_spec.coffee
@@ -0,0 +1,144 @@
+courseInfoPage = """
+