Skip to content
This repository has been archived by the owner on Jan 28, 2020. It is now read-only.

Commit

Permalink
Merge pull request #821 from mitodl/refactor/gs/move_react_components
Browse files Browse the repository at this point in the history
Moved React components to separate files in new directories
  • Loading branch information
George Schneeloch committed Nov 3, 2015
2 parents b10eb81 + ff86fb2 commit fbdc00c
Show file tree
Hide file tree
Showing 60 changed files with 7,293 additions and 6,221 deletions.
970 changes: 970 additions & 0 deletions ui/jstests/exports/test_exports_component.jsx

Large diffs are not rendered by default.

48 changes: 48 additions & 0 deletions ui/jstests/exports/test_lr_exports.jsx
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());
}
);
}
);
53 changes: 53 additions & 0 deletions ui/jstests/learningresources/test-learning-resource.jsx
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);
}
);
});
Loading

0 comments on commit fbdc00c

Please sign in to comment.