Skip to content

Commit

Permalink
test WIP
Browse files Browse the repository at this point in the history
Ripped out Mocha because it doesn't let you import `describe`
mochajs/mocha#956 and mocha-loader
didn't work and come on, they should export `describe`.
  • Loading branch information
mheiber committed May 16, 2017
1 parent f95b735 commit c12e8b0
Show file tree
Hide file tree
Showing 7 changed files with 14,967 additions and 74 deletions.
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -9,7 +9,7 @@
},
"scripts": {
"lint": "eslint src",
"test": "mocha; npm run lint",
"test": "NODE_ENV=testing webpack test.js --target node #; npm run lint",
"watch": "webpack -w",
"prepublish": "webpack -p"
},
Expand Down Expand Up @@ -54,6 +54,7 @@
"webpack": "^2.4.1"
},
"dependencies": {
"null-loader": "^0.1.1",
"raw-loader": "^0.5.1"
}
}
57 changes: 0 additions & 57 deletions src/services/create-service.js
@@ -1,40 +1,3 @@
import dom from '@nymag/dom';
import _ from 'lodash';
import references from './references';
import utils from './utils';

/**
* At this stage the component has already been wrapped in newly created
* Logic component. This function then creats a Space per the user's
* selection and adds that Logic to the Space and adds the Space to the
* componentList of the original component.
*
* @param {String} space
* @param {Object} options
* @param {Object} parent
* @param {Object} position
* @param {Object} logicComponent
* @return {Promise}
*/
function addInSpace(space, options, parent, position, logicComponent) {
return Promise.all([references.edit.createComponent(space, { content: [{ _ref: logicComponent[references.referenceProperty] }] }), references.edit.getData(parent.ref)])
.then(function (promises) {
var res = promises[0],
newRef = res._ref,
args = {
ref: newRef,
parentField: parent.path,
parentRef: parent.ref,
prevRef: position.prevRef,
above: position.above
};

return references.edit.addToParentList(args)
.then(function (newEl) {
return attachHandlersAndFocus(newEl);
});
});
}

/**
* Find the component to convert to a Space, find the Spaces available
Expand All @@ -57,26 +20,6 @@ export function createSpace(store, ref, parentRef, availableSpaces) {
}
}


/**
* If there is more than one type of Space available in a
* component list then open a pane to allow the user to choose
* which Space they want
*
* @param {Array} availableSpaces
* @param {Element} clickedComponent
* @param {Object} options
* @param {Object} parent
*/
function selectSpace(availableSpaces, clickedComponent, options, parent) {
references.pane.open([{
header: 'Choose A Space',
content: utils.createFilterableList(availableSpaces, {
click: spaceSelectCallback.bind(null, clickedComponent, options, parent)
})
}]);
}

/**
* Grab the schema for whatever Space component is selected and
* find the Logic component available to it.
Expand Down
9 changes: 9 additions & 0 deletions src/services/create-service.test.js
@@ -0,0 +1,9 @@
import { createSpace } from './create-service.js';
import test from 'tape';

describe('createSpace', () => {

it('', () => {

});
});

0 comments on commit c12e8b0

Please sign in to comment.