diff --git a/Resources/public/js/views/navigation/ez-navigationitemview.js b/Resources/public/js/views/navigation/ez-navigationitemview.js index 2edd9b95b..a8abfb096 100644 --- a/Resources/public/js/views/navigation/ez-navigationitemview.js +++ b/Resources/public/js/views/navigation/ez-navigationitemview.js @@ -24,7 +24,9 @@ YUI.add('ez-navigationitemview', function (Y) { */ Y.eZ.NavigationItemView = Y.Base.create('navigationItemView', Y.eZ.TemplateBasedView, [], { initializer: function () { - this.containerTemplate = '
  • '; + var dataNavigationIdentifier = 'data-navigation-item-identifier="' + this.get('identifier') + '"'; + + this.containerTemplate = '
  • '; this.after('selectedChange', this._uiSelectedChange); this.after('routeChange', function (){ this.render(); diff --git a/Tests/js/views/navigation/assets/ez-navigationitemview-tests.js b/Tests/js/views/navigation/assets/ez-navigationitemview-tests.js index 1803fee97..0b95789e0 100644 --- a/Tests/js/views/navigation/assets/ez-navigationitemview-tests.js +++ b/Tests/js/views/navigation/assets/ez-navigationitemview-tests.js @@ -13,6 +13,7 @@ YUI.add('ez-navigationitemview-tests', function (Y) { setUp: function () { this.title = "Title"; + this.identifier = 'title'; this.route = { name: "viewLocation", params: { @@ -22,6 +23,7 @@ YUI.add('ez-navigationitemview-tests', function (Y) { }; this.view = new Y.eZ.NavigationItemView({ title: this.title, + identifier: this.identifier, route: this.route, }); }, @@ -44,6 +46,19 @@ YUI.add('ez-navigationitemview-tests', function (Y) { ); }, + "Should add the navigation identifier on the container": function () { + var c = this.view.get('container'); + + Assert.isTrue( + c.hasAttribute('data-navigation-item-identifier'), + "The container should have the data-navigation-item-identifier" + ); + Assert.areEqual( + this.view.get('identifier'), c.getAttribute('data-navigation-item-identifier'), + "The data-navigation-item-identifier should have the right identifier value" + ); + }, + "Test render": function () { var templateCalled = false, origTpl;