Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
Fix sortByKey not clearing all properties (#901)
Browse files Browse the repository at this point in the history
- Fix `sortByKey` not clearing all properties in
  abstract-paged-controller
- Add `firstKey` and `nextStartKey` to be set to `null`
  • Loading branch information
mkly authored and jkleinsc committed Dec 27, 2016
1 parent ca37bf7 commit 3786873
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
4 changes: 3 additions & 1 deletion app/controllers/abstract-paged-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,11 @@ export default Ember.Controller.extend(PaginationProps, ProgressDialog, UserSess
this.setProperties({
previousStartKey: null,
previousStartKeys: [],
nextStartKey: null,
sortDesc,
sortKey,
startKey: null
startKey: null,
firstKey: null
});
this.showProgressModal();
}
Expand Down
10 changes: 2 additions & 8 deletions tests/unit/controllers/abstract-paged-controller-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,6 @@ sinonTest('actions.previousPage', function(assert) {
assert.ok(showProgressModal.calledOnce, 'Should show progress modal');
});

/**
* @todo verify that not clearing `nextStartKey` and `firstKey`
* is the intended behavior
*/
sinonTest('actions.sortByKey', function(assert) {
let controller = this.subject({
nextStartKey: 'next',
Expand All @@ -139,10 +135,8 @@ sinonTest('actions.sortByKey', function(assert) {

controller.send('sortByKey', 'sort', 'desc');

// These two assertions preserve current implementation
assert.strictEqual(controller.get('nextStartKey'), 'next', 'Should not change nextStartKey');
assert.strictEqual(controller.get('firstKey'), 'first', 'Should not change firstKey');

assert.strictEqual(controller.get('nextStartKey'), null, 'Should clear nextStartKey');
assert.strictEqual(controller.get('firstKey'), null, 'Should clear firstKey');
assert.strictEqual(controller.get('startKey'), null, 'Should clear startKey');
assert.deepEqual(controller.get('previousStartKeys'), [], 'Should clear previousStartKeys');
assert.strictEqual(controller.get('previousStartKey'), null, 'Should clear previousStartKey');
Expand Down

0 comments on commit 3786873

Please sign in to comment.