Skip to content

Instantly share code, notes, and snippets.

@laser
Created January 10, 2012 16:35
Show Gist options
  • Save laser/1589912 to your computer and use it in GitHub Desktop.
Save laser/1589912 to your computer and use it in GitHub Desktop.
mocks
function MockGenericModalController() {
this.root = document.createElement("div");
this.createAndAppendHeader = function() {};
this.createAndAppendTwoButtonFooter = function() {};
this.destroyContents = function() {};
this.displayContentView = function() {};
this.getPanel = function() {
return new Object();
};
this.getRootDomElem = function() {
return this.root;
};
this.hidePanel = function() {};
this.hasBeenInitialized = function() {
return true;
};
this.revealPanel = function() {};
this.setCssClass = function() {};
this.setOverlayManager = function() {};
}
function MockCampaignService() {
var MUST_IMPLEMENT_MSG;
MUST_IMPLEMENT_MSG = "test must implement if you wanna use this method";
this.getCampaignById = function() {
alert(MUST_IMPLEMENT_MSG);
throw(MUST_IMPLEMENT_MSG);
};
this.getContactInfoPaginatedForCampaignDataSource = function() {
alert(MUST_IMPLEMENT_MSG);
throw(MUST_IMPLEMENT_MSG);
};
this.getCampaignDistributionSummaryJSONDataSource = function() {
alert(MUST_IMPLEMENT_MSG);
throw(MUST_IMPLEMENT_MSG);
};
}
function MockResourceBundleUtil() {
this.hasBeenInitialized = function() {
return true;
};
this.getResourceBundledStringsByListOfGroupItemPairs = function(requestedList, callback) {
var i,
len,
stash;
stash = {};
for (i = 0, len = requestedList.length; i < len; i++) {
stash[requestedList[i].group] = stash[requestedList[i].group] || {};
stash[requestedList[i].group][requestedList[i].item] = requestedList[i].group.toString() + " " + requestedList[i].item.toString();
}
callback(new ResourceBundlerUtilResponse(stash));
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment