mirror of https://github.com/artf/grapesjs.git
15 changed files with 180 additions and 81 deletions
File diff suppressed because one or more lines are too long
@ -1,18 +1,16 @@ |
|||
define(['backbone', './Asset'], |
|||
define(['backbone', './Asset'], |
|||
function (Backbone, Asset) { |
|||
/** |
|||
* @class AssetImage |
|||
* */ |
|||
return Asset.extend({ |
|||
|
|||
defaults: _.extend({},Asset.prototype.defaults, |
|||
{ |
|||
type: 'image', |
|||
unitDim: 'px', |
|||
height: 0, |
|||
width: 0, |
|||
} |
|||
), |
|||
|
|||
return Asset.extend({ |
|||
|
|||
defaults: _.extend({}, Asset.prototype.defaults, { |
|||
type: 'image', |
|||
unitDim: 'px', |
|||
height: 0, |
|||
width: 0, |
|||
}), |
|||
|
|||
}); |
|||
}); |
|||
|
|||
@ -1,35 +1,35 @@ |
|||
define(['AssetManager/model/Asset'], |
|||
function(Asset) { |
|||
|
|||
|
|||
describe('Asset Manager', function() { |
|||
|
|||
|
|||
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("none"); |
|||
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 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(''); |
|||
}); |
|||
|
|||
|
|||
}); |
|||
}); |
|||
}); |
|||
Loading…
Reference in new issue