Increase initial number of files shown to 200

Also, set fileListIncrement from the same value as numFilesShown to
futureproof- don't want one to get modified without the other.

Bug: Issue 5877
Change-Id: Idbbb9a694d9c203489454299309fd4cec31a00bd
This commit is contained in:
Becky Siegel
2017-04-14 18:48:37 -07:00
parent 4964cfff01
commit ca48a6fc8f
5 changed files with 20 additions and 14 deletions

View File

@@ -465,7 +465,8 @@ limitations under the License.
project-config="[[_projectConfig]]"
selected-index="{{viewState.selectedFileIndex}}"
diff-view-mode="{{viewState.diffMode}}"
num-files-shown="{{_numFilesShown}}"></gr-file-list>
num-files-shown="{{_numFilesShown}}"
file-list-increment="{{_numFilesShown}}"></gr-file-list>
</section>
<gr-messages-list id="messageList"
change-num="[[_changeNum]]"

View File

@@ -22,7 +22,7 @@
var COMMENT_SAVE = 'Saving... Try again after all comments are saved.';
var MIN_LINES_FOR_COMMIT_COLLAPSE = 30;
var DEFAULT_NUM_FILES_SHOWN = 75;
var DEFAULT_NUM_FILES_SHOWN = 200;
// Maximum length for patch set descriptions.
var PATCH_DESC_MAX_LENGTH = 500;

View File

@@ -374,8 +374,8 @@ limitations under the License.
};
element.viewState.changeNum = null;
element.viewState.diffMode = 'UNIFIED';
assert.equal(element.viewState.numFilesShown, 75);
assert.equal(element._numFilesShown, 75);
assert.equal(element.viewState.numFilesShown, 200);
assert.equal(element._numFilesShown, 200);
element._numFilesShown = 150;
flushAsynchronousOperations();
assert.equal(element.viewState.diffMode, 'UNIFIED');
@@ -394,8 +394,8 @@ limitations under the License.
flushAsynchronousOperations();
assert.isNull(element.viewState.diffMode);
assert.equal(element.viewState.changeNum, '2');
assert.equal(element.viewState.numFilesShown, 75);
assert.equal(element._numFilesShown, 75);
assert.equal(element.viewState.numFilesShown, 200);
assert.equal(element._numFilesShown, 200);
});
test('patch num change', function(done) {

View File

@@ -80,11 +80,7 @@
type: Object,
computed: '_calculatePatchChange(_files)',
},
_fileListIncrement: {
type: Number,
readOnly: true,
value: 75,
},
fileListIncrement: Number,
_hideChangeTotals: {
type: Boolean,
computed: '_shouldHideChangeTotals(_patchChange)',
@@ -702,7 +698,7 @@
},
_incrementNumFilesShown: function() {
this.numFilesShown += this._fileListIncrement;
this.numFilesShown += this.fileListIncrement;
},
_computeFileListButtonHidden: function(numFilesShown, files) {
@@ -712,7 +708,7 @@
_computeIncrementText: function(numFilesShown, files) {
if (!files) { return ''; }
var text =
Math.min(this._fileListIncrement, files.length - numFilesShown);
Math.min(this.fileListIncrement, files.length - numFilesShown);
return 'Show ' + text + ' more';
},

View File

@@ -60,7 +60,7 @@ limitations under the License.
reload: function() { return Promise.resolve(); },
});
element = fixture('basic');
element.numFilesShown = 75;
element.numFilesShown = 200;
saveStub = sandbox.stub(element, '_saveReviewedState',
function() { return Promise.resolve(); });
});
@@ -69,6 +69,15 @@ limitations under the License.
sandbox.restore();
});
test('correct number of files are shown', function() {
element._files = _.times(500, function(i) {
return {__path: '/file' + i, lines_inserted: 9}; });
flushAsynchronousOperations();
assert.equal(
Polymer.dom(element.root).querySelectorAll('.file-row').length,
element.numFilesShown);
});
test('get file list', function(done) {
var getChangeFilesStub = sandbox.stub(element.$.restAPI, 'getChangeFiles',
function() {