mirror of https://github.com/artf/grapesjs.git
14 changed files with 435 additions and 379 deletions
@ -1,35 +1,36 @@ |
|||||
define(['AssetManager/model/Asset'], |
define(['AssetManager/model/Asset'], |
||||
function(Asset) { |
function(Asset) { |
||||
|
|
||||
describe('Asset Manager', function() { |
return { |
||||
|
run: function(){ |
||||
|
|
||||
describe('Asset', function() { |
describe('Asset', function() { |
||||
it('Object exists', function() { |
it('Object exists', function() { |
||||
Asset.should.be.exist; |
Asset.should.be.exist; |
||||
}); |
}); |
||||
|
|
||||
it('Has default values', function() { |
it('Has default values', function() { |
||||
var obj = new Asset({}); |
var obj = new Asset({}); |
||||
obj.get('type').should.equal(""); |
obj.get('type').should.equal(""); |
||||
obj.get('src').should.equal(""); |
obj.get('src').should.equal(""); |
||||
obj.getExtension().should.be.empty; |
obj.getExtension().should.be.empty; |
||||
obj.getFilename().should.be.empty; |
obj.getFilename().should.be.empty; |
||||
}); |
}); |
||||
|
|
||||
it('Test getFilename', function() { |
it('Test getFilename', function() { |
||||
var obj = new Asset({ type:'image', src: 'ch/eck/t.e.s.t'}); |
var obj = new Asset({ type:'image', src: 'ch/eck/t.e.s.t'}); |
||||
obj.getFilename().should.equal('t.e.s.t'); |
obj.getFilename().should.equal('t.e.s.t'); |
||||
var obj = new Asset({ type:'image', src: 'ch/eck/1234abc'}); |
var obj = new Asset({ type:'image', src: 'ch/eck/1234abc'}); |
||||
obj.getFilename().should.equal('1234abc'); |
obj.getFilename().should.equal('1234abc'); |
||||
}); |
}); |
||||
|
|
||||
it('Test getExtension', function() { |
it('Test getExtension', function() { |
||||
var obj = new Asset({ type:'image', src: 'ch/eck/t.e.s.t'}); |
var obj = new Asset({ type:'image', src: 'ch/eck/t.e.s.t'}); |
||||
obj.getExtension().should.equal('t'); |
obj.getExtension().should.equal('t'); |
||||
var obj = new Asset({ type:'image', src: 'ch/eck/1234abc.'}); |
var obj = new Asset({ type:'image', src: 'ch/eck/1234abc.'}); |
||||
obj.getExtension().should.equal(''); |
obj.getExtension().should.equal(''); |
||||
|
}); |
||||
}); |
}); |
||||
|
} |
||||
}); |
} |
||||
}); |
|
||||
}); |
}); |
||||
@ -1,24 +1,27 @@ |
|||||
define(['AssetManager/model/AssetImage'], |
define(['AssetManager/model/AssetImage'], |
||||
function(AssetImage) { |
function(AssetImage) { |
||||
|
|
||||
describe('Asset Manager', function() { |
return { |
||||
|
run: function() { |
||||
|
|
||||
describe('AssetImage', function() { |
describe('AssetImage', function() { |
||||
it('Object exists', function() { |
it('Object exists', function() { |
||||
AssetImage.should.be.exist; |
AssetImage.should.be.exist; |
||||
}); |
}); |
||||
|
|
||||
|
it('Has default values', function() { |
||||
|
var obj = new AssetImage({}); |
||||
|
obj.get('type').should.equal("image"); |
||||
|
obj.get('src').should.equal(""); |
||||
|
obj.get('unitDim').should.equal("px"); |
||||
|
obj.get('height').should.equal(0); |
||||
|
obj.get('width').should.equal(0); |
||||
|
obj.getExtension().should.be.empty; |
||||
|
obj.getFilename().should.be.empty; |
||||
|
}); |
||||
|
|
||||
it('Has default values', function() { |
|
||||
var obj = new AssetImage({}); |
|
||||
obj.get('type').should.equal("image"); |
|
||||
obj.get('src').should.equal(""); |
|
||||
obj.get('unitDim').should.equal("px"); |
|
||||
obj.get('height').should.equal(0); |
|
||||
obj.get('width').should.equal(0); |
|
||||
obj.getExtension().should.be.empty; |
|
||||
obj.getFilename().should.be.empty; |
|
||||
}); |
}); |
||||
|
|
||||
}); |
} |
||||
}); |
}; |
||||
}); |
}); |
||||
@ -1,52 +1,53 @@ |
|||||
define(['AssetManager/model/Assets'], |
define(['AssetManager/model/Assets'], |
||||
function(Assets) { |
function(Assets) { |
||||
|
|
||||
describe('Asset Manager', function() { |
return { |
||||
|
run: function() { |
||||
|
describe('Assets', function() { |
||||
|
|
||||
|
var obj; |
||||
|
|
||||
|
beforeEach(function () { |
||||
|
obj = new Assets(); |
||||
|
}); |
||||
|
|
||||
|
afterEach(function () { |
||||
|
delete obj; |
||||
|
}); |
||||
|
|
||||
|
it('Object exists', function() { |
||||
|
obj.should.be.exist; |
||||
|
}); |
||||
|
|
||||
|
it('Collection is empty', function() { |
||||
|
obj.length.should.equal(0); |
||||
|
}); |
||||
|
|
||||
|
it("Can't insert assets without src", function() { |
||||
|
obj.add({}); |
||||
|
obj.length.should.equal(0); |
||||
|
obj.add([{},{},{}]); |
||||
|
obj.length.should.equal(0); |
||||
|
}); |
||||
|
|
||||
|
it("Insert assets only with src", function() { |
||||
|
obj.add([{},{src:'test'},{}]); |
||||
|
obj.length.should.equal(1); |
||||
|
}); |
||||
|
|
||||
|
it('addImg creates new asset', function() { |
||||
|
obj.addImg('/img/path'); |
||||
|
obj.length.should.equal(1); |
||||
|
}); |
||||
|
|
||||
|
it('addImg asset is correct', function() { |
||||
|
obj.addImg('/img/path'); |
||||
|
var asset = obj.at(0); |
||||
|
asset.get('type').should.equal('image'); |
||||
|
asset.get('src').should.equal('/img/path'); |
||||
|
}); |
||||
|
|
||||
describe('Assets', function() { |
|
||||
|
|
||||
var obj; |
|
||||
|
|
||||
beforeEach(function () { |
|
||||
obj = new Assets(); |
|
||||
}); |
|
||||
|
|
||||
afterEach(function () { |
|
||||
delete obj; |
|
||||
}); |
|
||||
|
|
||||
it('Object exists', function() { |
|
||||
Assets.should.be.exist; |
|
||||
}); |
|
||||
|
|
||||
it('Collection is empty', function() { |
|
||||
obj.length.should.equal(0); |
|
||||
}); |
|
||||
|
|
||||
it("Can't insert assets without src", function() { |
|
||||
obj.add({}); |
|
||||
obj.length.should.equal(0); |
|
||||
obj.add([{},{},{}]); |
|
||||
obj.length.should.equal(0); |
|
||||
}); |
|
||||
|
|
||||
it("Insert assets only with src", function() { |
|
||||
obj.add([{},{src:'test'},{}]); |
|
||||
obj.length.should.equal(1); |
|
||||
}); |
|
||||
|
|
||||
it('addImg creates new asset', function() { |
|
||||
obj.addImg('/img/path'); |
|
||||
obj.length.should.equal(1); |
|
||||
}); |
|
||||
|
|
||||
it('addImg asset is correct', function() { |
|
||||
obj.addImg('/img/path'); |
|
||||
var asset = obj.at(0); |
|
||||
asset.get('type').should.equal('image'); |
|
||||
asset.get('src').should.equal('/img/path'); |
|
||||
}); |
}); |
||||
|
} |
||||
}); |
}; |
||||
}); |
|
||||
}); |
}); |
||||
@ -1,77 +1,80 @@ |
|||||
define(['AssetManager/view/AssetImageView', 'AssetManager/model/AssetImage', 'AssetManager/model/Assets'], |
define(['AssetManager/view/AssetImageView', 'AssetManager/model/AssetImage', 'AssetManager/model/Assets'], |
||||
function(AssetImageView, AssetImage, Assets) { |
function(AssetImageView, AssetImage, Assets) { |
||||
|
|
||||
describe('Asset Manager', function() { |
return { |
||||
|
run: function() { |
||||
|
|
||||
describe('AssetImageView', function() { |
describe('AssetImageView', function() { |
||||
|
|
||||
before(function () { |
before(function () { |
||||
this.$fixtures = $("#fixtures"); |
this.$fixtures = $("#fixtures"); |
||||
this.$fixture = $('<div class="asset-fixture"></div>'); |
this.$fixture = $('<div class="asset-fixture"></div>'); |
||||
}); |
}); |
||||
|
|
||||
beforeEach(function () { |
beforeEach(function () { |
||||
var coll = new Assets(); |
var coll = new Assets(); |
||||
var model = coll.add({ type:'image', src: '/test' }); |
var model = coll.add({ type:'image', src: '/test' }); |
||||
this.view = new AssetImageView({ |
this.view = new AssetImageView({ |
||||
config : {}, |
config : {}, |
||||
model: model |
model: model |
||||
|
}); |
||||
|
this.$fixture.empty().appendTo(this.$fixtures); |
||||
|
this.$fixture.html(this.view.render().el); |
||||
}); |
}); |
||||
this.$fixture.empty().appendTo(this.$fixtures); |
|
||||
this.$fixture.html(this.view.render().el); |
|
||||
}); |
|
||||
|
|
||||
afterEach(function () { |
afterEach(function () { |
||||
delete this.view; |
delete this.view; |
||||
}); |
}); |
||||
|
|
||||
after(function () { |
after(function () { |
||||
this.$fixture.remove(); |
this.$fixture.remove(); |
||||
}); |
}); |
||||
|
|
||||
it('Object exists', function() { |
it('Object exists', function() { |
||||
AssetImageView.should.be.exist; |
AssetImageView.should.be.exist; |
||||
}); |
}); |
||||
|
|
||||
describe('Asset should be rendered correctly', function() { |
describe('Asset should be rendered correctly', function() { |
||||
|
|
||||
it('Has preview box', function() { |
it('Has preview box', function() { |
||||
var $asset = this.view.$el; |
var $asset = this.view.$el; |
||||
$asset.find('#preview').should.have.property(0); |
$asset.find('#preview').should.have.property(0); |
||||
}); |
}); |
||||
|
|
||||
it('Has meta box', function() { |
it('Has meta box', function() { |
||||
var $asset = this.view.$el; |
var $asset = this.view.$el; |
||||
$asset.find('#meta').should.have.property(0); |
$asset.find('#meta').should.have.property(0); |
||||
}); |
}); |
||||
|
|
||||
it('Has close button', function() { |
it('Has close button', function() { |
||||
var $asset = this.view.$el; |
var $asset = this.view.$el; |
||||
$asset.find('#close').should.have.property(0); |
$asset.find('#close').should.have.property(0); |
||||
}); |
}); |
||||
|
|
||||
}); |
}); |
||||
|
|
||||
it('Could be selected', function() { |
it('Could be selected', function() { |
||||
sinon.stub(this.view, 'updateTarget'); |
sinon.stub(this.view, 'updateTarget'); |
||||
this.view.$el.trigger('click'); |
this.view.$el.trigger('click'); |
||||
this.view.$el.attr('class').should.contain('highlight'); |
this.view.$el.attr('class').should.contain('highlight'); |
||||
this.view.updateTarget.calledOnce.should.equal(true); |
this.view.updateTarget.calledOnce.should.equal(true); |
||||
}); |
}); |
||||
|
|
||||
it('Could be chosen', function() { |
it('Could be chosen', function() { |
||||
sinon.stub(this.view, 'updateTarget'); |
sinon.stub(this.view, 'updateTarget'); |
||||
this.view.$el.trigger('dblclick'); |
this.view.$el.trigger('dblclick'); |
||||
this.view.updateTarget.calledOnce.should.equal(true); |
this.view.updateTarget.calledOnce.should.equal(true); |
||||
}); |
}); |
||||
|
|
||||
|
it('Could be removed', function() { |
||||
|
var spy = sinon.spy(); |
||||
|
this.view.model.on("remove", spy); |
||||
|
this.view.$el.find('#close').trigger('click'); |
||||
|
spy.called.should.equal(true); |
||||
|
}); |
||||
|
|
||||
it('Could be removed', function() { |
|
||||
var spy = sinon.spy(); |
|
||||
this.view.model.on("remove", spy); |
|
||||
this.view.$el.find('#close').trigger('click'); |
|
||||
spy.called.should.equal(true); |
|
||||
}); |
}); |
||||
|
|
||||
}); |
} |
||||
}); |
}; |
||||
}); |
}); |
||||
@ -1,42 +1,45 @@ |
|||||
define(['AssetManager/view/AssetView', 'AssetManager/model/Asset', 'AssetManager/model/Assets'], |
define(['AssetManager/view/AssetView', 'AssetManager/model/Asset', 'AssetManager/model/Assets'], |
||||
function(AssetView, Asset, Assets) { |
function(AssetView, Asset, Assets) { |
||||
|
|
||||
describe('Asset Manager', function() { |
return { |
||||
|
run: function() { |
||||
|
|
||||
describe('AssetView', function() { |
describe('AssetView', function() { |
||||
|
|
||||
before(function () { |
before(function () { |
||||
this.$fixtures = $("#fixtures"); |
this.$fixtures = $("#fixtures"); |
||||
this.$fixture = $('<div class="asset-fixture"></div>'); |
this.$fixture = $('<div class="asset-fixture"></div>'); |
||||
}); |
}); |
||||
|
|
||||
beforeEach(function () { |
beforeEach(function () { |
||||
var coll = new Assets(); |
var coll = new Assets(); |
||||
var model = coll.add({src: 'test'}); |
var model = coll.add({src: 'test'}); |
||||
this.view = new AssetView({ |
this.view = new AssetView({ |
||||
config : {}, |
config : {}, |
||||
model: model |
model: model |
||||
|
}); |
||||
|
this.$fixture.empty().appendTo(this.$fixtures); |
||||
|
this.$fixture.html(this.view.render().el); |
||||
}); |
}); |
||||
this.$fixture.empty().appendTo(this.$fixtures); |
|
||||
this.$fixture.html(this.view.render().el); |
|
||||
}); |
|
||||
|
|
||||
afterEach(function () { |
afterEach(function () { |
||||
this.view.remove(); |
this.view.remove(); |
||||
}); |
}); |
||||
|
|
||||
after(function () { |
after(function () { |
||||
this.$fixture.remove(); |
this.$fixture.remove(); |
||||
}); |
}); |
||||
|
|
||||
it('Object exists', function() { |
it('Object exists', function() { |
||||
AssetView.should.be.exist; |
AssetView.should.be.exist; |
||||
}); |
}); |
||||
|
|
||||
|
it('Has correct prefix', function() { |
||||
|
this.view.pfx.should.equal(''); |
||||
|
}); |
||||
|
|
||||
it('Has correct prefix', function() { |
|
||||
this.view.pfx.should.equal(''); |
|
||||
}); |
}); |
||||
|
|
||||
}); |
} |
||||
}); |
} |
||||
}); |
}); |
||||
@ -1,104 +1,107 @@ |
|||||
define(['AssetManager/view/AssetsView', 'AssetManager/model/Assets'], |
define(['AssetManager/view/AssetsView', 'AssetManager/model/Assets'], |
||||
function(AssetsView, Assets) { |
function(AssetsView, Assets) { |
||||
|
|
||||
describe('Asset Manager', function() { |
return { |
||||
|
run: function() { |
||||
|
|
||||
describe('AssetsView', function() { |
describe('AssetsView', function() { |
||||
|
|
||||
var obj; |
var obj; |
||||
|
|
||||
before(function () { |
before(function () { |
||||
this.$fixtures = $("#fixtures"); |
this.$fixtures = $("#fixtures"); |
||||
this.$fixture = $('<div class="assets-fixture"></div>'); |
this.$fixture = $('<div class="assets-fixture"></div>'); |
||||
}); |
}); |
||||
|
|
||||
beforeEach(function () { |
beforeEach(function () { |
||||
this.coll = new Assets([]); |
this.coll = new Assets([]); |
||||
this.view = new AssetsView({ |
this.view = new AssetsView({ |
||||
config : {}, |
config : {}, |
||||
collection: this.coll |
collection: this.coll |
||||
|
}); |
||||
|
obj = this.view; |
||||
|
this.$fixture.empty().appendTo(this.$fixtures); |
||||
|
this.$fixture.html(this.view.render().el); |
||||
}); |
}); |
||||
obj = this.view; |
|
||||
this.$fixture.empty().appendTo(this.$fixtures); |
|
||||
this.$fixture.html(this.view.render().el); |
|
||||
}); |
|
||||
|
|
||||
afterEach(function () { |
afterEach(function () { |
||||
this.view.collection.reset(); |
this.view.collection.reset(); |
||||
}); |
}); |
||||
|
|
||||
after(function () { |
after(function () { |
||||
this.$fixture.remove(); |
this.$fixture.remove(); |
||||
}); |
}); |
||||
|
|
||||
it('Object exists', function() { |
it('Object exists', function() { |
||||
AssetsView.should.be.exist; |
AssetsView.should.be.exist; |
||||
}); |
}); |
||||
|
|
||||
it("Collection is empty", function (){ |
it("Collection is empty", function (){ |
||||
this.view.getAssetsEl().innerHTML.should.be.empty; |
this.view.getAssetsEl().innerHTML.should.be.empty; |
||||
}); |
}); |
||||
|
|
||||
it("Add new asset", function (){ |
it("Add new asset", function (){ |
||||
sinon.stub(this.view, "addAsset"); |
sinon.stub(this.view, "addAsset"); |
||||
this.coll.add({src: 'test'}); |
this.coll.add({src: 'test'}); |
||||
this.view.addAsset.calledOnce.should.equal(true); |
this.view.addAsset.calledOnce.should.equal(true); |
||||
}); |
}); |
||||
|
|
||||
it("Render new asset", function (){ |
it("Render new asset", function (){ |
||||
this.coll.add({src: 'test'}); |
this.coll.add({src: 'test'}); |
||||
this.view.getAssetsEl().innerHTML.should.not.be.empty; |
this.view.getAssetsEl().innerHTML.should.not.be.empty; |
||||
}); |
}); |
||||
|
|
||||
it("Render correctly new image asset", function (){ |
it("Render correctly new image asset", function (){ |
||||
this.coll.add({ type: 'image', src: 'test'}); |
this.coll.add({ type: 'image', src: 'test'}); |
||||
var asset = this.view.getAssetsEl().firstChild; |
var asset = this.view.getAssetsEl().firstChild; |
||||
asset.tagName.should.equal('DIV'); |
asset.tagName.should.equal('DIV'); |
||||
asset.innerHTML.should.not.be.empty; |
asset.innerHTML.should.not.be.empty; |
||||
}); |
}); |
||||
|
|
||||
it("Clean collection from asset", function (){ |
it("Clean collection from asset", function (){ |
||||
var model = this.coll.add({src: 'test'}); |
var model = this.coll.add({src: 'test'}); |
||||
this.coll.remove(model); |
this.coll.remove(model); |
||||
this.view.getAssetsEl().innerHTML.should.be.empty; |
this.view.getAssetsEl().innerHTML.should.be.empty; |
||||
}); |
}); |
||||
|
|
||||
it("Load no assets", function (){ |
it("Load no assets", function (){ |
||||
(this.view.load() === null).should.be.true; |
(this.view.load() === null).should.be.true; |
||||
}); |
}); |
||||
|
|
||||
it("Load assets", function (){ |
it("Load assets", function (){ |
||||
var obj = { test: '1' }; |
var obj = { test: '1' }; |
||||
this.view.storagePrv = { load : function(){} }; |
this.view.storagePrv = { load : function(){} }; |
||||
sinon.stub(this.view.storagePrv, "load").returns(obj); |
sinon.stub(this.view.storagePrv, "load").returns(obj); |
||||
this.view.load().should.equal(obj); |
this.view.load().should.equal(obj); |
||||
}); |
}); |
||||
|
|
||||
it("Deselect works", function (){ |
it("Deselect works", function (){ |
||||
this.coll.add([{},{}]); |
this.coll.add([{},{}]); |
||||
var $asset = this.view.$el.children().first(); |
var $asset = this.view.$el.children().first(); |
||||
$asset.attr('class', this.view.pfx + 'highlight'); |
$asset.attr('class', this.view.pfx + 'highlight'); |
||||
this.coll.trigger('deselectAll'); |
this.coll.trigger('deselectAll'); |
||||
$asset.attr('class').should.be.empty; |
$asset.attr('class').should.be.empty; |
||||
}); |
}); |
||||
|
|
||||
it("Returns not empty assets element", function (){ |
it("Returns not empty assets element", function (){ |
||||
obj.getAssetsEl().should.be.ok; |
obj.getAssetsEl().should.be.ok; |
||||
}); |
}); |
||||
|
|
||||
it("Returns not empty url input", function (){ |
it("Returns not empty url input", function (){ |
||||
obj.getInputUrl().should.be.ok; |
obj.getInputUrl().should.be.ok; |
||||
}); |
}); |
||||
|
|
||||
it("Add image asset from input string", function (){ |
it("Add image asset from input string", function (){ |
||||
obj.getInputUrl().value = "test"; |
obj.getInputUrl().value = "test"; |
||||
obj.addFromStr({ |
obj.addFromStr({ |
||||
preventDefault: function(){} |
preventDefault: function(){} |
||||
|
}); |
||||
|
var asset = obj.collection.at(0); |
||||
|
asset.get('src').should.equal('test'); |
||||
}); |
}); |
||||
var asset = obj.collection.at(0); |
|
||||
asset.get('src').should.equal('test'); |
|
||||
}); |
}); |
||||
|
|
||||
}); |
} |
||||
}); |
} |
||||
}); |
}); |
||||
@ -1,77 +1,79 @@ |
|||||
define(['AssetManager/view/FileUploader'], |
define(['AssetManager/view/FileUploader'], |
||||
function(FileUploader) { |
function(FileUploader) { |
||||
|
|
||||
describe('Asset Manager', function() { |
return { |
||||
|
run: function() { |
||||
|
|
||||
describe('File Uploader', function() { |
describe('File Uploader', function() { |
||||
|
|
||||
before(function () { |
before(function () { |
||||
this.$fixtures = $("#fixtures"); |
this.$fixtures = $("#fixtures"); |
||||
this.$fixture = $('<div class="fileupload-fixture"></div>'); |
this.$fixture = $('<div class="fileupload-fixture"></div>'); |
||||
}); |
}); |
||||
|
|
||||
beforeEach(function () { |
beforeEach(function () { |
||||
this.view = new FileUploader({ config : {} }); |
this.view = new FileUploader({ config : {} }); |
||||
this.$fixture.empty().appendTo(this.$fixtures); |
this.$fixture.empty().appendTo(this.$fixtures); |
||||
this.$fixture.html(this.view.render().el); |
this.$fixture.html(this.view.render().el); |
||||
}); |
}); |
||||
|
|
||||
afterEach(function () { |
afterEach(function () { |
||||
this.view.remove(); |
this.view.remove(); |
||||
}); |
}); |
||||
|
|
||||
after(function () { |
after(function () { |
||||
this.$fixture.remove(); |
this.$fixture.remove(); |
||||
}); |
}); |
||||
|
|
||||
it('Object exists', function() { |
it('Object exists', function() { |
||||
FileUploader.should.be.exist; |
FileUploader.should.be.exist; |
||||
}); |
}); |
||||
|
|
||||
it('Has correct prefix', function() { |
it('Has correct prefix', function() { |
||||
this.view.pfx.should.equal(''); |
this.view.pfx.should.equal(''); |
||||
}); |
}); |
||||
|
|
||||
describe('Should be rendered correctly', function() { |
describe('Should be rendered correctly', function() { |
||||
|
|
||||
it('Has title', function() { |
it('Has title', function() { |
||||
this.view.$el.find('#title').should.have.property(0); |
this.view.$el.find('#title').should.have.property(0); |
||||
}); |
}); |
||||
|
|
||||
it('Title is empty', function() { |
it('Title is empty', function() { |
||||
this.view.$el.find('#title').html().should.equal(''); |
this.view.$el.find('#title').html().should.equal(''); |
||||
}); |
}); |
||||
|
|
||||
it('Has file input', function() { |
it('Has file input', function() { |
||||
this.view.$el.find('input[type=file]').should.have.property(0); |
this.view.$el.find('input[type=file]').should.have.property(0); |
||||
}); |
}); |
||||
|
|
||||
it('File input is enabled', function() { |
it('File input is enabled', function() { |
||||
this.view.$el.find('input[type=file]').prop('disabled').should.equal(false); |
this.view.$el.find('input[type=file]').prop('disabled').should.equal(false); |
||||
}); |
}); |
||||
|
|
||||
}); |
}); |
||||
|
|
||||
describe('Interprets configurations correctly', function() { |
describe('Interprets configurations correctly', function() { |
||||
|
|
||||
it('Has correct title', function() { |
it('Has correct title', function() { |
||||
var view = new FileUploader({ config : { |
var view = new FileUploader({ config : { |
||||
uploadText : 'Test', |
uploadText : 'Test', |
||||
} }); |
} }); |
||||
view.render(); |
view.render(); |
||||
view.$el.find('#title').html().should.equal('Test'); |
view.$el.find('#title').html().should.equal('Test'); |
||||
}); |
}); |
||||
|
|
||||
it('Could be disabled', function() { |
it('Could be disabled', function() { |
||||
var view = new FileUploader({ config : { |
var view = new FileUploader({ config : { |
||||
disableUpload: true, |
disableUpload: true, |
||||
} }); |
} }); |
||||
view.render(); |
view.render(); |
||||
view.$el.find('input[type=file]').prop('disabled').should.equal(true); |
view.$el.find('input[type=file]').prop('disabled').should.equal(true); |
||||
}); |
}); |
||||
|
|
||||
}); |
}); |
||||
|
|
||||
}); |
}); |
||||
}); |
} |
||||
|
} |
||||
}); |
}); |
||||
Loading…
Reference in new issue