Functional tests for Ember

issue #2989

- Adds lodash for bind and isNumber - looking for a better solution for this
- Still needs the editor and flow tests porting
- Some of the tests are commented out awaiting further implementations
This commit is contained in:
Hannah Wolfe 2014-06-16 22:44:09 +01:00
parent bdbafc1831
commit c6dc8c0eea
4 changed files with 12 additions and 10 deletions

View File

@ -28,6 +28,7 @@
"DS": true,
"$": true,
"validator": true,
"ic": true
"ic": true,
"_": true
}
}

View File

@ -1,12 +1,13 @@
/* global CodeMirror*/
/*global CodeMirror */
import MarkerManager from 'ghost/mixins/marker-manager';
import setScrollClassName from 'ghost/utils/set-scroll-classname';
var onChangeHandler = function (cm, changeObj) {
var line,
component = cm.component,
checkLine = component.checkLine.bind(component),
checkMarkers = component.checkMarkers.bind(component);
checkLine = _.bind(component.checkLine, component),
checkMarkers = _.bind(component.checkMarkers, component);
// fill array with a range of numbers
for (line = changeObj.from.line; line < changeObj.from.line + changeObj.text.length; line += 1) {
@ -37,7 +38,7 @@ var Codemirror = Ember.TextArea.extend(MarkerManager, {
},
afterRenderEvent: function () {
var initMarkers = this.initMarkers.bind(this);
var initMarkers = _.bind(this.initMarkers, this);
this.initCodemirror();
this.codemirror.eachLine(initMarkers);

View File

@ -25,10 +25,10 @@ var Markdown = Ember.Component.extend({
filestorage: false
});
dropzones.on('uploadstart', this.sendAction.bind(this, 'uploadStarted'));
dropzones.on('uploadfailure', this.sendAction.bind(this, 'uploadFinished'));
dropzones.on('uploadsuccess', this.sendAction.bind(this, 'uploadFinished'));
dropzones.on('uploadsuccess', this.sendAction.bind(this, 'uploadSuccess'));
dropzones.on('uploadstart', _.bind(this.sendAction, this, 'uploadStarted'));
dropzones.on('uploadfailure', _.bind(this.sendAction, this, 'uploadFinished'));
dropzones.on('uploadsuccess', _.bind(this.sendAction, this, 'uploadFinished'));
dropzones.on('uploadsuccess', _.bind(this.sendAction, this, 'uploadSuccess'));
});
}.observes('markdown')
});

View File

@ -113,7 +113,7 @@ var PostSettingsMenuController = Ember.ObjectController.extend({
// if the candidate slug is the same as the existing slug except
// for the incrementor then the existing slug should be used
if (Number.isInteger(check) && check > 0) {
if (_.isNumber(check) && check > 0) {
if (slug === slugTokens.join('-') && serverSlug !== newSlug) {
return;
}