Add setting to expand inline diff (frontend)
Adds a setting to general preferences in the frontend. Will be followed by a change that actually changes the file list based on this preference. Feature: Issue 5115 Change-Id: I35db6651161259e9d308c75f0b67332083757a84
This commit is contained in:
@@ -183,6 +183,16 @@ limitations under the License.
|
|||||||
</select>
|
</select>
|
||||||
</span>
|
</span>
|
||||||
</section>
|
</section>
|
||||||
|
<section>
|
||||||
|
<span class="title">Expand Inline Diffs</span>
|
||||||
|
<span class="value">
|
||||||
|
<input
|
||||||
|
id="expandInlineDiffs"
|
||||||
|
type="checkbox"
|
||||||
|
checked$="[[_localPrefs.expand_inline_diffs]]"
|
||||||
|
on-change="_handleExpandInlineDiffsChanged">
|
||||||
|
</span>
|
||||||
|
</section>
|
||||||
<gr-button
|
<gr-button
|
||||||
id="savePrefs"
|
id="savePrefs"
|
||||||
on-tap="_handleSavePreferences"
|
on-tap="_handleSavePreferences"
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
'time_format',
|
'time_format',
|
||||||
'email_strategy',
|
'email_strategy',
|
||||||
'diff_view',
|
'diff_view',
|
||||||
|
'expand_inline_diffs',
|
||||||
];
|
];
|
||||||
|
|
||||||
Polymer({
|
Polymer({
|
||||||
@@ -228,6 +229,11 @@
|
|||||||
this._diffPrefsChanged = true;
|
this._diffPrefsChanged = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_handleExpandInlineDiffsChanged: function() {
|
||||||
|
this.set('_localPrefs.expand_inline_diffs',
|
||||||
|
this.$.expandInlineDiffs.checked);
|
||||||
|
},
|
||||||
|
|
||||||
_handleMenuChanged: function() {
|
_handleMenuChanged: function() {
|
||||||
if (this._isLoading()) { return; }
|
if (this._isLoading()) { return; }
|
||||||
this._menuChanged = true;
|
this._menuChanged = true;
|
||||||
|
|||||||
@@ -159,6 +159,8 @@ limitations under the License.
|
|||||||
.firstElementChild.bindValue, preferences.email_strategy);
|
.firstElementChild.bindValue, preferences.email_strategy);
|
||||||
assert.equal(valueOf('Diff View', 'preferences')
|
assert.equal(valueOf('Diff View', 'preferences')
|
||||||
.firstElementChild.bindValue, preferences.diff_view);
|
.firstElementChild.bindValue, preferences.diff_view);
|
||||||
|
assert.equal(valueOf('Expand Inline Diffs', 'preferences')
|
||||||
|
.firstElementChild.checked, false);
|
||||||
|
|
||||||
assert.isFalse(element._prefsChanged);
|
assert.isFalse(element._prefsChanged);
|
||||||
assert.isFalse(element._menuChanged);
|
assert.isFalse(element._menuChanged);
|
||||||
@@ -166,8 +168,13 @@ limitations under the License.
|
|||||||
// Change the diff view element.
|
// Change the diff view element.
|
||||||
var diffSelect = valueOf('Diff View', 'preferences').firstElementChild;
|
var diffSelect = valueOf('Diff View', 'preferences').firstElementChild;
|
||||||
diffSelect.bindValue = 'SIDE_BY_SIDE';
|
diffSelect.bindValue = 'SIDE_BY_SIDE';
|
||||||
|
|
||||||
|
var expandInlineDiffs =
|
||||||
|
valueOf('Expand Inline Diffs', 'preferences').firstElementChild;
|
||||||
diffSelect.fire('change');
|
diffSelect.fire('change');
|
||||||
|
|
||||||
|
MockInteractions.tap(expandInlineDiffs);
|
||||||
|
|
||||||
assert.isTrue(element._prefsChanged);
|
assert.isTrue(element._prefsChanged);
|
||||||
assert.isFalse(element._menuChanged);
|
assert.isFalse(element._menuChanged);
|
||||||
|
|
||||||
@@ -175,6 +182,7 @@ limitations under the License.
|
|||||||
savePreferences: function(prefs) {
|
savePreferences: function(prefs) {
|
||||||
assert.equal(prefs.diff_view, 'SIDE_BY_SIDE');
|
assert.equal(prefs.diff_view, 'SIDE_BY_SIDE');
|
||||||
assertMenusEqual(prefs.my, preferences.my);
|
assertMenusEqual(prefs.my, preferences.my);
|
||||||
|
assert.equal(prefs.expand_inline_diffs, true);
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user