moved naming patterns to seperate module and Angular constant
This commit is contained in:
parent
c55e9f2d12
commit
8a9a2972ec
9 changed files with 262 additions and 256 deletions
|
@ -17,136 +17,136 @@ describe("Service: AngularViewArray", () => {
|
|||
expect(angularViewArrayFactory).toBeDefined();
|
||||
});
|
||||
|
||||
// it("returns a ViewArray object", () => {
|
||||
// var viewArray: ViewArrayImpl = angularViewArray.create();
|
||||
//
|
||||
// expect(viewArray).toBeDefined();
|
||||
// });
|
||||
it("returns a ViewArray object", () => {
|
||||
var viewArray: ViewArrayImpl = angularViewArray.create();
|
||||
|
||||
// describe("returned ViewArray object", () => {
|
||||
// var viewArray: ViewArrayImpl;
|
||||
//
|
||||
// beforeEach(() => {
|
||||
// viewArray = angularViewArray.create();
|
||||
// });
|
||||
//
|
||||
// describe("constructor", () => {
|
||||
// // TODO
|
||||
// });
|
||||
//
|
||||
// describe("length", () => {
|
||||
//
|
||||
// it("returns the number of entries", () => {
|
||||
// viewArray.entries = [{}, {}, {}];
|
||||
//
|
||||
// expect(viewArray.length()).toEqual(viewArray.entries.length);
|
||||
// });
|
||||
// });
|
||||
//
|
||||
// describe("get", () => {
|
||||
//
|
||||
// it("returns the entry at a given index", () => {
|
||||
// var index: number = 8;
|
||||
// viewArray.entries = new Array(10);
|
||||
// viewArray.entries[index] = 3;
|
||||
//
|
||||
// expect(viewArray.get(index)).toEqual(viewArray.entries[index]);
|
||||
// });
|
||||
// });
|
||||
//
|
||||
// describe("push", () => {
|
||||
//
|
||||
// it("adds given element to the end of entries", () => {
|
||||
// var element: number = 3;
|
||||
// var originalLength: number = viewArray.length();
|
||||
// viewArray.push(element);
|
||||
//
|
||||
// expect(viewArray.entries.length).toEqual(originalLength + 1);
|
||||
// expect(viewArray.get(originalLength)).toEqual(element);
|
||||
// });
|
||||
//
|
||||
// it("sets 'hasEntries' to true", () => {
|
||||
// viewArray.push(2);
|
||||
//
|
||||
// expect(viewArray.hasEntries).toBe(true);
|
||||
// });
|
||||
//
|
||||
// it("starts timer if 'isVisible' is true", () => {
|
||||
// spyOn(viewArray, "startTimer_").and.returnValue(null);
|
||||
// viewArray.isVisible = true;
|
||||
// viewArray.push(2);
|
||||
//
|
||||
// expect(viewArray.startTimer_).toHaveBeenCalled();
|
||||
// });
|
||||
//
|
||||
// it("does not start timer if 'isVisible' is false", () => {
|
||||
// spyOn(viewArray, "startTimer_").and.returnValue(null);
|
||||
// viewArray.isVisible = false;
|
||||
// viewArray.push(2);
|
||||
//
|
||||
// expect(viewArray.startTimer_).not.toHaveBeenCalled();
|
||||
// });
|
||||
// });
|
||||
//
|
||||
// describe("toggle", () => {
|
||||
//
|
||||
// it("sets 'isVisible' to false if currently true", () => {
|
||||
// viewArray.isVisible = true;
|
||||
// viewArray.toggle();
|
||||
//
|
||||
// expect(viewArray.isVisible).toBe(false);
|
||||
// });
|
||||
//
|
||||
// it("sets 'isVisible' to true if currently false", () => {
|
||||
// viewArray.isVisible = false;
|
||||
// viewArray.toggle();
|
||||
//
|
||||
// expect(viewArray.isVisible).toBe(true);
|
||||
// });
|
||||
// });
|
||||
//
|
||||
// describe("setVisible", () => {
|
||||
//
|
||||
// it("sets 'isVisible' to false if given false", () => {
|
||||
// viewArray.setVisible(false);
|
||||
//
|
||||
// expect(viewArray.isVisible).toBe(false);
|
||||
// });
|
||||
//
|
||||
// it("sets 'visibleEntries' to empty array if given false", () => {
|
||||
// viewArray.setVisible(false);
|
||||
//
|
||||
// expect(viewArray.visibleEntries.length).toEqual(0);
|
||||
// });
|
||||
//
|
||||
// it("shows additional entries if given true", () => {
|
||||
// spyOn(viewArray, "showAdditionalEntries_").and.returnValue(null);
|
||||
// viewArray.setVisible(true);
|
||||
//
|
||||
// expect(viewArray.showAdditionalEntries_).toHaveBeenCalled();
|
||||
// });
|
||||
//
|
||||
// it("does not show additional entries if given false", () => {
|
||||
// spyOn(viewArray, "showAdditionalEntries_").and.returnValue(null);
|
||||
// viewArray.setVisible(false);
|
||||
//
|
||||
// expect(viewArray.showAdditionalEntries_).not.toHaveBeenCalled();
|
||||
// });
|
||||
//
|
||||
// it("starts timer if given true", () => {
|
||||
// spyOn(viewArray, "startTimer_").and.returnValue(null);
|
||||
// viewArray.setVisible(true);
|
||||
//
|
||||
// expect(viewArray.startTimer_).toHaveBeenCalled();
|
||||
// });
|
||||
//
|
||||
// it("stops timer if given false", () => {
|
||||
// spyOn(viewArray, "stopTimer_").and.returnValue(null);
|
||||
// viewArray.setVisible(true);
|
||||
//
|
||||
// expect(viewArray.stopTimer_).toHaveBeenCalled();
|
||||
// });
|
||||
// });
|
||||
// });
|
||||
expect(viewArray).toBeDefined();
|
||||
});
|
||||
|
||||
describe("returned ViewArray object", () => {
|
||||
var viewArray: ViewArrayImpl;
|
||||
|
||||
beforeEach(() => {
|
||||
viewArray = angularViewArray.create();
|
||||
});
|
||||
|
||||
describe("constructor", () => {
|
||||
// TODO
|
||||
});
|
||||
|
||||
describe("length", () => {
|
||||
|
||||
it("returns the number of entries", () => {
|
||||
viewArray.entries = [{}, {}, {}];
|
||||
|
||||
expect(viewArray.length()).toEqual(viewArray.entries.length);
|
||||
});
|
||||
});
|
||||
|
||||
describe("get", () => {
|
||||
|
||||
it("returns the entry at a given index", () => {
|
||||
var index: number = 8;
|
||||
viewArray.entries = new Array(10);
|
||||
viewArray.entries[index] = 3;
|
||||
|
||||
expect(viewArray.get(index)).toEqual(viewArray.entries[index]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("push", () => {
|
||||
|
||||
it("adds given element to the end of entries", () => {
|
||||
var element: number = 3;
|
||||
var originalLength: number = viewArray.length();
|
||||
viewArray.push(element);
|
||||
|
||||
expect(viewArray.entries.length).toEqual(originalLength + 1);
|
||||
expect(viewArray.get(originalLength)).toEqual(element);
|
||||
});
|
||||
|
||||
it("sets 'hasEntries' to true", () => {
|
||||
viewArray.push(2);
|
||||
|
||||
expect(viewArray.hasEntries).toBe(true);
|
||||
});
|
||||
|
||||
it("starts timer if 'isVisible' is true", () => {
|
||||
spyOn(viewArray, "startTimer_").and.returnValue(null);
|
||||
viewArray.isVisible = true;
|
||||
viewArray.push(2);
|
||||
|
||||
expect(viewArray.startTimer_).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("does not start timer if 'isVisible' is false", () => {
|
||||
spyOn(viewArray, "startTimer_").and.returnValue(null);
|
||||
viewArray.isVisible = false;
|
||||
viewArray.push(2);
|
||||
|
||||
expect(viewArray.startTimer_).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe("toggle", () => {
|
||||
|
||||
it("sets 'isVisible' to false if currently true", () => {
|
||||
viewArray.isVisible = true;
|
||||
viewArray.toggle();
|
||||
|
||||
expect(viewArray.isVisible).toBe(false);
|
||||
});
|
||||
|
||||
it("sets 'isVisible' to true if currently false", () => {
|
||||
viewArray.isVisible = false;
|
||||
viewArray.toggle();
|
||||
|
||||
expect(viewArray.isVisible).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("setVisible", () => {
|
||||
|
||||
it("sets 'isVisible' to false if given false", () => {
|
||||
viewArray.setVisible(false);
|
||||
|
||||
expect(viewArray.isVisible).toBe(false);
|
||||
});
|
||||
|
||||
it("sets 'visibleEntries' to empty array if given false", () => {
|
||||
viewArray.setVisible(false);
|
||||
|
||||
expect(viewArray.visibleEntries.length).toEqual(0);
|
||||
});
|
||||
|
||||
it("shows additional entries if given true", () => {
|
||||
spyOn(viewArray, "showAdditionalEntries_").and.returnValue(null);
|
||||
viewArray.setVisible(true);
|
||||
|
||||
expect(viewArray.showAdditionalEntries_).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("does not show additional entries if given false", () => {
|
||||
spyOn(viewArray, "showAdditionalEntries_").and.returnValue(null);
|
||||
viewArray.setVisible(false);
|
||||
|
||||
expect(viewArray.showAdditionalEntries_).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("starts timer if given true", () => {
|
||||
spyOn(viewArray, "startTimer_").and.returnValue(null);
|
||||
viewArray.setVisible(true);
|
||||
|
||||
expect(viewArray.startTimer_).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("stops timer if given false", () => {
|
||||
spyOn(viewArray, "stopTimer_").and.returnValue(null);
|
||||
viewArray.setVisible(true);
|
||||
|
||||
expect(viewArray.stopTimer_).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
Reference in a new issue