Skip to content

Commit eeb8593

Browse files
committed
additional testing for the new get signature
1 parent 06b8d09 commit eeb8593

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

test/BasicSetupSpec.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ describe('uiScroll', function () {
5252
);
5353
});
5454

55-
it('should call get on the datasource 1 time ', function () {
55+
it('should call get on the datasource 2 times ', function () {
5656
var spy;
5757
inject(function (myEmptyDatasource) {
5858
spy = spyOn(myEmptyDatasource, 'get').and.callThrough();
@@ -74,7 +74,6 @@ describe('uiScroll', function () {
7474
describe('basic setup (new datasource get signature)', function () {
7575
var scrollSettings = {datasource: 'myNewEmptyDatasource'};
7676

77-
// this does not work because spy always return 0 for the number of parameters (spy.length)
7877
it('should call get on the datasource 2 times ', function () {
7978
var spy;
8079
inject(function (myNewEmptyDatasource) {
@@ -86,9 +85,15 @@ describe('uiScroll', function () {
8685
expect(spy.calls.all()[0].args.length).toBe(2);
8786
expect(spy.calls.all()[0].args[0].index).toBe(1);
8887
expect(spy.calls.all()[0].args[0].count).toBe(10);
88+
expect('append' in spy.calls.all()[0].args[0]).toBe(true);
89+
expect(spy.calls.all()[0].args[0].append).toBeUndefined();
90+
expect('prepend' in spy.calls.all()[0].args[0]).toBe(false);
8991
expect(spy.calls.all()[1].args.length).toBe(2);
9092
expect(spy.calls.all()[1].args[0].index).toBe(-9);
9193
expect(spy.calls.all()[1].args[0].count).toBe(10);
94+
expect('append' in spy.calls.all()[1].args[0]).toBe(false);
95+
expect('prepend' in spy.calls.all()[1].args[0]).toBe(true);
96+
expect(spy.calls.all()[1].args[0].prepend).toBeUndefined();
9297
}
9398
);
9499
});

0 commit comments

Comments
 (0)