Commit 9a3cd505 authored by Lyza Danger Gardner's avatar Lyza Danger Gardner

Remove `group.public` from component; use `group.type` instead

parent d3a567fa
......@@ -14,8 +14,8 @@ module.exports = {
return this.isShared ? this.group.name : this.privateLabel;
};
this.groupType = function () {
return this.group.public ? 'public' : 'group';
this.groupCategory = function () {
return this.group.type === 'private' ? 'group' : 'public';
};
this.setPrivacy = function (level) {
......
......@@ -34,7 +34,6 @@ describe('publishAnnotationBtn', function () {
element = util.createDirective(document, 'publishAnnotationBtn', {
group: {
name: 'Public',
type: 'public',
},
canPost: true,
isShared: false,
......@@ -44,6 +43,31 @@ describe('publishAnnotationBtn', function () {
});
});
[
{
groupType: 'open',
expectedIcon: 'public',
},
{
groupType: 'restricted',
expectedIcon: 'public',
},
{
groupType: 'private',
expectedIcon: 'group',
},
].forEach(({ groupType, expectedIcon }) => {
it('should set the correct group-type icon class', function () {
element.ctrl.group = {
name: 'My Group',
type: groupType,
};
element.scope.$digest();
var iconElement = element.find('.group-icon-container > i');
assert.isTrue(iconElement.hasClass(`h-icon-${expectedIcon}`));
});
});
it('should display "Post to Only Me"', function () {
var buttons = element.find('button');
assert.equal(buttons.length, 3);
......@@ -53,7 +77,6 @@ describe('publishAnnotationBtn', function () {
it('should display "Post to Research Lab"', function () {
element.ctrl.group = {
name: 'Research Lab',
type: 'group',
};
element.ctrl.isShared = true;
element.scope.$digest();
......
......@@ -12,7 +12,7 @@
<li class="dropdown-menu__row" ng-click="vm.setPrivacy('shared')">
<div class="group-item">
<div class="group-icon-container">
<i class="small" ng-class="'h-icon-' + vm.groupType()"></i>
<i class="small" ng-class="'h-icon-' + vm.groupCategory()"></i>
</div>
<div class="group-details">
<div class="group-name-container">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment