Skip to content
This repository has been archived by the owner on Jun 27, 2018. It is now read-only.

Commit

Permalink
Fix bug with updating zero index
Browse files Browse the repository at this point in the history
  • Loading branch information
fzaninotto committed Oct 2, 2015
1 parent b00d3f1 commit d112b8f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/Application.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Application {
// If the view or the entity don't define the url, retrieve it from the baseURL of the entity or the app
if (!url) {
url = baseApiUrl + entity.name();
if (identifierValue) {
if (identifierValue != null) {
url += '/' + identifierValue;
}
} else if (!/^(?:[a-z]+:)?\/\//.test(url)) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "admin-config",
"version": "0.5.0",
"version": "0.5.1",
"private": false,
"repository": {
"type": "git",
Expand Down
11 changes: 9 additions & 2 deletions tests/lib/ApplicationTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ describe('Application', function() {
assert.equal('posts/12', application.getRouteFor(entity, view.getUrl(12), view.type, 12, view.identifier()));
});

it('should work for zero indentifier', function() {
var application = new Application();
var entity = new Entity('posts');
application.addEntity(entity);
assert.equal('posts/0', application.getRouteFor(entity, null, null, 0, null));
});

it('should use the application baseApiUrl when provided', function() {
var application = new Application();
application.baseApiUrl('/foo/');
Expand Down Expand Up @@ -231,7 +238,7 @@ describe('Application', function() {

it('should serve as a setter', () => {
let dashboard = new Dashboard();
const collection = { IAmAFakeCollection: true, name: () => 'foo' };
const collection = { IAmAFakeCollection: true, name: () => 'foo' };
dashboard.addCollection(collection)
let application = new Application();
application.dashboard(dashboard);
Expand Down Expand Up @@ -270,7 +277,7 @@ describe('Application', function() {
new Field('field1'),
new Field('field2'),
new Field('field3'),
new Field('field4')
new Field('field4')
];

comment.listView().fields(fields);
Expand Down

0 comments on commit d112b8f

Please sign in to comment.