Merge pull request #10465 from edx/peter-fogg/fix-spec-helpers-closure
Fix `withData` and `withConfiguration` helpers.
This commit is contained in:
@@ -13,9 +13,11 @@ define([], function () {
|
||||
var withData = function (data, func) {
|
||||
for (var name in data) {
|
||||
if (data.hasOwnProperty(name)) {
|
||||
it(name, function () {
|
||||
func.apply(this, data[name]);
|
||||
});
|
||||
(function (name) {
|
||||
it(name, function () {
|
||||
func.apply(this, data[name]);
|
||||
});
|
||||
})(name);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -31,12 +33,14 @@ define([], function () {
|
||||
var withConfiguration = function (config, setup, test) {
|
||||
for (var name in config) {
|
||||
if (config.hasOwnProperty(name)) {
|
||||
describe(name, function () {
|
||||
beforeEach(function () {
|
||||
setup.apply(this, config[name]);
|
||||
(function (name) {
|
||||
describe(name, function () {
|
||||
beforeEach(function () {
|
||||
setup.apply(this, config[name]);
|
||||
});
|
||||
test();
|
||||
});
|
||||
test();
|
||||
});
|
||||
})(name);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -171,10 +171,11 @@ define([
|
||||
]
|
||||
}, function (url, expectedEvent) {
|
||||
var teamsTabView = createTeamsTabView(this, {
|
||||
userInfo: TeamSpecHelpers.createMockUserInfo({staff: true})
|
||||
});
|
||||
userInfo: TeamSpecHelpers.createMockUserInfo({staff: true})
|
||||
});
|
||||
teamsTabView.teamsCollection = TeamSpecHelpers.createMockTeams();
|
||||
teamsTabView.router.navigate(url, {trigger: true});
|
||||
if (AjaxHelpers.currentRequest(requests)) {
|
||||
if (requests.length > requests.currentIndex) {
|
||||
AjaxHelpers.respondWithJson(requests, {});
|
||||
}
|
||||
expect(Logger.log).toHaveBeenCalledWith('edx.team.page_viewed', expectedEvent);
|
||||
|
||||
Reference in New Issue
Block a user