Test notification dismissal on course listing page
This commit is contained in:
@@ -234,6 +234,7 @@ define([
|
||||
"js/spec/views/pages/group_configurations_spec",
|
||||
"js/spec/views/pages/course_outline_spec",
|
||||
"js/spec/views/pages/course_rerun_spec",
|
||||
"js/spec/views/pages/index_spec",
|
||||
|
||||
"js/spec/views/modals/base_modal_spec",
|
||||
"js/spec/views/modals/edit_xblock_spec",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
require(["domReady", "jquery", "underscore", "js/utils/cancel_on_escape"],
|
||||
define(["domReady", "jquery", "underscore", "js/utils/cancel_on_escape"],
|
||||
function (domReady, $, _, CancelOnEscape) {
|
||||
|
||||
var dismissNotification = function (e) {
|
||||
@@ -172,9 +172,15 @@ require(["domReady", "jquery", "underscore", "js/utils/cancel_on_escape"],
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
domReady(function () {
|
||||
var onReady = function () {
|
||||
$('.new-course-button').bind('click', addNewCourse);
|
||||
$('.dismiss-button').bind('click', dismissNotification);
|
||||
});
|
||||
};
|
||||
|
||||
domReady(onReady);
|
||||
|
||||
return {
|
||||
dismissNotification: dismissNotification,
|
||||
onReady: onReady
|
||||
};
|
||||
});
|
||||
|
||||
24
cms/static/js/spec/views/pages/index_spec.js
Normal file
24
cms/static/js/spec/views/pages/index_spec.js
Normal file
@@ -0,0 +1,24 @@
|
||||
define(["jquery", "js/spec_helpers/create_sinon", "js/spec_helpers/view_helpers", "js/index"],
|
||||
function ($, create_sinon, view_helpers, IndexPage) {
|
||||
describe("Course listing page", function () {
|
||||
var mockIndexPageHTML = readFixtures('mock/mock-index-page.underscore');
|
||||
|
||||
beforeEach(function () {
|
||||
view_helpers.installMockAnalytics();
|
||||
appendSetFixtures(mockIndexPageHTML);
|
||||
IndexPage.onReady();
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
view_helpers.removeMockAnalytics();
|
||||
delete window.source_course_key;
|
||||
});
|
||||
|
||||
|
||||
it("can dismiss notifications", function () {
|
||||
var requests = create_sinon.requests(this);
|
||||
$('.dismiss-button').click();
|
||||
create_sinon.expectJsonRequest(requests, 'DELETE', 'dummy_dismiss_url');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,5 +1,5 @@
|
||||
define(["domReady", "jquery", "underscore", "js/utils/cancel_on_escape"],
|
||||
function (domReady, $, _, CancelOnEscape) {
|
||||
define(["domReady", "jquery", "underscore"],
|
||||
function (domReady, $, _) {
|
||||
|
||||
var saveRerunCourse = function (e) {
|
||||
e.preventDefault();
|
||||
@@ -93,7 +93,6 @@ define(["domReady", "jquery", "underscore", "js/utils/cancel_on_escape"],
|
||||
$courseRun.focus().select();
|
||||
$('.rerun-course-save').on('click', saveRerunCourse);
|
||||
$cancelButton.bind('click', cancelRerunCourse);
|
||||
CancelOnEscape($cancelButton);
|
||||
$('.cancel-button').bind('click', cancelRerunCourse);
|
||||
|
||||
// Check that a course (org, number, run) doesn't use any special characters
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<div id="page-alert">
|
||||
<div class="wrapper wrapper-alert wrapper-alert-announcement is-shown">
|
||||
<div class="alert announcement has-actions">
|
||||
<i class="alert-symbol icon-bullhorn"></i>
|
||||
|
||||
<div class="copy">
|
||||
<h2 class="title title-3">This course was created as a re-run. Some manual configuration is needed.</h2>
|
||||
|
||||
<p>Be sure to review and reset all dates (the Course Start Date was set to January 1, 2030); set up the
|
||||
course team; review course updates and other assets for dated material; and seed the discussions and
|
||||
wiki.</p>
|
||||
</div>
|
||||
|
||||
<ul class="nav-actions">
|
||||
<li class="action action-dismiss">
|
||||
<a href="#" class="button dismiss-button" data-dismiss-link="dummy_dismiss_url">
|
||||
<i class="icon icon-remove-sign"></i>
|
||||
<span class="button-copy">Dimiss</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
168
cms/templates/js/mock/mock-index-page.underscore
Normal file
168
cms/templates/js/mock/mock-index-page.underscore
Normal file
@@ -0,0 +1,168 @@
|
||||
<div class="wrapper-mast wrapper">
|
||||
<header class="mast has-actions">
|
||||
<h1 class="page-header">My Courses</h1>
|
||||
<nav class="nav-actions">
|
||||
<h3 class="sr">Page Actions</h3>
|
||||
<ul>
|
||||
<li class="nav-item">
|
||||
<a href="#" class="button new-button new-course-button"><i class="icon-plus icon-inline"></i>
|
||||
New Course</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
</div>
|
||||
|
||||
<div class="wrapper-content wrapper">
|
||||
<section class="content">
|
||||
<article class="content-primary" role="main">
|
||||
|
||||
<div class="introduction">
|
||||
<h2 class="title">Welcome, user!</h2>
|
||||
<div class="copy">
|
||||
<p>Here are all of the courses you currently have access to in Studio:</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="wrapper-create-element wrapper-create-course">
|
||||
<form class="form-create create-course course-info" id="create-course-form" name="create-course-form">
|
||||
<div class="wrap-error">
|
||||
<div id="course_creation_error" name="course_creation_error" class="message message-status message-status error" role="alert">
|
||||
<p>Please correct the highlighted fields below.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="wrapper-form">
|
||||
<h3 class="title">Create a New Course</h3>
|
||||
|
||||
<fieldset>
|
||||
<legend class="sr">Required Information to Create a New Course</legend>
|
||||
|
||||
<ol class="list-input">
|
||||
<li class="field text required" id="field-course-name">
|
||||
<label for="new-course-name">Course Name</label>
|
||||
<input class="new-course-name" id="new-course-name" type="text" name="new-course-name" aria-required="true" placeholder="e.g. Introduction to Computer Science" />
|
||||
<span class="tip">The public display name for your course. This cannot be changed, but you can set a different display name in Advanced Settings later.</span>
|
||||
<span class="tip tip-error is-hiding"></span>
|
||||
</li>
|
||||
<li class="field text required" id="field-organization">
|
||||
<label for="new-course-org">Organization</label>
|
||||
<input class="new-course-org" id="new-course-org" type="text" name="new-course-org" aria-required="true" placeholder="e.g. UniversityX or OrganizationX" />
|
||||
<span class="tip">The name of the organization sponsoring the course. <strong>Note: This is part of your course URL, so no spaces or special characters are allowed.</strong> This cannot be changed, but you can set a different display name in Advanced Settings later.</span>
|
||||
<span class="tip tip-error is-hiding"></span>
|
||||
</li>
|
||||
|
||||
<li class="field text required" id="field-course-number">
|
||||
<label for="new-course-number">Course Number</label>
|
||||
<input class="new-course-number" id="new-course-number" type="text" name="new-course-number" aria-required="true" placeholder="e.g. CS101" />
|
||||
<span class="tip">The unique number that identifies your course within your organization. <strong>Note: This is part of your course URL, so no spaces or special characters are allowed and it cannot be changed.</strong></span>
|
||||
<span class="tip tip-error is-hiding"></span>
|
||||
</li>
|
||||
|
||||
<li class="field text required" id="field-course-run">
|
||||
<label for="new-course-run">Course Run</label>
|
||||
<input class="new-course-run" id="new-course-run" type="text" name="new-course-run" aria-required="true"placeholder="e.g. 2014_T1" />
|
||||
<span class="tip">The term in which your course will run. <strong>Note: This is part of your course URL, so no spaces or special characters are allowed and it cannot be changed.</strong></span>
|
||||
<span class="tip tip-error is-hiding"></span>
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<input type="hidden" value="true" class="allow-unicode-course-id" />
|
||||
<input type="submit" value="Create" class="action action-primary new-course-save" />
|
||||
<input type="button" value="Cancel" class="action action-secondary action-cancel new-course-cancel" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- STATE: processing courses -->
|
||||
<div class="courses courses-processing">
|
||||
<h3 class="title">Courses Being Processed</h3>
|
||||
|
||||
<ul class="list-courses">
|
||||
<!-- STATE: re-run is processing -->
|
||||
<li class="wrapper-course has-status" data-test-unsucceeded="edX/DM101/2014">
|
||||
<div class="course-item course-rerun is-processing">
|
||||
<div class="course-details" href="#">
|
||||
<h3 class="course-title">Demo Course</h3>
|
||||
|
||||
<div class="course-metadata">
|
||||
<span class="course-org metadata-item">
|
||||
<span class="label">Organization:</span> <span class="value">edX</span>
|
||||
</span>
|
||||
<span class="course-num metadata-item">
|
||||
<span class="label">Course Number:</span>
|
||||
<span class="value">DM101</span>
|
||||
</span>
|
||||
<span class="course-run metadata-item">
|
||||
<span class="label">Course Run:</span> <span class="value">2014</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<dl class="course-status">
|
||||
<dt class="label sr">This re-run processing status:</dt>
|
||||
<dd class="value">
|
||||
<i class="icon icon-refresh icon-spin"></i>
|
||||
<span class="copy">Configuring as re-run</span>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<div class="status-message">
|
||||
<p class="copy">The new course will be added to your course list in 5-10 minutes. Return to this page or refresh it to update the course list. The new course will need some manual configuration.</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<!-- - - - -->
|
||||
|
||||
<!-- STATE: re-run has error -->
|
||||
<li class="wrapper-course has-status" data-test-unsucceeded="edX/DM102/2014">
|
||||
<div class="course-item course-rerun has-error">
|
||||
<div class="course-details" href="#">
|
||||
<h3 class="course-title">Demo Course 2</h3>
|
||||
|
||||
<div class="course-metadata">
|
||||
<span class="course-org metadata-item">
|
||||
<span class="label">Organization:</span> <span class="value">edX</span>
|
||||
</span>
|
||||
<span class="course-num metadata-item">
|
||||
<span class="label">Course Number:</span>
|
||||
<span class="value">DM102</span>
|
||||
</span>
|
||||
<span class="course-run metadata-item">
|
||||
<span class="label">Course Run:</span> <span class="value">2014</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<dl class="course-status">
|
||||
<dt class="label sr">This re-run processing status:</dt>
|
||||
<dd class="value">
|
||||
<i class="icon icon-warning-sign"></i>
|
||||
<span class="copy">Configuration Error</span>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<div class="status-message has-actions">
|
||||
<p class="copy">A system error occurred while your course was being processed. Please go to the original course to try the re-run again, or contact your PM for assistance.</p>
|
||||
|
||||
<ul class="status-actions">
|
||||
<li class="action action-dismiss">
|
||||
<a href="#" class="button dismiss-button" data-dismiss-link="dummy_dismiss_url">
|
||||
<i class="icon icon-remove-sign"></i>
|
||||
<span class="button-copy">Dismiss</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</article>
|
||||
</section>
|
||||
</div>
|
||||
Reference in New Issue
Block a user