This repository has been archived by the owner on Jan 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
George Schneeloch
committed
Nov 3, 2015
1 parent
19ff0a6
commit 73cbb55
Showing
20 changed files
with
2,123 additions
and
1,709 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
define(['QUnit', 'jquery', 'lr_exports', 'react', 'test_utils'], | ||
function (QUnit, $, Exports, React, TestUtils) { | ||
'use strict'; | ||
|
||
QUnit.module('Test exports', { | ||
beforeEach: function () { | ||
TestUtils.setup(); | ||
TestUtils.initMockjax({ | ||
url: '/api/v1/repositories/repo/learning_resource_exports/user/', | ||
type: 'GET', | ||
responseText: { | ||
"count": 1, | ||
"next": null, | ||
"previous": null, | ||
"results": [{"id": 123}] | ||
} | ||
}); | ||
}, | ||
afterEach: function () { | ||
TestUtils.cleanup(); | ||
} | ||
}); | ||
|
||
QUnit.test( | ||
'Verify exports panel header renders properly', | ||
function (assert) { | ||
var container = document.createElement("div"); | ||
Exports.loadExportsHeader(0, container); | ||
assert.equal(1, $(container).children().size()); | ||
assert.equal("Export", $(container).text().trim()); | ||
Exports.loadExportsHeader(3, container); | ||
assert.equal(1, $(container).children().size()); | ||
assert.equal("Export (3)", $(container).text().trim()); | ||
} | ||
); | ||
|
||
QUnit.test("Test resource export panel renders into div", | ||
function (assert) { | ||
var container = document.createElement("div"); | ||
|
||
assert.equal(0, $(container).find("div").size()); | ||
Exports.loader("repo", "user", function () { | ||
}, container); | ||
assert.equal(1, $(container).find("div").size()); | ||
} | ||
); | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
define( | ||
['QUnit', 'test_utils', 'jquery', 'react', 'lodash', 'learning_resources', | ||
'jquery_mockjax'], | ||
function (QUnit, TestUtils, $, React, _, LearningResources) { | ||
'use strict'; | ||
|
||
var learningResourceResponse = { | ||
"id": 1, | ||
"learning_resource_type": "course", | ||
"static_assets": [], | ||
"title": "title", | ||
"materialized_path": "/course", | ||
"content_xml": "<course />", | ||
"url_path": "", | ||
"parent": null, | ||
"copyright": "", | ||
"xa_nr_views": 0, | ||
"xa_nr_attempts": 0, | ||
"xa_avg_grade": 0.0, | ||
"xa_histogram_grade": 0.0, | ||
"terms": ["required"] | ||
}; | ||
var learningResourceResponseMinusContentXml = $.extend( | ||
{}, learningResourceResponse); | ||
delete learningResourceResponseMinusContentXml.content_xml; | ||
|
||
QUnit.module('Test learning resource', { | ||
beforeEach: function() { | ||
TestUtils.setup(); | ||
TestUtils.initMockjax({ | ||
url: '/api/v1/repositories/repo/learning_resources/' + | ||
'1/?remove_content_xml=true', | ||
type: 'GET', | ||
responseText: learningResourceResponseMinusContentXml | ||
}); | ||
}, | ||
afterEach: function() { | ||
TestUtils.cleanup(); | ||
} | ||
}); | ||
|
||
QUnit.test( | ||
"LearningResourcePanel.loader should populate its stuff", | ||
function (assert) { | ||
var div = document.createElement("div"); | ||
assert.ok($(div).html().length === 0); | ||
LearningResources.loader("repo", "1", function () { | ||
}, function () { | ||
}, div); | ||
assert.ok($(div).html().length > 0); | ||
} | ||
); | ||
}); |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.