Store number of files displayed in _viewState

Previously, if a user viewed more files or expanded all files, navigated
to a diff view, and back to the file list, it would not preserve the
state that it was left in.

Because the Polymer elements are recreated when the change view reloads,
the number of files shown property is reset to the default value.

This change adds an attribute in _viewState.changeView to store the
number of files shown. It preserves the state of the change view when
navigating to pages of a different type (ex: diff) and then back to the
change view. When a new change view is rendered (with a different
change number), the default files shown is reset.

Bug: Issue 5877
Change-Id: I36f9bc64b7d64a23a41c195b2e8188daf47d063f
This commit is contained in:
Becky Siegel
2017-04-10 15:33:17 -07:00
parent 3915d7baa1
commit 31a4a81f22
7 changed files with 33 additions and 12 deletions

View File

@@ -60,6 +60,7 @@ limitations under the License.
reload: function() { return Promise.resolve(); },
});
element = fixture('basic');
element.numFilesShown = 75;
saveStub = sandbox.stub(element, '_saveReviewedState',
function() { return Promise.resolve(); });
});
@@ -738,7 +739,7 @@ limitations under the License.
arr.push({__path: 'myfile.txt'});
});
element._files = arr;
element._numFilesShown = arr.length;
element.numFilesShown = arr.length;
assert.isFalse(computeSpy.lastCall.returnValue);
done();
});