Merge pull request '3734-fix(item_diary): apply async scroll' (#913) from 3734-item_diary_scroll into dev
gitea/salix/pipeline/head There was a failure building this commit Details

Reviewed-on: #913
Reviewed-by: Carlos Jimenez Ruiz <carlosjr@verdnatura.es>
This commit is contained in:
Carlos Jimenez Ruiz 2022-03-29 08:38:39 +00:00
commit 7b19a70f96
2 changed files with 10 additions and 4 deletions

View File

@ -52,10 +52,12 @@ class Controller extends Section {
}
scrollToLine(lineFk) {
const hashFk = this.lineFk || lineFk;
const hash = `vnItemDiary-${hashFk}`;
this.$location.hash(hash);
this.$anchorScroll();
this.$.$applyAsync(() => {
const hashFk = this.lineFk || lineFk;
const hash = `vnItemDiary-${hashFk}`;
this.$location.hash(hash);
this.$anchorScroll();
});
}
showDescriptor(event, sale) {

View File

@ -47,6 +47,8 @@ describe('Item', () => {
controller.lineFk = 1;
controller.scrollToLine('invalidValue');
$scope.$apply();
expect(controller.$location.hash()).toEqual(`vnItemDiary-${1}`);
expect(controller.$anchorScroll).toHaveBeenCalledWith();
});
@ -56,6 +58,8 @@ describe('Item', () => {
controller.lineFk = undefined;
controller.scrollToLine(1);
$scope.$apply();
expect(controller.$location.hash()).toEqual(`vnItemDiary-${1}`);
expect(controller.$anchorScroll).toHaveBeenCalledWith();
});