Add application tests

This commit is contained in:
Nicolas Le Goff
2013-05-23 17:16:43 +02:00
committed by Romain Neutron
parent ac6c9970e2
commit f886874f8d
13 changed files with 699 additions and 24 deletions

View File

@@ -77,6 +77,9 @@ $finder
->name('flash') ->name('flash')
->name('chai') ->name('chai')
->name('mocha') ->name('mocha')
->name('sinon')
->name('sinon-chai')
->name('js-fixtures')
->ignoreDotFiles(false) ->ignoreDotFiles(false)
->ignoreVCS(false) ->ignoreVCS(false)
->in(__DIR__); ->in(__DIR__);

View File

@@ -7,6 +7,9 @@
"underscore-amd": "~1.4", "underscore-amd": "~1.4",
"mocha": "~1.9", "mocha": "~1.9",
"chai" : "~1.6", "chai" : "~1.6",
"i18next": "~1.6" "i18next": "~1.6",
"sinon": "~1.7",
"sinon-chai": "~2.4",
"js-fixtures": "https://github.com/badunk/js-fixtures/archive/master.zip"
} }
} }

View File

@@ -5,8 +5,9 @@ define([
], function(_, Backbone, FieldModel) { ], function(_, Backbone, FieldModel) {
var FieldCollection = Backbone.Collection.extend({ var FieldCollection = Backbone.Collection.extend({
initialize: function(models, options) { initialize: function(models, options) {
if (!"sbas_id" in options) { options = options || {};
throw "You must specify a sbasId option when creating a new field model" if (typeof options === "object" && false === "sbas_id" in options) {
throw "You must set a sbas id"
} }
this.sbasId = options.sbas_id; this.sbasId = options.sbas_id;
}, },
@@ -20,9 +21,9 @@ define([
var pattern = new RegExp(letters, "gi"); var pattern = new RegExp(letters, "gi");
return _(this.filter(function(data) { return this.filter(function(data) {
return pattern.test(data.get("name")); return pattern.test(data.get("name"));
})); });
}, },
comparator: function(item) { comparator: function(item) {
return item.get("sorter"); return item.get("sorter");

View File

@@ -2,7 +2,7 @@
require.config({ require.config({
baseUrl: "/scripts", baseUrl: "/scripts",
paths: { paths: {
jquery: "../include/minify/f=include/jslibs/jquery-1.7.1", jquery: "../include/jslibs/jquery-1.7.1",
jqueryui: "../include/jslibs/jquery-ui-1.8.17/js/jquery-ui-1.8.17.custom.min", jqueryui: "../include/jslibs/jquery-ui-1.8.17/js/jquery-ui-1.8.17.custom.min",
underscore: "../assets/underscore-amd/underscore", underscore: "../assets/underscore-amd/underscore",
backbone: "../assets/backbone-amd/backbone", backbone: "../assets/backbone-amd/backbone",

View File

@@ -17,8 +17,8 @@ define([
}); });
this.$el.html(template); this.$el.html(template);
var index = $("#dces-element", AdminFieldApp.$rightBlock)[0].selectedIndex - 1; var index = $("#dces-element", this.$el)[0].selectedIndex - 1;
if (index > 0 ) { if (index > 0 ) {
$(".dces-help-block", AdminFieldApp.$rightBlock).html( $(".dces-help-block", AdminFieldApp.$rightBlock).html(
this.collection.at(index).get("definition") this.collection.at(index).get("definition")

View File

@@ -64,7 +64,7 @@ define([
// scroll to current view in item list // scroll to current view in item list
animate: function (top) { animate: function (top) {
top = top || null; top = top || null;
if (null === top) { if (null === top) {
top = $(".field-row").index(this.$el) * this.$el.height(); top = $(".field-row").index(this.$el) * this.$el.height();
} }

View File

@@ -4,7 +4,8 @@ define([
], function(_, Backbone) { ], function(_, Backbone) {
var FieldModel = Backbone.Model.extend({ var FieldModel = Backbone.Model.extend({
initialize : function(attributes, options) { initialize : function(attributes, options) {
if (attributes && ! "sbas-id" in attributes) { attributes = attributes || {};
if (typeof attributes === "object" && false === "sbas-id" in attributes) {
throw "You must set a sbas id"; throw "You must set a sbas id";
} }
}, },

View File

@@ -0,0 +1,18 @@
<div id="admin-field-app" class="container-fluid">
{# sbas_id is saved in the dom and used to fetch right models and collections #}
<input type="hidden" name="current_sbas_id" value="{{ sbas_id }}">
<div class="row-fluid row-top">
<div class="span4 save-block">
{# set loading state, this will be removed once backbone application is fully loaded #}
<img src="/skins/icons/loaderFFF.gif"/>
{% trans %}Loading database documentary fields ...{% endtrans %}
</div>
<div class="span8">
<div class="block-alert"></div>
</div>
</div>
<div class="row-fluid row-bottom hidden">
<div class="left-block span4"></div>
<div class="right-block span8"></div>
</div>
</div>

View File

@@ -0,0 +1,257 @@
<script type="text/template" id="alert_template">
<button type="button" class="close" data-dismiss="alert">&times;</button>
<%= msg %>
</script>
<script type="text/template" id="save_template">
<button type="button" class="btn btn-large btn-success save-all">
<i class="icon-hdd icon-white"></i> {% trans %}Save all changes{% endtrans %}
</button>
</script>
<script type="text/template" id="modal_template">
<div class="modal-body">
<p><%= msg %></p>
</div>
<div class="modal-footer">
<button type="button" data-dismiss="modal" class="btn cancel">{% trans %}Close{% endtrans %}</button>
<button type="button" class="btn btn-primary confirm">{% trans %}Ok{% endtrans %}</button>
</div>
</script>
<script type="text/template" id="item_list_view_template">
<div class="row-fluid">
<div class="span12">
<div class="sidebar-block">
<button type="button" class="btn btn-success btn-add-field"><i class="icon-plus icon-white"></i>{% trans %}Add new field{% endtrans %}</button>
</div>
<div class="sidebar-block">
<input class="input-block-level" type="text" id="live_search" placeholder="{% trans %}Live search{% endtrans %}"/>
</div>
<div class="well well-small add-field-block" style="display:none">
<h3>{% trans %}Add a new field{% endtrans %}</h3>
<form class="form-horizontal">
<div class="control-group">
<label class="control-label" for="new-name"">{% trans %}Label{% endtrans %}</label>
<div class="controls">
<input type="text" id="new-name" class="input-block-level" placeholder="">
<span class="help-block"></span>
</div>
</div>
<div class="control-group">
<label class="control-label" for="new-source">{% trans %}Source{% endtrans %}</label>
<div class="controls">
<input type="text" id="new-source" class="input-block-level" placeholder="">
<span class="help-block"></span>
</div>
</div>
<div class="control-group">
<div class="controls">
<label class="checkbox">
<input id="new-multivalued" type="checkbox">{% trans %}Multivalued{% endtrans %}
</label>
<button type="button" class="btn btn-success btn-submit-field"><i class="icon-ok icon-white"></i>{% trans %}Add{% endtrans %}</button>
<button type="button" class="btn btn-cancel-field">{% trans %}Cancel{% endtrans %}</button>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="row-fluid">
<div class="span12 list-block">
<ul id="collection-fields" class="unstyled"></ul>
</div>
</div>
</script>
<script type="text/template" id="edit_template">
<div class="edit-block">
<table>
<tr class="edit-order">
<td>{% trans %}Order{% endtrans %}</td>
<td><%= field.sorter %></td>
<td><button type="button" class="btn btn-danger delete-field pull-right"><i class="icon-trash icon-white"></i>delete</button></td>
</tr>
<tr class="edit-name ">
<td colspan="2" class="control-group <%= modelErrors && modelErrors.has('name') ? 'error' : '' %>">
<input id="name" type="text" value="<%= field.name %>" class="input-block-level">
<span class="help-block">
<% if(modelErrors && modelErrors.get('name')) { %>
<%= modelErrors.get('name').message %>
<% } %>
</span>
</td>
</tr>
<tr>
<td>{% trans %}Source{% endtrans %}</td>
<td class="control-group <%= modelErrors && modelErrors.has('tag') ? 'error' : '' %>">
<input id="tag" val="<%= field.tag %>" class="input-block-level"/>
<span class="help-block">
<% if(modelErrors && modelErrors.get('tag')) { %>
<%= modelErrors.get('tag').message %>
<% } %>
</span>
</td>
</tr>
<tr>
<td>{% trans %}DCES{% endtrans %}</td>
<td class="dc-fields-subview"></td>
</tr>
<tr>
<td colspan="2" class="dces-help-block info"></td>
</tr>
<tr>
<td colspan="2">
<% if(field.multi == true) { %>
<i class='icon-ok'></i>
<% } else { %>
<i class='icon-remove'></i>
<% } %> {% trans %}Multivalued{% endtrans %}
</td>
</tr>
</table>
<div class="edit-form">
<h4>{% trans %}Advanced field parameters{% endtrans %}</h4>
<table>
<tr>
<td><label for="tbranch">{% trans %}Thesaurus branch{% endtrans %}</label></td>
<td><input id="tbranch" type="text" value="<%= field.tbranch %>"/></td>
</tr>
<tr>
<td><label for="type">{% trans %}Type{% endtrans %}</label></td>
<td>
<select id="type">
<option <%= field.type == '' ? 'selected' : '' %> value=""></option>
<option <%= field.type == 'string' ? 'selected' : '' %> value="string">string</option>
<option <%= field.type == 'text' ? 'selected' : '' %> value="text">text</option>
<option <%= field.type == 'number' ? 'selected' : '' %> value="number">number</option>
<option <%= field.type == 'date' ? 'selected' : '' %> value="date">date</option>
</select>
</td>
</tr>
<tr>
<td><label for="vocabulary-type">{% trans %}Vocabulary type{% endtrans %}</label></td>
<td>
<select id="vocabulary-type">
<option <%= field['vocabulary-type'] == null ? 'selected' : '' %> value=''></option>
<% _.each(vocabularyTypes, function(vocab) { %>
<option <%= field['vocabulary-type'] == vocab.type ? 'selected' : '' %> value="<%= vocab.type %>"><%= vocab.name %></option>
<% }); %>
</select>
</td>
</tr>
<tr>
<td colspan="2">
<% if(field['vocabulary-type'] != null && field['vocabulary-type'] != '') { %>
<label for="vocabulary-restricted" class="checkbox">
<input id="vocabulary-restricted" type="checkbox" <%= field["vocabulary-restricted"] ? "checked='checked'" : "" %> />
{% trans %}Limited vocabulary{% endtrans %}
</label>
<% } %>
</td>
</tr>
<tr>
<td colspan="2">
<label for="business" class="checkbox">
<input id="business" type="checkbox" <%= field.business ? "checked='checked'" : "" %> />
{% trans %}Business Fields{% endtrans %}
</label>
</td>
</tr>
<tr>
<td><label for="separator">{% trans %}Separator{% endtrans %}</label></td>
<td><input id="separator" type="text" value="<%= field.separator %>" /></td>
</tr>
</table>
<h4>{% trans %}Display & action settings{% endtrans %}</h4>
<table>
<tr>
<td>
<label for="required" class="checkbox">
<input id="required" type="checkbox" <%= field.required ? "checked='checked'" : "" %> />
{% trans %}Mandatory{% endtrans %}
</label>
</td>
</tr>
<tr>
<td>
<label for="indexable" class="checkbox">
<input id="indexable" type="checkbox" <%= field.indexable ? "checked='checked'" : "" %> />
{% trans %}Indexable{% endtrans %}
</label>
</td>
</tr>
<tr>
<td>
<label for="readonly" class="checkbox">
<input id="readonly" type="checkbox" <%= field.readonly ? "checked='checked'" : "" %> />
{% trans %}Read only{% endtrans %}
</label>
</td>
</tr>
<tr>
<td>
<label for="report" class="checkbox">
<input id="report" type="checkbox" <%= field.report ? "checked='checked'" : "" %> />
{% trans %}Report{% endtrans %}
</label>
</td>
</tr>
<tr>
<td><label for="thumbtitle">{% trans %}Display thumbnails{% endtrans %}</label></td>
<td>
<select id="thumbtitle">
<option value="1" <%= field.thumbtitle == "1" ? "selected" : "" %> >{% trans 'Tous' %}</option>
<option value="0" <%= field.thumbtitle == "0" ? "selected" : "" %> >{% trans 'Aucun' %}</option>
<option value="fr" <%= field.thumbtitle == "fr" ? "selected" : "" %> >{% trans 'Francais' %}</option>
<option value="nl" <%= field.thumbtitle == "nl" ? "selected" : "" %> >{% trans 'Dutch' %}</option>
<option value="de" <%= field.thumbtitle == "de" ? "selected" : "" %> >{% trans 'Allemand' %}</option>
<option value="en" <%= field.thumbtitle == "en" ? "selected" : "" %> >{% trans 'Anglais' %}</option>
<option value="ar" <%= field.thumbtitle == "ar" ? "selected" : "" %> >{% trans 'Arabe' %}</option>
</select>
</td>
</tr>
</table>
</div>
</div>
</script>
<script type="text/template" id="list_row_template">
<table>
<tr>
<td class="handle">
<i class="icon-move"></i>
</td>
<td rowspan="2" class="trigger-click">
<div class="field-name"><%= name %></div>
<div class="field-tag"><%= tag %></div>
</td>
<td rowspan="2" class="chip trigger-click">
<i class="icon-chevron-right"></i>
</td>
</tr>
<tr>
<td class="position">
<%= position %>
</td>
</tr>
</table>
</script>
<script type="text/template" id="dc_fields_template">
<select id="dces-element" class="input-block-level">
<option <%= field['dces-element'] == null ? 'selected' : '' %> value=''></option>
<% _.each(dces_elements, function(el) { %>
<option <%= field['dces-element'] == el.label ? 'selected' : '' %> value="<%= el.label %>">DC:<%= el.label %></option>
<% }); %>
</select>
</script>
<script type="text/template" id="field_error_template">
<% if(messages.length > 0) { %>
<div class="well well-small">
<i class="icon-exclamation-sign"></i> {% trans %} Current configuration contains some errors {% endtrans %}
</div>
<% } %>
</script>

View File

@@ -8,15 +8,13 @@
<body> <body>
<div id="mocha"></div> <div id="mocha"></div>
<script src="../../assets/mocha/mocha.js"></script> <script src="../../assets/mocha/mocha.js"></script>
<script src="../../assets/chai/chai.js"></script>
<script>
window.expect = chai.expect;
window.assert = chai.assert;
</script>
<script src="../../assets/requirejs/require.js"></script> <script src="../../assets/requirejs/require.js"></script>
<script src="../../scripts/tests/main.js"></script> <script src="../../scripts/tests/main.js"></script>
<script> <script>
require(['tests/baseTest', 'specs/admin/fields'], runMocha); require([
'tests/baseTest',
'specs/admin/fields',
'specs/models'], runMocha);
</script> </script>
</body> </body>
</html> </html>

View File

@@ -2,18 +2,32 @@ require.config({
baseUrl: "../../scripts", baseUrl: "../../scripts",
paths: { paths: {
specs: "tests/specs", specs: "tests/specs",
chai: "../assets/chai/chai" chai: "../assets/chai/chai",
fixtures: "../assets/js-fixtures/fixtures",
app: "apps/admin/fields/app",
jquery: "../include/jslibs/jquery-1.7.1",
jqueryui: "../include/jslibs/jquery-ui-1.8.17/js/jquery-ui-1.8.17.custom.min",
underscore: "../assets/underscore-amd/underscore",
backbone: "../assets/backbone-amd/backbone",
twig: "../assets/twig/twig",
i18n: "../assets/i18next/release/i18next.amd-1.6.2.min",
bootstrap: "../skins/html5/bootstrap/js/bootstrap.min"
}, },
shim : { shim: {
shai: { twig: {
exports: "chai" exports: "Twig"
},
bootstrap : ["jquery"],
jqueryui: {
deps: [ "jquery" ]
} }
} }
}); });
mocha.setup({ mocha.setup({
ui: "bdd", ui: "bdd",
ignoreLeaks: true ignoreLeaks: true,
globals: ['js-fixtures']
}); });
console = window.console || function() {}; console = window.console || function() {};

View File

@@ -1,5 +1,270 @@
define(function(require) { define([
it("should run", function () { 'chai',
expect(true).to.equal(true); 'fixtures',
'jquery',
'app',
'models/field',
'apps/admin/fields/collections/fields',
'apps/admin/fields/collections/dcFields',
'apps/admin/fields/collections/vocabularies',
'apps/admin/fields/views/listRow',
'apps/admin/fields/views/list',
'apps/admin/fields/views/alert',
'apps/admin/fields/views/edit',
'apps/admin/fields/views/fieldError',
'apps/admin/fields/views/modal',
'apps/admin/fields/views/save',
'apps/admin/fields/views/dcField'
], function(
chai,
fixtures,
$,
App,
FieldModel,
FieldCollection,
DcFieldCollection,
VocabularyCollection,
SingleItemView,
ListItemView,
AlertView,
EditView,
FieldErrorView,
ModalView,
SaveView,
DcFieldView
) {
var expect = chai.expect;
var assert = chai.assert;
var should = chai.should();
// load fixtures in dom
fixtures.path = 'fixtures';
$("body").append(fixtures.read('admin/fields/dom', 'admin/fields/templates'));
var sbasId = 1;
App.initialize();
describe("Application", function() {
describe("Initialization", function() {
it("should create a global variable", function() {
should.exist(AdminFieldApp);
});
});
describe("Collections", function() {
describe("DcField Collection", function() {
beforeEach(function() {
this.collection = new DcFieldCollection([]);
});
it("should set collection url according to provided 'sbas-id'", function() {
this.collection.url().should.equal("/admin/fields/dc-fields");
});
});
describe("Vocabulary Collection", function() {
beforeEach(function() {
this.collection = new VocabularyCollection([]);
});
it("should set collection url according to provided 'sbas-id'", function() {
this.collection.url().should.equal("/admin/fields/vocabularies");
});
});
describe("Field Collection", function() {
beforeEach(function() {
this.collection = new FieldCollection([
{"id": 1, "sbas-id": sbasId, "name": "Categorie", "tag": "XMP:Categorie"},
{"id": 2, "sbas-id": sbasId, "name": "Object", "tag": "XMP:Object"},
], {
"sbas_id": sbasId
});
});
describe("Initialization", function() {
it("should throw an exception if 'sbas_id' is missing", function() {
expect(function() {
new FieldCollection([]);
}).to.throw("You must set a sbas id");
});
it("should set collection url according to provided 'sbas-id'", function() {
this.collection.url().should.equal("/admin/fields/"+sbasId+"/fields");
});
});
describe("Methods", function() {
it("should retrieve categorie item if searching terms begins with 'cat'", function() {
this.collection.search('Cat').length.should.equal(1);
});
it("should retrieve previous and next index for given model", function() {
expect(this.collection.previousIndex(this.collection.first())).to.be.null;
this.collection.nextIndex(this.collection.first()).should.equal(1);
this.collection.previousIndex(this.collection.last()).should.equal(0);
expect(this.collection.nextIndex(this.collection.last())).to.be.null;
});
});
});
});
describe("Views", function() {
describe("Single Item Views", function() {
beforeEach(function() {
this.field = new FieldModel({"sbas-id": sbasId, "name": "Categorie", "tag": "XMP:Categorie"});
this.view = new SingleItemView({model: this.field});
});
it("render() should return the view object", function() {
this.view.render().should.equal(this.view);
});
it("should render as a LI element", function() {
this.view.render().el.nodeName.should.equal("LI");
});
it("should render as a LI element with proper properties", function() {
this.view.render().$el.find('.field-name').html().should.equal("Categorie");
this.view.render().$el.find('.field-tag').html().should.equal("XMP:Categorie");
});
});
describe("List Item Views", function() {
beforeEach(function() {
this.collection = new FieldCollection([
{"sbas-id": sbasId, "name": "Categorie", "tag": "XMP:Categorie"},
{"sbas-id": sbasId, "name": "Object", "tag": "XMP:Object"}
], {
"sbas_id": sbasId
});
this.view = new ListItemView({
collection: this.collection,
el: AdminFieldApp.$leftBlock
});
});
it("render() should return the view object", function() {
this.view.render().should.equal(this.view);
});
it("should render as a DIV block", function() {
this.view.render().el.nodeName.should.equal("DIV");
});
it("should include list items for all models in collection", function() {
this.view.render();
this.view.$el.find("li").should.have.length(2);
});
});
describe("Alert Views", function() {
beforeEach(function() {
this.view = new AlertView({alert: "info", message: "Hello world!"});
});
it("render() should return the view object", function() {
this.view.render().should.equal(this.view);
});
it("should render as a DIV element", function() {
this.view.render().el.nodeName.should.equal("DIV");
});
});
describe("DcField Views", function() {
beforeEach(function() {
this.collection = new DcFieldCollection([ {
"label": "Contributor",
"definition": "An entity responsible for making contributions to the resource.",
"URI": "http://dublincore.org/documents/dces/#contributor"
}, {
"label": "Coverage",
"definition": "The spatial or temporal topic of the resource, the spatial applicability of the resource,\n or the jurisdiction under which the resource\n is relevant.",
"URI": "http://dublincore.org/documents/dces/#coverage"
}
]);
var model = new FieldModel({"id": 1, "sbas-id": sbasId, "name": "Categorie", "tag": "XMP:Categorie"});
this.view = new DcFieldView({
"collection": this.collection,
"field": model
});
});
it("render() should return the view object", function() {
this.view.render().should.equal(this.view);
});
it("should render as a DIV element", function() {
this.view.render().el.nodeName.should.equal("DIV");
});
});
describe("Edit Views", function() {
beforeEach(function() {
var model = new FieldModel({"id": 1, "sbas-id": sbasId, "name": "Categorie", "tag": "XMP:Categorie"});
this.view = new EditView({"model": model}).render();
});
it("render() should return the view object", function() {
this.view.render().should.equal(this.view);
});
it("should render as a DIV element", function() {
this.view.render().el.nodeName.should.equal("DIV");
});
});
describe("FieldError Views", function() {
beforeEach(function() {
this.view = new FieldErrorView();
});
it("render() should return the view object", function() {
this.view.render().should.equal(this.view);
});
it("should render as a DIV element", function() {
this.view.render().el.nodeName.should.equal("DIV");
});
});
describe("Modal Views", function() {
beforeEach(function() {
var model = new FieldModel({"id": 1, "sbas-id": sbasId, "name": "Categorie", "tag": "XMP:Categorie"});
this.view = new ModalView({
model: model,
message: "hellow world!"
});
});
it("render() should return the view object", function() {
this.view.render().should.equal(this.view);
});
it("should render as a DIV element", function() {
this.view.render().el.nodeName.should.equal("DIV");
});
});
describe("Save Views", function() {
beforeEach(function() {
this.view = new SaveView();
});
it("render() should return the view object", function() {
this.view.render().should.equal(this.view);
});
it("should render as a DIV element", function() {
this.view.render().el.nodeName.should.equal("DIV");
});
});
});
}); });
}); });

View File

@@ -0,0 +1,115 @@
define([
'chai',
'models/field',
'models/dcField',
'models/vocabulary'
], function(chai, Field, DcField, Vocabulary) {
var expect = chai.expect;
var assert = chai.assert;
var should = chai.should();
describe("Models", function(){
describe("Field Model", function(){
describe("Initialization", function() {
var sbasId = 1;
beforeEach(function() {
this.field = new Field({
"sbas-id" : sbasId
});
});
it("should throw an exception if 'sbas-id' is missing", function() {
expect(function() {
new Field();
}).to.throw("You must set a sbas id");
});
it("should set model url according to provided 'sbas-id'", function() {
this.field.urlRoot().should.equal("/admin/fields/"+sbasId+"/fields");
});
it("should default business property to 'false'", function() {
this.field.get('business').should.be.false;
});
it("should default type property to 'string'", function() {
this.field.get('type').should.equal("string");
});
it("should default thumbtitle property to '0'", function() {
this.field.get('thumbtitle').should.equal("0");
});
it("should default tbranch property to 'empty'", function() {
this.field.get('tbranch').should.equal("");
});
it("should default separator property to 'empty'", function() {
this.field.get('separator').should.equal("");
});
it("should default required property to 'false'", function() {
this.field.get('required').should.be.false;
});
it("should default readonly property to 'false'", function() {
this.field.get('readonly').should.be.false;
});
it("should default multi property to 'false'", function() {
this.field.get('multi').should.be.false;
});
it("should default vocabulary-restricted property to 'false'", function() {
this.field.get('vocabulary-restricted').should.be.false;
});
it("should default vocabulary-restricted property to 'false'", function() {
this.field.get('vocabulary-restricted').should.be.false;
});
it("should default report property to 'true'", function() {
this.field.get('report').should.be.true;
});
it("should default indexable property to 'true'", function() {
this.field.get('indexable').should.be.true;
});
it("should default dces-element property to 'null'", function() {
expect(this.field.get('dces-element')).to.be.null;
});
it("should default vocabulary-type property to 'null'", function() {
expect(this.field.get('vocabulary-type')).to.be.null;
});
});
});
describe("DcField Model", function(){
describe("Initialization", function() {
beforeEach(function() {
this.dcField = new DcField();
});
it("should set proper model url", function() {
this.dcField.urlRoot().should.equal("/admin/fields/dc-fields");
});
});
});
describe("DcField Model", function(){
describe("Initialization", function() {
beforeEach(function() {
this.vocabulary = new Vocabulary();
});
it("should set proper model url", function() {
this.vocabulary.urlRoot().should.equal("/admin/fields/vocabularies");
});
});
});
});
});