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
|
<gr-linked-chip
|
||||||
text="[[change.topic]]"
|
text="[[change.topic]]"
|
||||||
href="[[_computeTopicHref(change.topic)]]"
|
href="[[_computeTopicHref(change.topic)]]"
|
||||||
removable
|
removable="[[!_topicReadOnly]]"
|
||||||
on-remove="_handleTopicRemoved"></gr-linked-chip>
|
on-remove="_handleTopicRemoved"></gr-linked-chip>
|
||||||
</template>
|
</template>
|
||||||
<template is="dom-if" if="[[!change.topic]]">
|
<template is="dom-if" if="[[!change.topic]]">
|
||||||
|
@ -33,8 +33,10 @@ limitations under the License.
|
|||||||
<script>
|
<script>
|
||||||
suite('gr-change-metadata tests', function() {
|
suite('gr-change-metadata tests', function() {
|
||||||
var element;
|
var element;
|
||||||
|
var sandbox;
|
||||||
|
|
||||||
setup(function() {
|
setup(function() {
|
||||||
|
sandbox = sinon.sandbox.create();
|
||||||
stub('gr-rest-api-interface', {
|
stub('gr-rest-api-interface', {
|
||||||
getConfig: function() { return Promise.resolve({}); },
|
getConfig: function() { return Promise.resolve({}); },
|
||||||
getLoggedIn: function() { return Promise.resolve(false); },
|
getLoggedIn: function() { return Promise.resolve(false); },
|
||||||
@ -43,6 +45,10 @@ limitations under the License.
|
|||||||
element = fixture('basic');
|
element = fixture('basic');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
teardown(function() {
|
||||||
|
sandbox.restore();
|
||||||
|
});
|
||||||
|
|
||||||
test('computed fields', function() {
|
test('computed fields', function() {
|
||||||
assert.isFalse(element._computeHideStrategy({status: 'NEW'}));
|
assert.isFalse(element._computeHideStrategy({status: 'NEW'}));
|
||||||
assert.isFalse(element._computeHideStrategy({status: 'DRAFT'}));
|
assert.isFalse(element._computeHideStrategy({status: 'DRAFT'}));
|
||||||
@ -132,11 +138,60 @@ limitations under the License.
|
|||||||
assert.equal(element._computeWebLinks(element.commitInfo).length, 1);
|
assert.equal(element._computeWebLinks(element.commitInfo).length, 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
suite('remove reviewer votes', function() {
|
suite('Topic removal', function() {
|
||||||
var sandbox;
|
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() {
|
setup(function() {
|
||||||
sandbox = sinon.sandbox.create();
|
|
||||||
sandbox.stub(element, '_computeValueTooltip').returns('');
|
sandbox.stub(element, '_computeValueTooltip').returns('');
|
||||||
sandbox.stub(element, '_computeTopicReadOnly').returns(true);
|
sandbox.stub(element, '_computeTopicReadOnly').returns(true);
|
||||||
element.change = {
|
element.change = {
|
||||||
@ -156,10 +211,6 @@ limitations under the License.
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
teardown(function() {
|
|
||||||
sandbox.restore();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('_computeCanDeleteVote hides delete button', function() {
|
test('_computeCanDeleteVote hides delete button', function() {
|
||||||
flushAsynchronousOperations();
|
flushAsynchronousOperations();
|
||||||
var button = element.$$('gr-account-chip').$$('gr-button');
|
var button = element.$$('gr-account-chip').$$('gr-button');
|
||||||
|
@ -38,12 +38,14 @@ limitations under the License.
|
|||||||
}
|
}
|
||||||
gr-button.remove {
|
gr-button.remove {
|
||||||
background: #eee;
|
background: #eee;
|
||||||
|
border: 0;
|
||||||
color: #666;
|
color: #666;
|
||||||
font-size: 1.7em;
|
font-size: 1.7em;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
height: .6em;
|
height: .6em;
|
||||||
line-height: .6em;
|
line-height: .6em;
|
||||||
margin-left: .15em;
|
margin-left: .15em;
|
||||||
|
margin-top: -.05em;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user