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'], |
|||
function(Asset) { |
|||
|
|||
describe('Asset Manager', function() { |
|||
return { |
|||
run: function(){ |
|||
|
|||
describe('Asset', function() { |
|||
it('Object exists', function() { |
|||
Asset.should.be.exist; |
|||
}); |
|||
describe('Asset', function() { |
|||
it('Object exists', function() { |
|||
Asset.should.be.exist; |
|||
}); |
|||
|
|||
it('Has default values', function() { |
|||
var obj = new Asset({}); |
|||
obj.get('type').should.equal(""); |
|||
obj.get('src').should.equal(""); |
|||
obj.getExtension().should.be.empty; |
|||
obj.getFilename().should.be.empty; |
|||
}); |
|||
it('Has default values', function() { |
|||
var obj = new Asset({}); |
|||
obj.get('type').should.equal(""); |
|||
obj.get('src').should.equal(""); |
|||
obj.getExtension().should.be.empty; |
|||
obj.getFilename().should.be.empty; |
|||
}); |
|||
|
|||
it('Test getFilename', function() { |
|||
var obj = new Asset({ type:'image', src: 'ch/eck/t.e.s.t'}); |
|||
obj.getFilename().should.equal('t.e.s.t'); |
|||
var obj = new Asset({ type:'image', src: 'ch/eck/1234abc'}); |
|||
obj.getFilename().should.equal('1234abc'); |
|||
}); |
|||
it('Test getFilename', function() { |
|||
var obj = new Asset({ type:'image', src: 'ch/eck/t.e.s.t'}); |
|||
obj.getFilename().should.equal('t.e.s.t'); |
|||
var obj = new Asset({ type:'image', src: 'ch/eck/1234abc'}); |
|||
obj.getFilename().should.equal('1234abc'); |
|||
}); |
|||
|
|||
it('Test getExtension', function() { |
|||
var obj = new Asset({ type:'image', src: 'ch/eck/t.e.s.t'}); |
|||
obj.getExtension().should.equal('t'); |
|||
var obj = new Asset({ type:'image', src: 'ch/eck/1234abc.'}); |
|||
obj.getExtension().should.equal(''); |
|||
it('Test getExtension', function() { |
|||
var obj = new Asset({ type:'image', src: 'ch/eck/t.e.s.t'}); |
|||
obj.getExtension().should.equal('t'); |
|||
var obj = new Asset({ type:'image', src: 'ch/eck/1234abc.'}); |
|||
obj.getExtension().should.equal(''); |
|||
}); |
|||
}); |
|||
|
|||
}); |
|||
}); |
|||
} |
|||
} |
|||
}); |
|||
@ -1,24 +1,27 @@ |
|||
define(['AssetManager/model/AssetImage'], |
|||
function(AssetImage) { |
|||
|
|||
describe('Asset Manager', function() { |
|||
return { |
|||
run: function() { |
|||
|
|||
describe('AssetImage', function() { |
|||
it('Object exists', function() { |
|||
AssetImage.should.be.exist; |
|||
}); |
|||
describe('AssetImage', function() { |
|||
it('Object exists', function() { |
|||
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'], |
|||
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'], |
|||
function(AssetImageView, AssetImage, Assets) { |
|||
|
|||
describe('Asset Manager', function() { |
|||
return { |
|||
run: function() { |
|||
|
|||
describe('AssetImageView', function() { |
|||
describe('AssetImageView', function() { |
|||
|
|||
before(function () { |
|||
this.$fixtures = $("#fixtures"); |
|||
this.$fixture = $('<div class="asset-fixture"></div>'); |
|||
}); |
|||
before(function () { |
|||
this.$fixtures = $("#fixtures"); |
|||
this.$fixture = $('<div class="asset-fixture"></div>'); |
|||
}); |
|||
|
|||
beforeEach(function () { |
|||
var coll = new Assets(); |
|||
var model = coll.add({ type:'image', src: '/test' }); |
|||
this.view = new AssetImageView({ |
|||
config : {}, |
|||
model: model |
|||
beforeEach(function () { |
|||
var coll = new Assets(); |
|||
var model = coll.add({ type:'image', src: '/test' }); |
|||
this.view = new AssetImageView({ |
|||
config : {}, |
|||
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 () { |
|||
delete this.view; |
|||
}); |
|||
afterEach(function () { |
|||
delete this.view; |
|||
}); |
|||
|
|||
after(function () { |
|||
this.$fixture.remove(); |
|||
}); |
|||
after(function () { |
|||
this.$fixture.remove(); |
|||
}); |
|||
|
|||
it('Object exists', function() { |
|||
AssetImageView.should.be.exist; |
|||
}); |
|||
it('Object exists', function() { |
|||
AssetImageView.should.be.exist; |
|||
}); |
|||
|
|||
describe('Asset should be rendered correctly', function() { |
|||
describe('Asset should be rendered correctly', function() { |
|||
|
|||
it('Has preview box', function() { |
|||
var $asset = this.view.$el; |
|||
$asset.find('#preview').should.have.property(0); |
|||
}); |
|||
it('Has preview box', function() { |
|||
var $asset = this.view.$el; |
|||
$asset.find('#preview').should.have.property(0); |
|||
}); |
|||
|
|||
it('Has meta box', function() { |
|||
var $asset = this.view.$el; |
|||
$asset.find('#meta').should.have.property(0); |
|||
}); |
|||
it('Has meta box', function() { |
|||
var $asset = this.view.$el; |
|||
$asset.find('#meta').should.have.property(0); |
|||
}); |
|||
|
|||
it('Has close button', function() { |
|||
var $asset = this.view.$el; |
|||
$asset.find('#close').should.have.property(0); |
|||
}); |
|||
it('Has close button', function() { |
|||
var $asset = this.view.$el; |
|||
$asset.find('#close').should.have.property(0); |
|||
}); |
|||
|
|||
}); |
|||
}); |
|||
|
|||
it('Could be selected', function() { |
|||
sinon.stub(this.view, 'updateTarget'); |
|||
this.view.$el.trigger('click'); |
|||
this.view.$el.attr('class').should.contain('highlight'); |
|||
this.view.updateTarget.calledOnce.should.equal(true); |
|||
}); |
|||
it('Could be selected', function() { |
|||
sinon.stub(this.view, 'updateTarget'); |
|||
this.view.$el.trigger('click'); |
|||
this.view.$el.attr('class').should.contain('highlight'); |
|||
this.view.updateTarget.calledOnce.should.equal(true); |
|||
}); |
|||
|
|||
it('Could be chosen', function() { |
|||
sinon.stub(this.view, 'updateTarget'); |
|||
this.view.$el.trigger('dblclick'); |
|||
this.view.updateTarget.calledOnce.should.equal(true); |
|||
}); |
|||
it('Could be chosen', function() { |
|||
sinon.stub(this.view, 'updateTarget'); |
|||
this.view.$el.trigger('dblclick'); |
|||
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'], |
|||
function(AssetView, Asset, Assets) { |
|||
|
|||
describe('Asset Manager', function() { |
|||
return { |
|||
run: function() { |
|||
|
|||
describe('AssetView', function() { |
|||
describe('AssetView', function() { |
|||
|
|||
before(function () { |
|||
this.$fixtures = $("#fixtures"); |
|||
this.$fixture = $('<div class="asset-fixture"></div>'); |
|||
}); |
|||
before(function () { |
|||
this.$fixtures = $("#fixtures"); |
|||
this.$fixture = $('<div class="asset-fixture"></div>'); |
|||
}); |
|||
|
|||
beforeEach(function () { |
|||
var coll = new Assets(); |
|||
var model = coll.add({src: 'test'}); |
|||
this.view = new AssetView({ |
|||
config : {}, |
|||
model: model |
|||
beforeEach(function () { |
|||
var coll = new Assets(); |
|||
var model = coll.add({src: 'test'}); |
|||
this.view = new AssetView({ |
|||
config : {}, |
|||
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 () { |
|||
this.view.remove(); |
|||
}); |
|||
afterEach(function () { |
|||
this.view.remove(); |
|||
}); |
|||
|
|||
after(function () { |
|||
this.$fixture.remove(); |
|||
}); |
|||
after(function () { |
|||
this.$fixture.remove(); |
|||
}); |
|||
|
|||
it('Object exists', function() { |
|||
AssetView.should.be.exist; |
|||
}); |
|||
it('Object exists', function() { |
|||
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'], |
|||
function(AssetsView, Assets) { |
|||
|
|||
describe('Asset Manager', function() { |
|||
return { |
|||
run: function() { |
|||
|
|||
describe('AssetsView', function() { |
|||
describe('AssetsView', function() { |
|||
|
|||
var obj; |
|||
var obj; |
|||
|
|||
before(function () { |
|||
this.$fixtures = $("#fixtures"); |
|||
this.$fixture = $('<div class="assets-fixture"></div>'); |
|||
}); |
|||
before(function () { |
|||
this.$fixtures = $("#fixtures"); |
|||
this.$fixture = $('<div class="assets-fixture"></div>'); |
|||
}); |
|||
|
|||
beforeEach(function () { |
|||
this.coll = new Assets([]); |
|||
this.view = new AssetsView({ |
|||
config : {}, |
|||
collection: this.coll |
|||
beforeEach(function () { |
|||
this.coll = new Assets([]); |
|||
this.view = new AssetsView({ |
|||
config : {}, |
|||
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 () { |
|||
this.view.collection.reset(); |
|||
}); |
|||
afterEach(function () { |
|||
this.view.collection.reset(); |
|||
}); |
|||
|
|||
after(function () { |
|||
this.$fixture.remove(); |
|||
}); |
|||
after(function () { |
|||
this.$fixture.remove(); |
|||
}); |
|||
|
|||
it('Object exists', function() { |
|||
AssetsView.should.be.exist; |
|||
}); |
|||
it('Object exists', function() { |
|||
AssetsView.should.be.exist; |
|||
}); |
|||
|
|||
it("Collection is empty", function (){ |
|||
this.view.getAssetsEl().innerHTML.should.be.empty; |
|||
}); |
|||
it("Collection is empty", function (){ |
|||
this.view.getAssetsEl().innerHTML.should.be.empty; |
|||
}); |
|||
|
|||
it("Add new asset", function (){ |
|||
sinon.stub(this.view, "addAsset"); |
|||
this.coll.add({src: 'test'}); |
|||
this.view.addAsset.calledOnce.should.equal(true); |
|||
}); |
|||
it("Add new asset", function (){ |
|||
sinon.stub(this.view, "addAsset"); |
|||
this.coll.add({src: 'test'}); |
|||
this.view.addAsset.calledOnce.should.equal(true); |
|||
}); |
|||
|
|||
it("Render new asset", function (){ |
|||
this.coll.add({src: 'test'}); |
|||
this.view.getAssetsEl().innerHTML.should.not.be.empty; |
|||
}); |
|||
it("Render new asset", function (){ |
|||
this.coll.add({src: 'test'}); |
|||
this.view.getAssetsEl().innerHTML.should.not.be.empty; |
|||
}); |
|||
|
|||
it("Render correctly new image asset", function (){ |
|||
this.coll.add({ type: 'image', src: 'test'}); |
|||
var asset = this.view.getAssetsEl().firstChild; |
|||
asset.tagName.should.equal('DIV'); |
|||
asset.innerHTML.should.not.be.empty; |
|||
}); |
|||
it("Render correctly new image asset", function (){ |
|||
this.coll.add({ type: 'image', src: 'test'}); |
|||
var asset = this.view.getAssetsEl().firstChild; |
|||
asset.tagName.should.equal('DIV'); |
|||
asset.innerHTML.should.not.be.empty; |
|||
}); |
|||
|
|||
it("Clean collection from asset", function (){ |
|||
var model = this.coll.add({src: 'test'}); |
|||
this.coll.remove(model); |
|||
this.view.getAssetsEl().innerHTML.should.be.empty; |
|||
}); |
|||
it("Clean collection from asset", function (){ |
|||
var model = this.coll.add({src: 'test'}); |
|||
this.coll.remove(model); |
|||
this.view.getAssetsEl().innerHTML.should.be.empty; |
|||
}); |
|||
|
|||
it("Load no assets", function (){ |
|||
(this.view.load() === null).should.be.true; |
|||
}); |
|||
it("Load no assets", function (){ |
|||
(this.view.load() === null).should.be.true; |
|||
}); |
|||
|
|||
it("Load assets", function (){ |
|||
var obj = { test: '1' }; |
|||
this.view.storagePrv = { load : function(){} }; |
|||
sinon.stub(this.view.storagePrv, "load").returns(obj); |
|||
this.view.load().should.equal(obj); |
|||
}); |
|||
it("Load assets", function (){ |
|||
var obj = { test: '1' }; |
|||
this.view.storagePrv = { load : function(){} }; |
|||
sinon.stub(this.view.storagePrv, "load").returns(obj); |
|||
this.view.load().should.equal(obj); |
|||
}); |
|||
|
|||
it("Deselect works", function (){ |
|||
this.coll.add([{},{}]); |
|||
var $asset = this.view.$el.children().first(); |
|||
$asset.attr('class', this.view.pfx + 'highlight'); |
|||
this.coll.trigger('deselectAll'); |
|||
$asset.attr('class').should.be.empty; |
|||
}); |
|||
it("Deselect works", function (){ |
|||
this.coll.add([{},{}]); |
|||
var $asset = this.view.$el.children().first(); |
|||
$asset.attr('class', this.view.pfx + 'highlight'); |
|||
this.coll.trigger('deselectAll'); |
|||
$asset.attr('class').should.be.empty; |
|||
}); |
|||
|
|||
it("Returns not empty assets element", function (){ |
|||
obj.getAssetsEl().should.be.ok; |
|||
}); |
|||
it("Returns not empty assets element", function (){ |
|||
obj.getAssetsEl().should.be.ok; |
|||
}); |
|||
|
|||
it("Returns not empty url input", function (){ |
|||
obj.getInputUrl().should.be.ok; |
|||
}); |
|||
it("Returns not empty url input", function (){ |
|||
obj.getInputUrl().should.be.ok; |
|||
}); |
|||
|
|||
it("Add image asset from input string", function (){ |
|||
obj.getInputUrl().value = "test"; |
|||
obj.addFromStr({ |
|||
preventDefault: function(){} |
|||
it("Add image asset from input string", function (){ |
|||
obj.getInputUrl().value = "test"; |
|||
obj.addFromStr({ |
|||
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'], |
|||
function(FileUploader) { |
|||
|
|||
describe('Asset Manager', function() { |
|||
return { |
|||
run: function() { |
|||
|
|||
describe('File Uploader', function() { |
|||
describe('File Uploader', function() { |
|||
|
|||
before(function () { |
|||
this.$fixtures = $("#fixtures"); |
|||
this.$fixture = $('<div class="fileupload-fixture"></div>'); |
|||
}); |
|||
before(function () { |
|||
this.$fixtures = $("#fixtures"); |
|||
this.$fixture = $('<div class="fileupload-fixture"></div>'); |
|||
}); |
|||
|
|||
beforeEach(function () { |
|||
this.view = new FileUploader({ config : {} }); |
|||
this.$fixture.empty().appendTo(this.$fixtures); |
|||
this.$fixture.html(this.view.render().el); |
|||
}); |
|||
beforeEach(function () { |
|||
this.view = new FileUploader({ config : {} }); |
|||
this.$fixture.empty().appendTo(this.$fixtures); |
|||
this.$fixture.html(this.view.render().el); |
|||
}); |
|||
|
|||
afterEach(function () { |
|||
this.view.remove(); |
|||
}); |
|||
afterEach(function () { |
|||
this.view.remove(); |
|||
}); |
|||
|
|||
after(function () { |
|||
this.$fixture.remove(); |
|||
}); |
|||
after(function () { |
|||
this.$fixture.remove(); |
|||
}); |
|||
|
|||
it('Object exists', function() { |
|||
FileUploader.should.be.exist; |
|||
}); |
|||
it('Object exists', function() { |
|||
FileUploader.should.be.exist; |
|||
}); |
|||
|
|||
it('Has correct prefix', function() { |
|||
this.view.pfx.should.equal(''); |
|||
}); |
|||
it('Has correct prefix', function() { |
|||
this.view.pfx.should.equal(''); |
|||
}); |
|||
|
|||
describe('Should be rendered correctly', function() { |
|||
describe('Should be rendered correctly', function() { |
|||
|
|||
it('Has title', function() { |
|||
this.view.$el.find('#title').should.have.property(0); |
|||
}); |
|||
it('Has title', function() { |
|||
this.view.$el.find('#title').should.have.property(0); |
|||
}); |
|||
|
|||
it('Title is empty', function() { |
|||
this.view.$el.find('#title').html().should.equal(''); |
|||
}); |
|||
it('Title is empty', function() { |
|||
this.view.$el.find('#title').html().should.equal(''); |
|||
}); |
|||
|
|||
it('Has file input', function() { |
|||
this.view.$el.find('input[type=file]').should.have.property(0); |
|||
}); |
|||
it('Has file input', function() { |
|||
this.view.$el.find('input[type=file]').should.have.property(0); |
|||
}); |
|||
|
|||
it('File input is enabled', function() { |
|||
this.view.$el.find('input[type=file]').prop('disabled').should.equal(false); |
|||
}); |
|||
it('File input is enabled', function() { |
|||
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() { |
|||
var view = new FileUploader({ config : { |
|||
uploadText : 'Test', |
|||
} }); |
|||
view.render(); |
|||
view.$el.find('#title').html().should.equal('Test'); |
|||
}); |
|||
it('Has correct title', function() { |
|||
var view = new FileUploader({ config : { |
|||
uploadText : 'Test', |
|||
} }); |
|||
view.render(); |
|||
view.$el.find('#title').html().should.equal('Test'); |
|||
}); |
|||
|
|||
it('Could be disabled', function() { |
|||
var view = new FileUploader({ config : { |
|||
disableUpload: true, |
|||
} }); |
|||
view.render(); |
|||
view.$el.find('input[type=file]').prop('disabled').should.equal(true); |
|||
}); |
|||
it('Could be disabled', function() { |
|||
var view = new FileUploader({ config : { |
|||
disableUpload: true, |
|||
} }); |
|||
view.render(); |
|||
view.$el.find('input[type=file]').prop('disabled').should.equal(true); |
|||
}); |
|||
|
|||
}); |
|||
}); |
|||
|
|||
}); |
|||
}); |
|||
}); |
|||
} |
|||
} |
|||
}); |
|||
Loading…
Reference in new issue