diff --git a/examples/blog/config.js b/examples/blog/config.js index 2aa6297e..91c16db1 100644 --- a/examples/blog/config.js +++ b/examples/blog/config.js @@ -132,6 +132,7 @@ .targetEntity(comment) .targetReferenceField('post_id') .targetFields([ + nga.field('id').isDetailLink(true), nga.field('created_at').label('Posted'), nga.field('body').label('Comment') ]) diff --git a/src/javascripts/test/e2e/EditionViewSpec.js b/src/javascripts/test/e2e/EditionViewSpec.js index c6d81b5a..9b006e26 100644 --- a/src/javascripts/test/e2e/EditionViewSpec.js +++ b/src/javascripts/test/e2e/EditionViewSpec.js @@ -66,4 +66,17 @@ describe('EditionView', function () { }); }); }); + + describe('DetailLink', function() { + beforeEach(function() { + browser.baseUrl + '#/posts/edit/1'; + }); + + it('should redirect to corresponding detail view even for referenced_list entity', function () { + $$('#row-comments td a').first().click(); + browser.getLocationAbsUrl().then(function(url){ + expect(url).toContain('/comments/edit/'); + }); + }); + }); }); diff --git a/src/javascripts/test/e2e/ShowViewSpec.js b/src/javascripts/test/e2e/ShowViewSpec.js index a0c74258..d787f547 100644 --- a/src/javascripts/test/e2e/ShowViewSpec.js +++ b/src/javascripts/test/e2e/ShowViewSpec.js @@ -26,10 +26,11 @@ describe('ShowView', function () { describe('ReferencedListField', function() { it('should render as a datagrid', function () { $$('.ng-admin-field-comments th').then(function (inputs) { - expect(inputs.length).toBe(2); + expect(inputs.length).toBe(3); - expect(inputs[0].getAttribute('class')).toBe('ng-scope ng-admin-column-created_at'); - expect(inputs[1].getAttribute('class')).toBe('ng-scope ng-admin-column-body'); + expect(inputs[0].getAttribute('class')).toBe('ng-scope ng-admin-column-id'); + expect(inputs[1].getAttribute('class')).toBe('ng-scope ng-admin-column-created_at'); + expect(inputs[2].getAttribute('class')).toBe('ng-scope ng-admin-column-body'); }); }); });