I have an Ember CLI addon project -- ui-slider-input -- which has a VERY basic wrapper around a JS slider widget. This is implemented as a component and the out-of-the-box unit tests for whether a component does or does not render is run. Here's the strange part ...
UiSliderComponent: it renders
)npm test
(could also have used ember test
... no difference) it fails with the following stack trace: not ok 7 PhantomJS 1.9 - UiSliderInputComponent: it renders
---
actual: >
null
message: >
Died on test #2 at http://localhost:7357/assets/test-support.js:418
at test (http://localhost:7357/assets/test-support.js:284)
at http://localhost:7357/assets/dummy.js:273
at http://localhost:7357/assets/vendor.js:77
at http://localhost:7357/assets/test-loader.js:14: 'undefined' is not a function (evaluating 'this._applyPrecision.bind(this)')
It’s not a Ember CLI problem, it’s a PhantomJS problem.
PhantomJS lacks Function.prototype.bind
, which you can see is being called in the stacktrace. This GitHub issue discusses the problem. The simplest solution would be to add one:
Function.prototype.bind = Function.prototype.bind || function (thisp) {
var fn = this;
return function () {
return fn.apply(thisp, arguments);
};
};
See the thread for more details.