diff options
Diffstat (limited to 'web')
-rw-r--r-- | web/gulpfile.js | 4 | ||||
-rw-r--r-- | web/package.json | 3 | ||||
-rw-r--r-- | web/src/js/components/flowtable.js | 2 | ||||
-rw-r--r-- | web/src/js/store/view.js | 6 | ||||
-rw-r--r-- | web/src/js/tests/utils.js | 3 |
5 files changed, 13 insertions, 5 deletions
diff --git a/web/gulpfile.js b/web/gulpfile.js index 58f74098..3c2e3f15 100644 --- a/web/gulpfile.js +++ b/web/gulpfile.js @@ -96,6 +96,10 @@ function buildScript(bundler, filename, dev) { function rebundle() { return bundler.bundle() + .on('error', function(error) { + gutil.log(error + '\n' + error.codeFrame); + this.emit('end'); + }) .pipe(dev ? plumber(handleError) : gutil.noop()) .pipe(source('bundle.js')) .pipe(buffer()) diff --git a/web/package.json b/web/package.json index a1b42d01..63a664ae 100644 --- a/web/package.json +++ b/web/package.json @@ -5,6 +5,7 @@ "test": "jest ./src/js" }, "jest": { + "scriptPreprocessor": "<rootDir>/node_modules/babel-jest", "testPathDirs": [ "./src/js" ], @@ -25,6 +26,7 @@ }, "devDependencies": { "babel-core": "^6.5.2", + "babel-jest": "^6.0.1", "babel-preset-es2015": "^6.5.0", "babel-preset-react": "^6.5.0", "babelify": "^7.2.0", @@ -41,6 +43,7 @@ "gulp-rename": "^1.2.2", "gulp-sourcemaps": "^1.6.0", "gulp-util": "^3.0.7", + "jest": "^0.1.40", "lodash": "^4.5.1", "uglifyify": "^3.0.1", "vinyl-buffer": "^1.0.0", diff --git a/web/src/js/components/flowtable.js b/web/src/js/components/flowtable.js index 1d99c318..988d1895 100644 --- a/web/src/js/components/flowtable.js +++ b/web/src/js/components/flowtable.js @@ -143,7 +143,7 @@ var FlowTable = React.createClass({ }, scrollIntoView: function (flow) { this.scrollRowIntoView( - this.context.view.index(flow), + this.context.view.indexOf(flow), ReactDOM.findDOMNode(this.refs.body).offsetTop ); }, diff --git a/web/src/js/store/view.js b/web/src/js/store/view.js index 71b159bf..d8aeba60 100644 --- a/web/src/js/store/view.js +++ b/web/src/js/store/view.js @@ -59,12 +59,12 @@ _.extend(StoreView.prototype, EventEmitter.prototype, { }); this.emit("recalculate"); }, - index: function (elem) { - return _.sortedIndex(this.list, elem, this.sortfun); + indexOf: function (elem) { + return this.list.indexOf(elem, _.sortedIndexBy(this.list, elem, this.sortfun)); }, add: function (elem) { if (this.filt(elem)) { - var idx = this.index(elem); + var idx = _.sortedIndexBy(this.list, elem, this.sortfun); if (idx === this.list.length) { //happens often, .push is way faster. this.list.push(elem); } else { diff --git a/web/src/js/tests/utils.js b/web/src/js/tests/utils.js index 1b6de264..acbadc92 100644 --- a/web/src/js/tests/utils.js +++ b/web/src/js/tests/utils.js @@ -1,8 +1,9 @@ jest.dontMock("jquery"); jest.dontMock("../utils"); +import {formatSize} from "../utils.js" + describe("utils", function () { - import {formatSize} from "../utils.js" it("formatSize", function(){ expect(formatSize(1024)).toEqual("1kb"); expect(formatSize(0)).toEqual("0"); |