Changing util.js to export an object
This allows the methods to be spied on in tests
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { spaceVertically } from '../../util.js';
|
||||
import util from '../../util.js';
|
||||
import _ from 'lodash';
|
||||
import Q from 'q';
|
||||
export default {
|
||||
@@ -26,7 +26,7 @@ export default {
|
||||
return part.render(this.partContainer.group());
|
||||
}))
|
||||
.then(() => {
|
||||
spaceVertically(this.elements, {
|
||||
util.spaceVertically(this.elements, {
|
||||
padding: 5
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { normalizeBBox, spaceHorizontally } from '../../util.js';
|
||||
import util from '../../util.js';
|
||||
import _ from 'lodash';
|
||||
import Q from 'q';
|
||||
|
||||
@@ -8,8 +8,8 @@ export default {
|
||||
definedProperties: {
|
||||
_anchor: {
|
||||
get: function() {
|
||||
var start = normalizeBBox(_.first(this.items).getBBox()),
|
||||
end = normalizeBBox(_.last(this.items).getBBox()),
|
||||
var start = util.normalizeBBox(_.first(this.items).getBBox()),
|
||||
end = util.normalizeBBox(_.last(this.items).getBBox()),
|
||||
matrix = this.transform().localMatrix;
|
||||
|
||||
return {
|
||||
@@ -44,15 +44,15 @@ export default {
|
||||
var prev, next, paths;
|
||||
|
||||
this.items = items;
|
||||
spaceHorizontally(items, {
|
||||
util.spaceHorizontally(items, {
|
||||
padding: 10
|
||||
});
|
||||
|
||||
prev = normalizeBBox(_.first(items).getBBox());
|
||||
prev = util.normalizeBBox(_.first(items).getBBox());
|
||||
paths = _.map(items.slice(1), item => {
|
||||
var path;
|
||||
|
||||
next = normalizeBBox(item.getBBox());
|
||||
next = util.normalizeBBox(item.getBBox());
|
||||
path = `M${prev.ax2},${prev.ay}H${next.ax}`;
|
||||
prev = next;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { customEvent, normalizeBBox } from '../../util.js';
|
||||
import util from '../../util.js';
|
||||
import _ from 'lodash';
|
||||
import Q from 'q';
|
||||
|
||||
@@ -107,7 +107,7 @@ export default class Node {
|
||||
|
||||
this.state.renderCounter--;
|
||||
|
||||
document.body.dispatchEvent(customEvent('updateStatus', {
|
||||
document.body.dispatchEvent(util.customEvent('updateStatus', {
|
||||
percentage: (this.state.maxCounter - this.state.renderCounter) / this.state.maxCounter
|
||||
}));
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { spaceVertically } from '../../util.js';
|
||||
import util from '../../util.js';
|
||||
import _ from 'lodash';
|
||||
import Q from 'q';
|
||||
|
||||
@@ -20,7 +20,7 @@ export default {
|
||||
var containerBox,
|
||||
paths;
|
||||
|
||||
spaceVertically(this.matches, {
|
||||
util.spaceVertically(this.matches, {
|
||||
padding: 5
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user