PolyGerrit: Update create dialog to use per project private config instead of global

Since change I6fea9f8d55c7a38ac293057681874e9b480341ed,
it has added support for per project private config instead of doing
it globally.

Change-Id: I72767ae5be0344d5275da1c41253f3284978c10a
This commit is contained in:
Paladox none
2017-08-23 09:23:35 +00:00
committed by Paladox
parent a541643986
commit 6e347e8793
3 changed files with 43 additions and 18 deletions

View File

@@ -56,8 +56,8 @@ limitations under the License.
});
element = fixture('basic');
element.projectName = 'test-project';
element._serverConfig = {
change: {},
element._projectConfig = {
private_by_default: {},
};
});
@@ -65,12 +65,17 @@ limitations under the License.
sandbox.restore();
});
test('new change created', () => {
test('new change created with private', () => {
element._projectConfig = {
private_by_default: {
inherited_value: true,
},
};
const configInputObj = {
branch: 'test-branch',
topic: 'test-topic',
subject: 'first change created with polygerrit ui',
is_private: true,
work_in_progress: false,
project: element.projectName,
};
@@ -84,15 +89,40 @@ limitations under the License.
element.branch = 'test-branch';
element.topic = 'test-topic';
element.subject = 'first change created with polygerrit ui';
element.is_private = true;
element.work_in_progress = false;
assert.isTrue(element.$.privateChangeCheckBox.checked);
element.$.branchInput.bindValue = configInputObj.branch;
element.$.tagNameInput.bindValue = configInputObj.topic;
element.$.messageInput.bindValue = configInputObj.subject;
element.handleCreateChange().then(() => {
assert.isTrue(saveStub.lastCall.calledWithExactly(configInputObj));
});
});
test('new change created with wip', () => {
const configInputObj = {
branch: 'test-branch',
topic: 'test-topic',
subject: 'first change created with polygerrit ui',
project: element.projectName,
};
const saveStub = sandbox.stub(element.$.restAPI,
'createChange', () => {
return Promise.resolve({});
});
element.project = element.projectName;
element.branch = 'test-branch';
element.topic = 'test-topic';
element.subject = 'first change created with polygerrit ui';
element.$.wipChangeCheckBox.checked = true;
assert.isFalse(element.$.privateChangeCheckBox.checked);
element.$.branchInput.bindValue = configInputObj.branch;
element.$.tagNameInput.bindValue = configInputObj.topic;
element.$.messageInput.bindValue = configInputObj.subject;
element.$.privateChangeCheckBox.checked = configInputObj.is_private;
element.$.wipChangeCheckBox.checked =
configInputObj.work_in_progress;
element.handleCreateChange().then(() => {
assert.isTrue(saveStub.lastCall.calledWithExactly(configInputObj));