Skip to content

Commit df7b4a0

Browse files
committed
fixup! fix: refactor paged_container_spec to not call AjaxHelpers inside it()
1 parent 2f577d3 commit df7b4a0

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

cms/static/js/spec/views/paged_container_spec.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,13 +178,14 @@ function($, _, sinon, AjaxHelpers, URI, XBlockInfo, PagedContainer, PagingHeader
178178
describe('Next page button', function() {
179179
beforeEach(function() {
180180
pagingContainer.render();
181+
respondWithMockPage(requests);
181182
});
182183

183184
it('does not move forward if a server error occurs', function() {
184185
pagingContainer.setPage(0);
185186
respondWithMockPage(requests);
186187
pagingContainer.pagingHeader.$('.next-page-link').click();
187-
requests[1].respond(500);
188+
requests[2].respond(500);
188189
expect(pagingContainer.collection.currentPage).toBe(0);
189190
});
190191

@@ -218,13 +219,14 @@ function($, _, sinon, AjaxHelpers, URI, XBlockInfo, PagedContainer, PagingHeader
218219
describe('Previous page button', function() {
219220
beforeEach(function() {
220221
pagingContainer.render();
222+
respondWithMockPage(requests);
221223
});
222224

223225
it('does not move back if a server error occurs', function() {
224226
pagingContainer.setPage(1);
225227
respondWithMockPage(requests);
226228
pagingContainer.pagingHeader.$('.previous-page-link').click();
227-
requests[1].respond(500);
229+
requests[2].respond(500);
228230
expect(pagingContainer.collection.currentPage).toBe(1);
229231
});
230232

@@ -313,13 +315,14 @@ function($, _, sinon, AjaxHelpers, URI, XBlockInfo, PagedContainer, PagingHeader
313315
beforeEach(function() {
314316
// Render the page and header so that they can react to events
315317
pagingContainer.render();
318+
respondWithMockPage(requests);
316319
});
317320

318321
it('does not move forward if a server error occurs', function() {
319322
pagingContainer.setPage(0);
320323
respondWithMockPage(requests);
321324
pagingContainer.pagingFooter.$('.next-page-link').click();
322-
requests[1].respond(500);
325+
requests[2].respond(500);
323326
expect(pagingContainer.collection.currentPage).toBe(0);
324327
});
325328

@@ -354,13 +357,14 @@ function($, _, sinon, AjaxHelpers, URI, XBlockInfo, PagedContainer, PagingHeader
354357
beforeEach(function() {
355358
// Render the page and header so that they can react to events
356359
pagingContainer.render();
360+
respondWithMockPage(requests);
357361
});
358362

359363
it('does not move back if a server error occurs', function() {
360364
pagingContainer.setPage(1);
361365
respondWithMockPage(requests);
362366
pagingContainer.pagingFooter.$('.previous-page-link').click();
363-
requests[1].respond(500);
367+
requests[2].respond(500);
364368
expect(pagingContainer.collection.currentPage).toBe(1);
365369
});
366370

0 commit comments

Comments
 (0)