test
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Javi Gallego 2020-05-19 13:06:59 +02:00
parent 3774d1dd1f
commit 529bd5673c
2 changed files with 6 additions and 4 deletions

View File

@ -53,8 +53,10 @@ class Controller extends Section {
scrollToLine(lineFk) {
const hashFk = this.lineFk || lineFk;
console.log(hashFk);
const hash = `vnItemDiary-${hashFk}`;
this.$location.hash(hash);
console.log(this.$location);
this.$anchorScroll();
}

View File

@ -44,19 +44,19 @@ describe('Item', () => {
describe('scrollToLine ()', () => {
it('should assign $location then call anchorScroll using controller value', () => {
jest.spyOn(controller, '$anchorScroll');
controller.ticketFk = 1;
controller.lineFk = 1;
controller.scrollToLine('invalidValue');
expect(controller.$location).toEqual(`vnItemDiary-${1}`);
expect(controller.$location.hash()).toEqual(`vnItemDiary-${1}`);
expect(controller.$anchorScroll).toHaveBeenCalledWith();
});
it('should assign $location then call anchorScroll using received value', () => {
jest.spyOn(controller, '$anchorScroll');
controller.ticketFk = undefined;
controller.lineFk = undefined;
controller.scrollToLine(1);
expect(controller.$location).toEqual(`vnItemDiary-${1}`);
expect(controller.$location.hash()).toEqual(`vnItemDiary-${1}`);
expect(controller.$anchorScroll).toHaveBeenCalledWith();
});
});