[Core] Complete spec for capailities

Complete specs for capabilities introduced in platform/core,
part of ongoing transition of this bundle. WTD-573.
This commit is contained in:
Victor Woeltjen
2014-11-21 16:59:03 -08:00
parent 2b82262775
commit 99f9203e71
7 changed files with 214 additions and 7 deletions

View File

@ -18,7 +18,7 @@ define(
*
* @constructor
*/
function CoreCapabilityProvider(capabilities) {
function CoreCapabilityProvider(capabilities, $log) {
// Filter by invoking the capability's appliesTo method
function filterCapabilities(model) {
return capabilities.filter(function (capability) {
@ -32,7 +32,11 @@ define(
function packageCapabilities(capabilities) {
var result = {};
capabilities.forEach(function (capability) {
result[capability.key] = capability;
if (capability.key) {
result[capability.key] = capability;
} else {
$log.warn("No key defined for capability; skipping.");
}
});
return result;
}

View File

@ -1,4 +1,4 @@
/*global define,Promise*/
/*global define*/
/**
* Module defining DelegationCapability. Created by vwoeltje on 11/18/14.
@ -27,7 +27,7 @@ define(
* @param domainObject
* @constructor
*/
function DelegationCapability(domainObject) {
function DelegationCapability($q, domainObject) {
var delegateCapabilities = {},
type = domainObject.getCapability("type");
@ -52,7 +52,7 @@ define(
promiseChildren().then(
filterObjectsWithCapability(capability)
) :
[];
$q.when([]);
}
// Generate set for easy lookup of capability delegation