mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-10 19:43:16 +00:00
Fix tests
This commit is contained in:
@@ -17,11 +17,11 @@ define([
|
|||||||
initialize: function(options) {
|
initialize: function(options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
|
|
||||||
if (! "name" in options) {
|
if (false === "name" in options) {
|
||||||
throw "Missing name attribute in error view";
|
throw "Missing name attribute in error view";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! "errorTemplate" in options) {
|
if (false === "errorTemplate" in options) {
|
||||||
throw "Missing errorTemplate attribute in error view";
|
throw "Missing errorTemplate attribute in error view";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -18,11 +18,11 @@ define([
|
|||||||
initialize: function(options) {
|
initialize: function(options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
|
|
||||||
if (! "name" in options) {
|
if (false === "name" in options) {
|
||||||
throw "Missing name attribute in input view";
|
throw "Missing name attribute in input view";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! "errorTemplate" in options) {
|
if (false === "errorTemplate" in options) {
|
||||||
throw "Missing errorTemplate attribute in input view";
|
throw "Missing errorTemplate attribute in input view";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,9 +2,9 @@ define([
|
|||||||
'chai',
|
'chai',
|
||||||
'fixtures',
|
'fixtures',
|
||||||
'jquery',
|
'jquery',
|
||||||
'apps/login/home/views/form',
|
'common/forms/views/form',
|
||||||
'apps/login/home/views/input',
|
'common/forms/views/input',
|
||||||
'apps/login/home/views/error'
|
'common/forms/views/error'
|
||||||
], function(
|
], function(
|
||||||
chai,
|
chai,
|
||||||
fixtures,
|
fixtures,
|
||||||
@@ -65,7 +65,8 @@ define([
|
|||||||
describe("Input View", function() {
|
describe("Input View", function() {
|
||||||
it("should initialize error view", function() {
|
it("should initialize error view", function() {
|
||||||
var input = new InputView({
|
var input = new InputView({
|
||||||
"name": "test"
|
"name": "test",
|
||||||
|
"errorTemplate": "#field_errors"
|
||||||
});
|
});
|
||||||
expect(input.errorView).to.be.an.instanceof(ErrorView);
|
expect(input.errorView).to.be.an.instanceof(ErrorView);
|
||||||
});
|
});
|
||||||
@@ -79,8 +80,10 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
var errorView = new ErrorView({
|
var errorView = new ErrorView({
|
||||||
|
"name": "test",
|
||||||
"errors": [error],
|
"errors": [error],
|
||||||
"el" : $(".error-view").first()
|
"el" : $(".error-view").first(),
|
||||||
|
"errorTemplate": "#field_errors"
|
||||||
});
|
});
|
||||||
|
|
||||||
errorView.render();
|
errorView.render();
|
||||||
@@ -94,8 +97,10 @@ define([
|
|||||||
$el.html('previous error here');
|
$el.html('previous error here');
|
||||||
|
|
||||||
var errorView = new ErrorView({
|
var errorView = new ErrorView({
|
||||||
|
"name": "test",
|
||||||
"errors": [],
|
"errors": [],
|
||||||
"el" : $el
|
"el" : $el,
|
||||||
|
"errorTemplate": "#field_errors"
|
||||||
});
|
});
|
||||||
|
|
||||||
errorView.render();
|
errorView.render();
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
define([
|
define([
|
||||||
'chai',
|
'chai',
|
||||||
'common/validator'
|
'common/forms/validator'
|
||||||
], function(chai, Validator) {
|
], function(chai, Validator) {
|
||||||
var expect = chai.expect;
|
var expect = chai.expect;
|
||||||
var assert = chai.assert;
|
var assert = chai.assert;
|
||||||
|
Reference in New Issue
Block a user