DYEBench should use TodoMVC to test FlightJS for consistency
[WebKit-https.git] / PerformanceTests / DoYouEvenBench / resources / todomvc / dependency-examples / flight / test / spec / data / stats_spec.js
1 describeComponent('app/js/data/stats', function () {
2     'use strict';
3
4     describe('recount without datastore', function () {
5         beforeEach(function () {
6             setupComponent({
7                 dataStore: new mocks.DataStore([])
8             });
9         });
10
11         afterEach(function () {
12             localStorage.clear();
13         });
14
15         it('should trigger a dataStatsCounted event', function () {
16             spyOnEvent(document, 'dataStatsCounted');
17             this.component.recount();
18             expect('dataStatsCounted').toHaveBeenTriggeredOn(document);
19         });
20
21         it('should trigger dataStatsCounted when todos are loaded', function () {
22             spyOnEvent(document, 'dataStatsCounted');
23             $(document).trigger('dataTodosLoaded');
24             expect('dataStatsCounted').toHaveBeenTriggeredOn(document);
25         });
26
27         it('should provide empty stats', function () {
28             spyOnEvent(document, 'dataStatsCounted');
29             this.component.recount();
30             expect('dataStatsCounted').toHaveBeenTriggeredOnAndWith(document, {
31                 all: 0,
32                 remaining: 0,
33                 completed: 0,
34                 filter: ''
35             });
36         });
37     });
38
39     describe('recount with datastore', function () {
40         beforeEach(function () {
41             setupComponent({
42                 dataStore: new mocks.DataStore()
43             });
44         });
45
46         it('should provide full stats', function () {
47             spyOnEvent(document, 'dataStatsCounted');
48             this.component.recount();
49             expect('dataStatsCounted').toHaveBeenTriggeredOnAndWith(document, {
50                 all: 3,
51                 remaining: 2,
52                 completed: 1,
53                 filter: ''
54             });
55         });
56     });
57 });