Can refresh queued posts via button

This commit is contained in:
Robin Ward
2015-04-27 13:52:37 -04:00
parent cce8693354
commit 3cb4554bbb
8 changed files with 74 additions and 7 deletions

View File

@ -10,6 +10,7 @@ test('defaults', function() {
ok(!rs.get('loadMoreUrl'));
ok(!rs.get('loading'));
ok(!rs.get('loadingMore'));
ok(!rs.get('refreshing'));
});
test('pagination support', function() {
@ -18,11 +19,29 @@ test('pagination support', function() {
equal(rs.get('length'), 2);
equal(rs.get('totalRows'), 4);
ok(rs.get('loadMoreUrl'), 'has a url to load more');
ok(!rs.get('loadingMore'), 'it is not loading more');
rs.loadMore().then(function() {
const promise = rs.loadMore();
ok(rs.get('loadingMore'), 'it is loading more');
promise.then(function() {
ok(!rs.get('loadingMore'), 'it finished loading more');
equal(rs.get('length'), 4);
ok(!rs.get('loadMoreUrl'));
});
});
});
test('refresh support', function() {
const store = createStore();
store.findAll('widget').then(function(rs) {
equal(rs.get('refreshUrl'), '/widgets?refresh=true', 'it has the refresh url');
const promise = rs.refresh();
ok(rs.get('refreshing'), 'it is refreshing');
promise.then(function() {
ok(!rs.get('refreshing'), 'it is finished refreshing');
});
});
});