Fix tests

This commit is contained in:
Nicolas Le Goff
2013-06-17 12:17:44 +02:00
parent 164d012437
commit c509a1bf47
4 changed files with 16 additions and 11 deletions

View File

@@ -17,11 +17,11 @@ define([
initialize: function(options) {
options = options || {};
if (! "name" in options) {
if (false === "name" in options) {
throw "Missing name attribute in error view";
}
if (! "errorTemplate" in options) {
if (false === "errorTemplate" in options) {
throw "Missing errorTemplate attribute in error view";
}

View File

@@ -18,11 +18,11 @@ define([
initialize: function(options) {
options = options || {};
if (! "name" in options) {
if (false === "name" in options) {
throw "Missing name attribute in input view";
}
if (! "errorTemplate" in options) {
if (false === "errorTemplate" in options) {
throw "Missing errorTemplate attribute in input view";
}

View File

@@ -2,9 +2,9 @@ define([
'chai',
'fixtures',
'jquery',
'apps/login/home/views/form',
'apps/login/home/views/input',
'apps/login/home/views/error'
'common/forms/views/form',
'common/forms/views/input',
'common/forms/views/error'
], function(
chai,
fixtures,
@@ -65,7 +65,8 @@ define([
describe("Input View", function() {
it("should initialize error view", function() {
var input = new InputView({
"name": "test"
"name": "test",
"errorTemplate": "#field_errors"
});
expect(input.errorView).to.be.an.instanceof(ErrorView);
});
@@ -79,8 +80,10 @@ define([
};
var errorView = new ErrorView({
"name": "test",
"errors": [error],
"el" : $(".error-view").first()
"el" : $(".error-view").first(),
"errorTemplate": "#field_errors"
});
errorView.render();
@@ -94,8 +97,10 @@ define([
$el.html('previous error here');
var errorView = new ErrorView({
"name": "test",
"errors": [],
"el" : $el
"el" : $el,
"errorTemplate": "#field_errors"
});
errorView.render();

View File

@@ -1,6 +1,6 @@
define([
'chai',
'common/validator'
'common/forms/validator'
], function(chai, Validator) {
var expect = chai.expect;
var assert = chai.assert;