Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(datepicker): focus on multiple instances (#3494) #3549

Conversation

gpolychronis
Copy link
Contributor

Before submitting a pull request, please make sure you have at least performed the following:

  • read and followed the CONTRIBUTING.md guide.
  • built and tested the changes locally.
  • added/updated any applicable tests.
  • added/updated any applicable API documentation.
  • added/updated any applicable demos.

@maxokorokov
Copy link
Member

FYI tests are failing because of an unrelated issue. I just pushed the fix to the master

@gpolychronis gpolychronis force-pushed the datepicker/focus/multipleInstancesBug branch from 437a526 to 27da357 Compare January 23, 2020 08:21
@codecov-io
Copy link

codecov-io commented Jan 23, 2020

Codecov Report

Merging #3549 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3549      +/-   ##
==========================================
+ Coverage   91.67%   91.67%   +<.01%     
==========================================
  Files         100      100              
  Lines        2882     2883       +1     
  Branches      532      532              
==========================================
+ Hits         2642     2643       +1     
  Misses        183      183              
  Partials       57       57
Flag Coverage Δ
#e2e 56.43% <100%> (+0.15%) ⬆️
#unit 88.51% <100%> (ø) ⬆️
Impacted Files Coverage Δ
src/datepicker/datepicker.ts 97.91% <100%> (+0.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4f61496...629df9b. Read the comment docs.

@gpolychronis gpolychronis force-pushed the datepicker/focus/multipleInstancesBug branch from 27da357 to 18e84c8 Compare January 23, 2020 09:45
@gpolychronis
Copy link
Contributor Author

Added tests.
@maxokorokov Please review

Also, it seems to fix the performance issue of #3396

Copy link
Member

@maxokorokov maxokorokov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, @gpolychronisamadeus.

LGTM, thanks for adding the test

Left three small comments, will merge after it is fixed right away, so you could rebase your main PR on this.

Cheers,
Max

await page.expectActive(new Date(2016, 7, 8), 0);
await page.getDayElement(new Date(2016, 7, 1), 1).click();
await sendKey(Key.ARROW_DOWN);
await page.expectActive(new Date(2016, 7, 8), 1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please check here that the day is actually focused? there is an expectFocused() utility for this
It still can be active, but not focused

e2e-app/src/app/datepicker/datepicker.po.ts Outdated Show resolved Hide resolved
@maxokorokov maxokorokov added this to the 5.2.2 milestone Jan 28, 2020
This adds additional condition to restrict focus in/out to instance of
the datepicker by verifyng if focus event target and related targets are
descendants of the datepicker element. This removes false results based
only on the class name checks, which fail when focus is switched between
datepicker instances.

Closes ng-bootstrap#3494
@gpolychronis gpolychronis force-pushed the datepicker/focus/multipleInstancesBug branch from 18e84c8 to 629df9b Compare January 28, 2020 11:16
@maxokorokov maxokorokov merged commit 035d399 into ng-bootstrap:master Jan 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants