Skip to content

Commit

Permalink
fix(kit): Multiselect fix scrolling to end (#3493)
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimirpotekhin authored Jan 24, 2023
1 parent caa5f9a commit d320900
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,26 @@ describe(`MultiSelect`, () => {
{capture: `viewport`},
);
});

it(`should scroll to end on focus`, () => {
cy.tuiVisit(`components/multi-select/API?expandable=false&sandboxWidth=350`);
cy.getByAutomationId(`tui-multi-select__arrow`).click({force: true});

[0, 1, 2, 3, 4].forEach(index => {
cy.get(`tui-data-list-wrapper`)
.findByAutomationId(`tui-data-list-wrapper__option`)
.eq(index)
.click({force: true});
});

cy.get(`button`).first().focus();
cy.wait(DEFAULT_TIMEOUT_BEFORE_ACTION)
.getByAutomationId(`tui-multi-select__arrow`)
.click({force: true});

cy.wait(DEFAULT_TIMEOUT_BEFORE_ACTION).matchImageSnapshot(
`03-multi-select-scroll-to-end`,
{capture: `viewport`},
);
});
});
2 changes: 1 addition & 1 deletion projects/kit/components/input-tag/input-tag.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ export class TuiInputTagComponent
this.addTag();
this.updateFocused(active);

if (!this.computedFocused) {
if (!active && !this.computedFocused) {
this.scrollToStart$.next();
}
}
Expand Down

0 comments on commit d320900

Please sign in to comment.