Merge pull request #729 from strongloop/feature/expose-path-to-default-favicon
Expose path to the built-in favicon file
This commit is contained in:
commit
7798403d58
|
@ -126,6 +126,25 @@ if (loopback.isServer) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Expose path to the default favicon file
|
||||||
|
*
|
||||||
|
* ***only in node***
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (loopback.isServer) {
|
||||||
|
/**
|
||||||
|
* Path to a default favicon shipped with LoopBack.
|
||||||
|
*
|
||||||
|
* **Example**
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* app.use(require('serve-favicon')(loopback.faviconFile));
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
loopback.faviconFile = path.resolve(__dirname, '../favicon.ico');
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Error handler title
|
* Error handler title
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
var it = require('./util/it');
|
||||||
|
|
||||||
describe('loopback', function() {
|
describe('loopback', function() {
|
||||||
var nameCounter = 0;
|
var nameCounter = 0;
|
||||||
var uniqueModelName;
|
var uniqueModelName;
|
||||||
|
@ -11,6 +13,13 @@ describe('loopback', function() {
|
||||||
expect(loopback.ValidationError).to.be.a('function')
|
expect(loopback.ValidationError).to.be.a('function')
|
||||||
.and.have.property('name', 'ValidationError');
|
.and.have.property('name', 'ValidationError');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it.onServer('includes `faviconFile`', function() {
|
||||||
|
var file = loopback.faviconFile;
|
||||||
|
expect(file, 'faviconFile').to.not.equal(undefined);
|
||||||
|
expect(require('fs').existsSync(loopback.faviconFile), 'file exists')
|
||||||
|
.to.equal(true);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('loopback.createDataSource(options)', function() {
|
describe('loopback.createDataSource(options)', function() {
|
||||||
|
@ -68,11 +77,11 @@ describe('loopback', function() {
|
||||||
describe('loopback.remoteMethod(Model, fn, [options]);', function() {
|
describe('loopback.remoteMethod(Model, fn, [options]);', function() {
|
||||||
it("Setup a remote method.", function() {
|
it("Setup a remote method.", function() {
|
||||||
var Product = loopback.createModel('product', {price: Number});
|
var Product = loopback.createModel('product', {price: Number});
|
||||||
|
|
||||||
Product.stats = function(fn) {
|
Product.stats = function(fn) {
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
|
|
||||||
loopback.remoteMethod(
|
loopback.remoteMethod(
|
||||||
Product.stats,
|
Product.stats,
|
||||||
{
|
{
|
||||||
|
@ -80,7 +89,7 @@ describe('loopback', function() {
|
||||||
http: {path: '/info', verb: 'get'}
|
http: {path: '/info', verb: 'get'}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.equal(Product.stats.returns.arg, 'stats');
|
assert.equal(Product.stats.returns.arg, 'stats');
|
||||||
assert.equal(Product.stats.returns.type, 'array');
|
assert.equal(Product.stats.returns.type, 'array');
|
||||||
assert.equal(Product.stats.http.path, '/info');
|
assert.equal(Product.stats.http.path, '/info');
|
||||||
|
|
Loading…
Reference in New Issue