Merge "Add default values in create project dialog and group config" into stable-2.15

This commit is contained in:
Becky Siegel 2017-12-18 20:01:29 +00:00 committed by Gerrit Code Review
commit 4b30bfccc5
5 changed files with 31 additions and 1 deletions

View File

@ -28,7 +28,13 @@
/** @type {?} */
_projectConfig: {
type: Object,
value: () => { return {}; },
value: () => {
// Set default values for dropdowns.
return {
create_empty_commit: false,
permissions_only: false,
};
},
},
_projectCreated: {
type: Boolean,

View File

@ -48,6 +48,11 @@ limitations under the License.
sandbox.restore();
});
test('default values are populated', () => {
assert.isFalse(element.$.initalCommit.bindValue);
assert.isFalse(element.$.parentProject.bindValue);
});
test('project created', done => {
const configInputObj = {
name: 'test-project',

View File

@ -128,6 +128,7 @@ limitations under the License.
</span>
<span class="value">
<gr-select
id="visibleToAll"
bind-value="{{_groupConfig.options.visible_to_all}}">
<select disabled$="[[_computeGroupDisabled(_groupOwner, _isAdmin)]]">
<template is="dom-repeat" items="[[_submitTypes]]">

View File

@ -108,6 +108,13 @@
this._groupOwner = isOwner ? true : false;
});
// If visible to all is undefined, set to false. If it is defined
// as false, setting to false is fine. If any optional values
// are added with a default of true, then this would need to be an
// undefined check and not a truthy/falsy check.
if (!config.options.visible_to_all) {
config.options.visible_to_all = false;
}
this._groupConfig = config;
this.fire('title-change', {title: config.name});

View File

@ -68,6 +68,17 @@ limitations under the License.
.display === 'none');
});
test('default values are populated', done => {
sandbox.stub(element.$.restAPI, 'getIsGroupOwner', () => {
return Promise.resolve(true);
});
element.groupId = 1;
element._loadGroup().then(() => {
assert.isFalse(element.$.visibleToAll.bindValue);
done();
});
});
test('rename group', done => {
const groupName = 'test-group';
const groupName2 = 'test-group2';