@@ -291,7 +291,7 @@ describe('Dataset', function() {
291
291
expect ( this . dataset . cachedRenderExtraArgs ) . toEqual ( [ 42 , true , false ] ) ;
292
292
} ) ;
293
293
294
- it ( 'should retrieved cached results for subsequent identical queries' , function ( ) {
294
+ it ( 'should retrieve cached results for subsequent identical queries' , function ( ) {
295
295
this . source . and . callFake ( fakeGetWithSyncResults ) ;
296
296
297
297
this . dataset . update ( 'woah' ) ;
@@ -308,6 +308,29 @@ describe('Dataset', function() {
308
308
expect ( this . dataset . getRoot ( ) ) . toContainText ( 'three' ) ;
309
309
} ) ;
310
310
311
+ it ( 'should not retrieve cached results for subsequent identical queries if cache is disabled' , function ( ) {
312
+ this . dataset = new Dataset ( {
313
+ name : 'test' ,
314
+ source : this . source = jasmine . createSpy ( 'source' ) ,
315
+ cache : false ,
316
+ } ) ;
317
+
318
+ this . source . and . callFake ( fakeGetWithSyncResultsAndExtraParams ) ;
319
+
320
+ this . dataset . update ( 'woah' ) ;
321
+ expect ( this . source . calls . count ( ) ) . toBe ( 1 ) ;
322
+ expect ( this . dataset . getRoot ( ) ) . toContainText ( 'one' ) ;
323
+ expect ( this . dataset . getRoot ( ) ) . toContainText ( 'two' ) ;
324
+ expect ( this . dataset . getRoot ( ) ) . toContainText ( 'three' ) ;
325
+
326
+ this . dataset . clear ( ) ;
327
+ this . dataset . update ( 'woah' ) ;
328
+ expect ( this . source . calls . count ( ) ) . toBe ( 2 ) ;
329
+ expect ( this . dataset . getRoot ( ) ) . toContainText ( 'one' ) ;
330
+ expect ( this . dataset . getRoot ( ) ) . toContainText ( 'two' ) ;
331
+ expect ( this . dataset . getRoot ( ) ) . toContainText ( 'three' ) ;
332
+ } ) ;
333
+
311
334
it ( 'should reuse render function extra params for subsequent identical queries' , function ( ) {
312
335
var spy = spyOn ( this . dataset , '_render' ) ;
313
336
this . source . and . callFake ( fakeGetWithSyncResultsAndExtraParams ) ;
0 commit comments