DYEBench should use TodoMVC to test FlightJS for consistency
[WebKit-https.git] / PerformanceTests / DoYouEvenBench / resources / todomvc / dependency-examples / flight / test / spec / data / todos_spec.js
1 describeComponent('app/js/data/todos', function () {
2     'use strict';
3
4     describe('without datastore', function () {
5         beforeEach(function () {
6             this.dataStore = new mocks.DataStore([]);
7             setupComponent({
8                 dataStore: this.dataStore
9             });
10         });
11
12         it('should add a new entry', function () {
13             var title = 'buy some unicorns';
14
15             spyOnEvent(document, 'dataTodoAdded');
16             this.component.trigger('uiAddRequested', {
17                 title: title
18             });
19
20             expect('dataTodoAdded').toHaveBeenTriggeredOn(document);
21             expect(this.dataStore.data.length).toBe(1);
22             expect(this.dataStore.all()[0].title).toBe(title);
23         });
24     });
25
26     describe('with datastore', function () {
27         beforeEach(function () {
28             this.dataStore = new mocks.DataStore();
29             setupComponent({
30                 dataStore: this.dataStore
31             });
32         });
33
34         it('removes completed', function () {
35             spyOn(this.dataStore, 'destroyAll');
36             this.component.trigger('uiClearRequested');
37             expect(this.dataStore.destroyAll).toHaveBeenCalledWith({ completed: true });
38         });
39     });
40 });
41