Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

Commit

Permalink
Fix EZP-27144: Current location not viewable when content browsing
Browse files Browse the repository at this point in the history
  • Loading branch information
stephaneDiot committed Apr 4, 2017
1 parent 77c2b32 commit 11b8614
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ YUI.add('ez-discoverybarviewservice', function (Y) {
startingLocationId: startingLocationId,
minDiscoverDepth: rootDepth,
confirmLabel: Y.eZ.trans('view.content.label', {}, 'bar'),
isSelectable: function(contentStruct) {
if (startingLocationId === contentStruct.location.get('id')) {
return false;
}
return true;
}
},
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,24 @@ YUI.add('ez-discoverybarviewservice-tests', function (Y) {
},

"Should fire contentDiscover with a starting location on browseAction event": function () {
var contentDiscoverFired = false;
var contentDiscoverFired = false,
otherLocation = new Y.Base();

otherLocation.set('id', 'AnyOtherId');
this.service.on('contentDiscover', Y.bind(function (e) {
contentDiscoverFired = true;

Assert.isFunction(e.config.isSelectable, "config should have a function named isSelectable");

Y.Assert.isTrue(
e.config.isSelectable({location: otherLocation}),
"isSelectable should return TRUE if selected content is container"
);
Y.Assert.isFalse(
e.config.isSelectable({location: this.location}),
"isSelectable should return FALSE if selected content is container"
);

Assert.areSame(
e.config.startingLocationId, this.locationId,
"startingLocationId should have the id of the current location of the locationViewView"
Expand Down

0 comments on commit 11b8614

Please # to comment.