Merge "Remove 'x' from topic chip when logged out"
This commit is contained in:
commit
b33d052c45
@ -179,7 +179,7 @@ limitations under the License.
|
||||
<gr-linked-chip
|
||||
text="[[change.topic]]"
|
||||
href="[[_computeTopicHref(change.topic)]]"
|
||||
removable
|
||||
removable="[[!_topicReadOnly]]"
|
||||
on-remove="_handleTopicRemoved"></gr-linked-chip>
|
||||
</template>
|
||||
<template is="dom-if" if="[[!change.topic]]">
|
||||
|
@ -33,8 +33,10 @@ limitations under the License.
|
||||
<script>
|
||||
suite('gr-change-metadata tests', function() {
|
||||
var element;
|
||||
var sandbox;
|
||||
|
||||
setup(function() {
|
||||
sandbox = sinon.sandbox.create();
|
||||
stub('gr-rest-api-interface', {
|
||||
getConfig: function() { return Promise.resolve({}); },
|
||||
getLoggedIn: function() { return Promise.resolve(false); },
|
||||
@ -43,6 +45,10 @@ limitations under the License.
|
||||
element = fixture('basic');
|
||||
});
|
||||
|
||||
teardown(function() {
|
||||
sandbox.restore();
|
||||
});
|
||||
|
||||
test('computed fields', function() {
|
||||
assert.isFalse(element._computeHideStrategy({status: 'NEW'}));
|
||||
assert.isFalse(element._computeHideStrategy({status: 'DRAFT'}));
|
||||
@ -132,11 +138,60 @@ limitations under the License.
|
||||
assert.equal(element._computeWebLinks(element.commitInfo).length, 1);
|
||||
});
|
||||
|
||||
suite('remove reviewer votes', function() {
|
||||
var sandbox;
|
||||
|
||||
suite('Topic removal', function() {
|
||||
var change;
|
||||
setup(function() {
|
||||
change = {
|
||||
_number: 'the number',
|
||||
actions: {
|
||||
topic: {enabled: false},
|
||||
},
|
||||
change_id: 'the id',
|
||||
topic: 'the topic',
|
||||
status: 'NEW',
|
||||
submit_type: 'CHERRY_PICK',
|
||||
labels: {
|
||||
test: {
|
||||
all: [{_account_id: 1, name: 'bojack', value: 1}],
|
||||
default_value: 0,
|
||||
values: [],
|
||||
},
|
||||
},
|
||||
removable_reviewers: [],
|
||||
};
|
||||
});
|
||||
|
||||
test('_computeTopicReadOnly', function() {
|
||||
var mutable = false;
|
||||
assert.isTrue(element._computeTopicReadOnly(mutable, change));
|
||||
mutable = true;
|
||||
assert.isTrue(element._computeTopicReadOnly(mutable, change));
|
||||
change.actions.topic.enabled = true;
|
||||
assert.isFalse(element._computeTopicReadOnly(mutable, change));
|
||||
mutable = false;
|
||||
assert.isTrue(element._computeTopicReadOnly(mutable, change));
|
||||
});
|
||||
|
||||
test('topic read only hides delete button', function() {
|
||||
element.mutable = false;
|
||||
element.change = change;
|
||||
flushAsynchronousOperations();
|
||||
var button = element.$$('gr-linked-chip').$$('gr-button');
|
||||
assert.isTrue(button.hasAttribute('hidden'));
|
||||
});
|
||||
|
||||
test('topic not read only does not hide delete button', function() {
|
||||
element.mutable = true;
|
||||
change.actions.topic.enabled = true;
|
||||
element.change = change;
|
||||
flushAsynchronousOperations();
|
||||
var button = element.$$('gr-linked-chip').$$('gr-button');
|
||||
assert.isFalse(button.hasAttribute('hidden'));
|
||||
});
|
||||
});
|
||||
|
||||
suite('remove reviewer votes', function() {
|
||||
setup(function() {
|
||||
sandbox = sinon.sandbox.create();
|
||||
sandbox.stub(element, '_computeValueTooltip').returns('');
|
||||
sandbox.stub(element, '_computeTopicReadOnly').returns(true);
|
||||
element.change = {
|
||||
@ -156,10 +211,6 @@ limitations under the License.
|
||||
};
|
||||
});
|
||||
|
||||
teardown(function() {
|
||||
sandbox.restore();
|
||||
});
|
||||
|
||||
test('_computeCanDeleteVote hides delete button', function() {
|
||||
flushAsynchronousOperations();
|
||||
var button = element.$$('gr-account-chip').$$('gr-button');
|
||||
|
@ -38,12 +38,14 @@ limitations under the License.
|
||||
}
|
||||
gr-button.remove {
|
||||
background: #eee;
|
||||
border: 0;
|
||||
color: #666;
|
||||
font-size: 1.7em;
|
||||
font-weight: normal;
|
||||
height: .6em;
|
||||
line-height: .6em;
|
||||
margin-left: .15em;
|
||||
margin-top: -.05em;
|
||||
padding: 0;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user