[Core] Add specs for action support

Add specs for core components for dealing with actions;
part of ongoing platform/core transition, WTD-573.
This commit is contained in:
Victor Woeltjen
2014-11-21 13:26:02 -08:00
parent 41ecb1f8c2
commit 342832a4bc
6 changed files with 252 additions and 4 deletions

View File

@ -32,7 +32,7 @@ define(
// declarative bindings, as well as context,
// unless the action has defined its own.
if (!action.getMetadata) {
metadata = Object.create(Action.definition);
metadata = Object.create(Action.definition || {});
metadata.context = context;
action.getMetadata = function () {
return metadata;

View File

@ -20,13 +20,14 @@ define(
// it emits a log message whenever performed.
function addLogging(action) {
var logAction = Object.create(action),
domainObject =
action.getMetadata().context.domainObject;
metadata = action.getMetadata() || {},
context = metadata.context || {},
domainObject = context.domainObject;
logAction.perform = function () {
$log.info([
"Performing action ",
action.getMetadata().key,
metadata.key,
" upon ",
domainObject && domainObject.getId()
].join(""));