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:
Becky Siegel
2016-12-16 12:59:26 -08:00
parent e4aa5cbf78
commit 0c1cbbfbdf
3 changed files with 24 additions and 0 deletions

View File

@@ -183,6 +183,16 @@ limitations under the License.
</select>
</span>
</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
id="savePrefs"
on-tap="_handleSavePreferences"

View File

@@ -20,6 +20,7 @@
'time_format',
'email_strategy',
'diff_view',
'expand_inline_diffs',
];
Polymer({
@@ -228,6 +229,11 @@
this._diffPrefsChanged = true;
},
_handleExpandInlineDiffsChanged: function() {
this.set('_localPrefs.expand_inline_diffs',
this.$.expandInlineDiffs.checked);
},
_handleMenuChanged: function() {
if (this._isLoading()) { return; }
this._menuChanged = true;

View File

@@ -159,6 +159,8 @@ limitations under the License.
.firstElementChild.bindValue, preferences.email_strategy);
assert.equal(valueOf('Diff View', 'preferences')
.firstElementChild.bindValue, preferences.diff_view);
assert.equal(valueOf('Expand Inline Diffs', 'preferences')
.firstElementChild.checked, false);
assert.isFalse(element._prefsChanged);
assert.isFalse(element._menuChanged);
@@ -166,8 +168,13 @@ limitations under the License.
// Change the diff view element.
var diffSelect = valueOf('Diff View', 'preferences').firstElementChild;
diffSelect.bindValue = 'SIDE_BY_SIDE';
var expandInlineDiffs =
valueOf('Expand Inline Diffs', 'preferences').firstElementChild;
diffSelect.fire('change');
MockInteractions.tap(expandInlineDiffs);
assert.isTrue(element._prefsChanged);
assert.isFalse(element._menuChanged);
@@ -175,6 +182,7 @@ limitations under the License.
savePreferences: function(prefs) {
assert.equal(prefs.diff_view, 'SIDE_BY_SIDE');
assertMenusEqual(prefs.my, preferences.my);
assert.equal(prefs.expand_inline_diffs, true);
return Promise.resolve();
}
});